Fix vehicle damage handler bug

Fixes vehicle appearing to repair itself on first hit. SetDamage 0 was
running if no parts were damaged because "totalDmg" is not a hitpoint.

Vanilla commit:

92ab8fe2d4
This commit is contained in:
ebaydayz
2016-11-10 15:51:36 -05:00
parent 6fb4290ffe
commit 2cb3dac0be
2 changed files with 11 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ or by zombie_attack
- return : updated damage for that part
broadcast: boolean. if true, then the request will be sent to all players if the vehicle is not local.
************************************************************/
private["_unit","_selection","_strH","_total","_damage","_needUpdate"];
private["_unit","_selection","_strH","_total","_damage","_needUpdate","_totalDmg"];
_unit = _this select 0;
_selection = _this select 1;
@@ -22,8 +22,10 @@ _total = _this select 2;
if (_selection != "") then {
_strH = "hit_" + _selection;
_totalDmg = false;
} else {
_strH = "totalDmg";
_totalDmg = true;
};
if (_total >= 0.98) then {
@@ -32,15 +34,16 @@ if (_total >= 0.98) then {
if (local _unit) then {
if (_total > 0) then {
_unit setVariable [_strH, _total, true];
if (!_totalDmg) then {
_unit setVariable [_strH, _total, true];
};
_unit setHit [_selection, _total];
PVDZ_veh_Save = [_unit,"damage",false,_totalDmg];
if (!isServer) then {
PVDZ_veh_Save = [_unit,"damage"];
publicVariableServer "PVDZ_veh_Save";
} else {
[_unit, "damage"] call server_updateObject;
PVDZ_veh_Save call server_updateObject;
};
};
} else {