Update vanilla fence building

Vanilla commits applied:

e88a5c42bc

fe95643511

9a82b8307c

5a305198c7

be872601c9

44a25b1b4a

7bfeab3c13

cc5f02a41a
This commit is contained in:
ebaydayz
2016-09-10 11:25:10 -04:00
parent 11a3df0177
commit f57e303355
9 changed files with 69 additions and 34 deletions

View File

@@ -0,0 +1,48 @@
/***********************************************************
ASSIGN DAMAGE TO A UNIT.
Called by "HandleDamage" vehicle Event Handler
- Function fnc_Obj_FenceHandleDam
- [unit] call fnc_Obj_FenceHandleDam;
- return : 0 no damage
************************************************************/
private["_obj","_total","_damage"];
//Object the EH is assigned too
_obj = _this select 0;
//Total damage of the object
_total = (damage _obj);
//Modify damage done based on level of fence
_damage = switch (1==1) do {
case ((typeof _obj) in ["WoodenFence_3","WoodenFence_4","WoodenFence_5","WoodenGate_2","WoodenGate_3"]): { 0.5 };
case ((typeof _obj) in ["WoodenFence_6","WoodenFence_7","WoodenGate_4"]): { 0.35 };
default { 1 };
};
//Is the object local
if (local _obj) then {
//is damage being done aboue 0 (should always be) not needed.
if (_damage > 0) then {
//Server running or client
if (!isServer) then {
//If its a client send to server get the ownering player and send damage to that player
PVDZ_veh_Save = [_obj,"objWallDamage",(_total + _damage)];
publicVariableServer "PVDZ_veh_Save";
} else {
//Server running the EH, update object to db
[_obj,"objWallDamage",(_total + _damage)] call server_updateObject;
};
};
} else {
//send to server then back to owning client/server
PVDZ_send = [_obj,"objWallDamage",_this];
publicVariableServer "PVDZ_send";
};
//Logging.
diag_log format["INFO - %1(%3) - %2(%4)",_obj,_damage,(typeof _obj),_total];
// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
0