Skip to content

Commit

Permalink
Don't call player_forceSave when gear menu is aborted
Browse files Browse the repository at this point in the history
  • Loading branch information
ebaydayz committed Aug 28, 2016
1 parent a245690 commit 91e312f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;";

Expand Down
8 changes: 6 additions & 2 deletions SQF/dayz_code/compile/fn_gearMenuChecks.sqf
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -9,15 +11,17 @@ 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 {
_friendlies = player getVariable ["friendlies",[]];
_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;
};
};
};

3 comments on commit 91e312f

@icomrade
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure this doesn't introduce a dupe

@icomrade
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange, it's not happening now (I haven't yet synced with this commit) but it happened multiple times with a UH1Y and BRDM. I just logged out next to them and my gear was wiped. you can probably revert this commit.

@ebayShopper
Copy link
Collaborator

@ebayShopper ebayShopper commented on 91e312f Aug 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

Please sign in to comment.