From 91e312fdc797d0d7cc7cae9eea9db0849400e5e2 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 28 Aug 2016 16:18:53 -0400 Subject: [PATCH] Don't call player_forceSave when gear menu is aborted https://github.com/EpochModTeam/DayZ-Epoch/issues/1712#issuecomment-242992472 --- SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp | 2 +- SQF/dayz_code/compile/fn_gearMenuChecks.sqf | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp b/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp index 3ef106199..38a250931 100644 --- a/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp +++ b/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp @@ -7,7 +7,7 @@ class RscDisplayGear //onLoad = "[] spawn object_monitorGear; {player removeMagazines _x} count MeleeMagazines; call gear_ui_init; call ui_gear_sound; if (isNil('IGUI_GEAR_activeFilter')) then { IGUI_GEAR_activeFilter = 0;}; [_this,'onLoad'] execVM '\z\addons\dayz_code\system\handleGear.sqf'";/* diag_log 'RscDisplayGear : : onLoad'; */ //onUnload = "{player removeMagazines _x} count MeleeMagazines; call player_forceSave; call dayz_meleeMagazineCheck;"; /* diag_log 'RscDisplayGear : : onunLoad'; */ onLoad = "setMousePosition [0.5, 0.5];_this call fn_gearMenuChecks; false call dz_fn_meleeMagazines; [] spawn object_monitorGear; call gear_ui_init; call ui_gear_sound; if (isNil 'IGUI_GEAR_activeFilter') then {IGUI_GEAR_activeFilter = 0}; [_this, 'onLoad'] execVM '\z\addons\dayz_code\system\handleGear.sqf'"; - onUnload = "true call dz_fn_meleeMagazines; call player_forceSave;"; + onUnload = "if (!DZE_abortGearMenu) then {true call dz_fn_meleeMagazines; call player_forceSave;};"; onMouseMoving = "[] call gear_ui_hide;"; onMouseHolding = "[] call gear_ui_hide;"; diff --git a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf index 2cf9e3655..6737b712c 100644 --- a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf +++ b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf @@ -1,5 +1,7 @@ private ["_cTarget","_dis","_display","_friendlies","_rID"]; +DZE_abortGearMenu = false; + // players inside vehicle can always access its gear if ((vehicle player) == player) then { disableSerialization; @@ -9,7 +11,8 @@ if ((vehicle player) == player) then { if ((locked _cTarget) && {(_cTarget isKindOf "LandVehicle") or {_cTarget isKindOf "Air"} or {_cTarget isKindOf "Ship"}} && {(player distance _cTarget) < _dis}) then { localize "str_epoch_player_7" call dayz_rollingMessages; - _display closeDisplay 1; + DZE_abortGearMenu = true; + _display closeDisplay 2; }; if (DZE_BackpackAntiTheft) then { @@ -17,7 +20,8 @@ if ((vehicle player) == player) then { _rID = if (DZE_permanentPlot) then { getPlayerUID _cTarget } else { _cTarget getVariable ["CharacterID","0"] }; if ((!canbuild or isInTraderCity) && {_cTarget isKindOf "Man"} && {alive _cTarget} && {isPlayer _cTarget} && {!(_rID in _friendlies)} && {(player distance _cTarget) < 12}) then { localize "STR_EPOCH_PLAYER_316" call dayz_rollingMessages; - _display closeDisplay 1; + DZE_abortGearMenu = true; + _display closeDisplay 2; }; }; }; \ No newline at end of file