Skip to content

Commit 54437fb

Browse files
committed
Metal fence handleDamage updated to take damage from only pipebombs
1 parent 3f44887 commit 54437fb

File tree

5 files changed

+269
-219
lines changed

5 files changed

+269
-219
lines changed

SQF/dayz_buildings/configs/metalFence.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MetalFence_base: DZ_buildables
1313
};
1414

1515
class eventHandlers {
16-
HandleDamage = "if ((_this select 4) == 'PipeBomb') then {_this select 2} else { 0 };";
16+
HandleDamage = "if ((_this select 4) == 'PipeBomb') then {_this call fnc_Obj_handleDam;};";
1717
};
1818
};
1919
class MetalFence_ghost: MetalFence_base
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/***********************************************************
2+
ASSIGN DAMAGE TO A UNIT.
3+
Called by "HandleDamage" vehicle Event Handler
4+
5+
- Function fnc_obj_handleDam
6+
- [unit, damage] call fnc_obj_handleDam;
7+
- return : updated damage
8+
************************************************************/
9+
private["_obj","_total","_currentDamage"];
10+
11+
_obj = _this select 0;
12+
_damage = _this select 2;
13+
_total = (damage _obj);
14+
15+
if (_damage > 0) then {
16+
_total = (damage _obj) + _damage;
17+
18+
if (!isServer) then {
19+
PVDZ_obj_Save = [_obj,"objWallDamage",_total];
20+
publicVariableServer "PVDZ_obj_Save";
21+
} else {
22+
[_obj,"objWallDamage",_total] call server_updateObject;
23+
};
24+
};
25+
26+
27+
// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
28+
_total

SQF/dayz_code/init/compiles.sqf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,8 @@ fn_selectRandomLocation = compile preprocessFileLineNumbers "\z\addons\dayz_code
501501
fn_chance = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandomChance.sqf";
502502
fn_niceSpot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_niceSpot.sqf";
503503

504+
fnc_Obj_handleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\obj_handleDam.sqf";
505+
504506
object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
505507

506508
call compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\init.sqf";

SQF/dayz_code/init/publicEH.sqf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ if (isServer) then {
8181
"PVDZ_plr_Login2" addPublicVariableEventHandler {(_this select 1) call server_playerSetup};
8282
"PVDZ_plr_LoginRecord" addPublicVariableEventHandler {_id = (_this select 1) spawn dayz_recordLogin};
8383
"PVDZ_obj_Destroy" addPublicVariableEventHandler {(_this select 1) call server_deleteObj};
84+
"PVDZ_obj_Save" addPublicVariableEventHandler {(_this select 1) call server_updateObject; diag_log ("PublicEH");};
8485
"PVDZ_send" addPublicVariableEventHandler {(_this select 1) call server_sendToClient};
8586
"PVDZ_dayzCarBomb" addPublicVariableEventHandler {[_this select 1] execVM "\z\addons\dayz_code\actions\detonate_bomb.sqf";};
8687
//[player,[medical Array]];

0 commit comments

Comments
 (0)