From 4bf4c62b1df5642cb1d0b848a8997a4bef104b1c Mon Sep 17 00:00:00 2001 From: ebayShopper Date: Fri, 14 Apr 2017 17:18:16 -0400 Subject: [PATCH] Make free slots display more accurate in gear Use the cursorTarget at the time the gear dialog was opened instead of the cursorTarget at the time the script runs. The script can be delayed by several seconds (spawn is scheduled). --- SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp | 6 ++---- SQF/dayz_code/compile/fn_gearMenuChecks.sqf | 2 ++ SQF/dayz_code/compile/object_monitorGear.sqf | 2 +- SQF/dayz_code/compile/player_switchModel.sqf | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp b/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp index d37c769d2..c296fad8f 100644 --- a/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp +++ b/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp @@ -4,10 +4,8 @@ class RscDisplayGear enableDisplay = 1; movingEnable = 0; - //onLoad = "[] spawn object_monitorGear; false call dz_fn_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 = "false call dz_fn_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_selectWeapon; call player_forceSave;"; + onLoad = "_this call fn_gearMenuChecks; false call dz_fn_meleeMagazines; dayz_gearThread = cursorTarget 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; terminate dayz_gearThread; call player_selectWeapon; 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 8060b1e87..cff1f9526 100644 --- a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf +++ b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf @@ -1,3 +1,5 @@ +setMousePosition [0.5, 0.5]; + private ["_exit","_nearestObjects","_rID","_display","_cTarget","_dis","_friendlyTo","_lastSave","_startTime"]; // players inside vehicle can always access its gear diff --git a/SQF/dayz_code/compile/object_monitorGear.sqf b/SQF/dayz_code/compile/object_monitorGear.sqf index aa00e27d6..08b748018 100644 --- a/SQF/dayz_code/compile/object_monitorGear.sqf +++ b/SQF/dayz_code/compile/object_monitorGear.sqf @@ -44,7 +44,7 @@ _valueIDCs = [9002,9004,9006]; if (vehicle player != player) then { _object = vehicle player; } else { - _object = cursorTarget; + _object = _this; }; _type = typeOf _object; diff --git a/SQF/dayz_code/compile/player_switchModel.sqf b/SQF/dayz_code/compile/player_switchModel.sqf index fa9364ff0..8db173080 100644 --- a/SQF/dayz_code/compile/player_switchModel.sqf +++ b/SQF/dayz_code/compile/player_switchModel.sqf @@ -196,4 +196,4 @@ player setVariable ["BIS_noCoreConversations",true]; // publicVariable _playerObjName; call dayz_meleeMagazineCheck; -{player reveal _x} count (nearestObjects [getPosATL player,["AllVehicles","WeaponHolder","Land_A_tent","BuiltItems","ModularItems","DZE_Base_Object"],75]); +{player reveal _x} count (nearestObjects [_position,["AllVehicles","WeaponHolder","Land_A_tent","BuiltItems","ModularItems","DZE_Base_Object"],75]);