From bc89a260ff7f2eb47a36cb7b776acd63ec85837b Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 27 Nov 2016 16:38:33 -0600 Subject: [PATCH] AF - Remove setVar when removing eh --- addons/advanced_fatigue/functions/fnc_handlePlayerChanged.sqf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/advanced_fatigue/functions/fnc_handlePlayerChanged.sqf b/addons/advanced_fatigue/functions/fnc_handlePlayerChanged.sqf index c275b91cc8..9d33df10be 100644 --- a/addons/advanced_fatigue/functions/fnc_handlePlayerChanged.sqf +++ b/addons/advanced_fatigue/functions/fnc_handlePlayerChanged.sqf @@ -11,10 +11,13 @@ */ #include "script_component.hpp" params ["_newUnit", "_oldUnit"]; +TRACE_2("unit changed",_newUnit,_oldUnit); if !(isNull _oldUnit) then { _oldUnit enableStamina true; _oldUnit removeEventHandler ["AnimChanged", _oldUnit getVariable [QGVAR(animHandler), -1]]; + _oldUnit setVariable [QGVAR(animHandler), nil]; + TRACE_1("remove old",_oldUnit getVariable QGVAR(animHandler)); _oldUnit setVariable [QGVAR(ae1Reserve), GVAR(ae1Reserve)]; _oldUnit setVariable [QGVAR(ae2Reserve), GVAR(ae2Reserve)]; @@ -30,6 +33,7 @@ if (_newUnit getVariable [QGVAR(animHandler), -1] == -1) then { private _animHandler = _newUnit addEventHandler ["AnimChanged", { GVAR(animDuty) = _this call FUNC(getAnimDuty); }]; + TRACE_1("add new",_animHandler); _newUnit setVariable [QGVAR(animHandler), _animHandler]; };