From 796eba5297e435642b4a84486c5a9426a2c12ff5 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 10 Feb 2017 13:03:12 -0600 Subject: [PATCH] Handle changes to CBA_fnc_addPlayerEventHandler (#4878) * Handle changes to CBA_fnc_addPlayerEventHandler * Fix var spelling --- addons/advanced_fatigue/XEH_postInit.sqf | 11 +++++++---- addons/advanced_throwing/XEH_postInit.sqf | 3 ++- addons/common/XEH_postInit.sqf | 4 ++-- addons/common/functions/fnc_setName.sqf | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/addons/advanced_fatigue/XEH_postInit.sqf b/addons/advanced_fatigue/XEH_postInit.sqf index 57be761607..542360c0c3 100644 --- a/addons/advanced_fatigue/XEH_postInit.sqf +++ b/addons/advanced_fatigue/XEH_postInit.sqf @@ -14,12 +14,15 @@ if (!hasInterface) exitWith {}; // - GVAR updating and initialization ----------------------------------------- ["unit", FUNC(handlePlayerChanged), true] call CBA_fnc_addPlayerEventHandler; - private _fnc_showStaminaBar = { + ["visibleMap", { + params ["", "_visibleMap"]; // command visibleMap is updated one frame later + private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull]; + _staminaBarContainer ctrlShow ((!_visibleMap) && {(vehicle ACE_player) == ACE_player}); + }, true] call CBA_fnc_addPlayerEventHandler; + ["vehicle", { private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull]; _staminaBarContainer ctrlShow ((!visibleMap) && {(vehicle ACE_player) == ACE_player}); - }; - ["visibleMap", _fnc_showStaminaBar, true] call CBA_fnc_addPlayerEventHandler; - ["vehicle", _fnc_showStaminaBar, true] call CBA_fnc_addPlayerEventHandler; + }, true] call CBA_fnc_addPlayerEventHandler; // - Duty factors ------------------------------------------------------------- if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then { diff --git a/addons/advanced_throwing/XEH_postInit.sqf b/addons/advanced_throwing/XEH_postInit.sqf index f3c0d4b9f6..f0c0e5231b 100644 --- a/addons/advanced_throwing/XEH_postInit.sqf +++ b/addons/advanced_throwing/XEH_postInit.sqf @@ -67,7 +67,8 @@ GVAR(ammoMagLookup) = call CBA_fnc_createNamespace; }] call CBA_fnc_addPlayerEventhandler; ["visibleMap", { - if (visibleMap && {ACE_player getVariable [QGVAR(inHand), false]}) then { + params ["", "_visibleMap"]; // command visibleMap is updated one frame later + if (_visibleMap && {ACE_player getVariable [QGVAR(inHand), false]}) then { [ACE_player, "Opened Map"] call FUNC(exitThrowMode); }; }] call CBA_fnc_addPlayerEventhandler; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 68920a7a5c..8200493810 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -282,11 +282,11 @@ enableCamShake true; params ["_newPlayer","_oldPlayer"]; if (alive _newPlayer) then { - [_newPlayer] call FUNC(setName); + [FUNC(setName), [_newPlayer]] call CBA_fnc_execNextFrame; }; if (alive _oldPlayer) then { - [_oldPlayer] call FUNC(setName); + [FUNC(setName), [_oldPlayer]] call CBA_fnc_execNextFrame; }; }] call CBA_fnc_addPlayerEventHandler; diff --git a/addons/common/functions/fnc_setName.sqf b/addons/common/functions/fnc_setName.sqf index 1b2b515ec2..f4858b877b 100644 --- a/addons/common/functions/fnc_setName.sqf +++ b/addons/common/functions/fnc_setName.sqf @@ -13,6 +13,7 @@ #include "script_component.hpp" params ["_unit"]; +TRACE_3("setName",_unit,alive _unit,name _unit); if (isNull _unit || {!alive _unit}) exitWith {};