mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
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:
@@ -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 {
|
||||
|
||||
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 {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
// [_object,_type] spawn server_updateObject;
|
||||
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
|
||||
if (isNil "sm_done") exitWith {};
|
||||
private ["_objectID","_objectUID","_object_position","_isNotOk","_object","_type","_recorddmg","_forced","_lastUpdate","_needUpdate","_object_inventory","_object_damage","_objWallDamage","_object_killed","_object_maintenance","_object_variables"];
|
||||
private ["_objectID","_objectUID","_object_position","_isNotOk","_object","_type","_recorddmg","_forced","_lastUpdate","_needUpdate","_object_inventory","_object_damage","_objWallDamage","_object_killed","_object_maintenance","_object_variables","_totalDmg"];
|
||||
|
||||
_object = _this select 0;
|
||||
_type = _this select 1;
|
||||
_recorddmg = false;
|
||||
_isNotOk = false;
|
||||
_forced = if (count _this > 2) then {_this select 2} else {false};
|
||||
_totalDmg = if (count _this > 3) then {_this select 3} else {false};
|
||||
_objectID = "0";
|
||||
_objectUID = "0";
|
||||
|
||||
@@ -127,7 +128,7 @@ _object_damage = {
|
||||
};
|
||||
} forEach _hitpoints;
|
||||
|
||||
if (_allFixed) then {_object setDamage 0;};
|
||||
if (_allFixed && !_totalDmg) then {_object setDamage 0;};
|
||||
|
||||
if (_forced) then {
|
||||
if (_object in needUpdate_objects) then {needUpdate_objects = needUpdate_objects - [_object];};
|
||||
|
||||
Reference in New Issue
Block a user