From 6bbbacbb715cc01fba56cba6bde82e0185f6883b Mon Sep 17 00:00:00 2001 From: AirwavesMan Date: Thu, 28 Jan 2021 14:17:59 +0100 Subject: [PATCH] Fix repair and salavage vehicles Vehicles have to be updated directly after they got repaired and salvaged. --- SQF/dayz_code/actions/salvage.sqf | 2 +- SQF/dayz_code/compile/veh_handleDam.sqf | 7 ++++--- SQF/dayz_code/compile/veh_handleRepair.sqf | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/SQF/dayz_code/actions/salvage.sqf b/SQF/dayz_code/actions/salvage.sqf index 8c0ae5720..36d2a79a2 100644 --- a/SQF/dayz_code/actions/salvage.sqf +++ b/SQF/dayz_code/actions/salvage.sqf @@ -52,7 +52,7 @@ if (_hasToolbox) then { /*if ((_hitpoint == "HitEngine") or (_hitpoint == "HitFuel")) then { [_vehicle, _selection, 0.89] call fnc_veh_handleDam; } else {*/ - [_vehicle, _selection, 1] call fnc_veh_handleDam; + [_vehicle, _selection, 1, objNull, objNull, objNull, true] call fnc_veh_handleDam; //}; _vehicle call fnc_veh_ResetEH; _vehicle setvelocity [0,0,1]; diff --git a/SQF/dayz_code/compile/veh_handleDam.sqf b/SQF/dayz_code/compile/veh_handleDam.sqf index 09377d6a0..643bd0ee0 100644 --- a/SQF/dayz_code/compile/veh_handleDam.sqf +++ b/SQF/dayz_code/compile/veh_handleDam.sqf @@ -14,22 +14,23 @@ 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","_total","_damage","_needUpdate","_totalDmg"]; +private["_unit","_selection","_total","_damage","_needUpdate","_totalDmg","_force"]; _unit = _this select 0; _selection = _this select 1; _total = _this select 2; _totalDmg = if (_selection != "") then {false} else {true}; +_force = [false,true] select (count _this > 6); // Needed to force update salavage if (_total >= 0.98) then { - _total = 1.0; + _total = 1.0; }; if (local _unit) then { if (_total > 0) then { _unit setHit [_selection, _total]; - PVDZ_veh_Save = [_unit,"damage",false,_totalDmg]; + PVDZ_veh_Save = [_unit,"damage",_force,_totalDmg]; if (!isServer) then { publicVariableServer "PVDZ_veh_Save"; } else { diff --git a/SQF/dayz_code/compile/veh_handleRepair.sqf b/SQF/dayz_code/compile/veh_handleRepair.sqf index 8facafc23..e3b2ec5d4 100644 --- a/SQF/dayz_code/compile/veh_handleRepair.sqf +++ b/SQF/dayz_code/compile/veh_handleRepair.sqf @@ -34,11 +34,11 @@ if (local _unit) then { _unit setHit [_selection, 0]; _log = format["%1. setH!t[%2,0]", _log, _selection]; if (!isServer) then { - PVDZ_veh_Save = [_unit, "repair"]; + PVDZ_veh_Save = [_unit, "repair",true]; publicVariableServer "PVDZ_veh_Save"; _log = _log + ". Requesting server hive write"; } else { - [_unit, "repair"] call server_updateObject; + [_unit, "repair",true] call server_updateObject; _log = _log + ". Writing to hive"; }; }