From bbf9ce61f00d4a902c4998a9c4e9cf592e31b5de Mon Sep 17 00:00:00 2001 From: Thomas Kooi Date: Wed, 21 Jan 2015 15:52:11 +0100 Subject: [PATCH] Changed QGVAR(isDead) to ACE_isDead Minor improvements to debug function --- addons/common/XEH_postInit.sqf | 2 +- addons/common/functions/fnc_carryObj.sqf | 8 ++++---- addons/common/functions/fnc_debug.sqf | 13 +++++++++---- addons/common/functions/fnc_doAnimation.sqf | 2 +- addons/common/functions/fnc_isAwake.sqf | 2 +- addons/common/functions/fnc_makeCopyOfBody_f.sqf | 2 +- addons/common/functions/fnc_resetAllDefaults_f.sqf | 2 +- addons/common/functions/fnc_setDead.sqf | 4 ++-- 8 files changed, 20 insertions(+), 15 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 91c586c43d..ec5e466ff4 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -145,7 +145,7 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); [QGVAR(reviveCounter_f), 0, false, QGVAR(ADDON)] call FUNC(defineVariable); [QGVAR(inReviveState), false, true, QGVAR(ADDON)] call FUNC(defineVariable); -[QGVAR(isDead),false,true,QUOTE(ADDON)] call FUNC(defineVariable); +["ACE_isDead",false,true,QUOTE(ADDON)] call FUNC(defineVariable); [QGVAR(isDeadPlayer), false, true, QUOTE(ADDON)] call FUNC(defineVariable); [QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable); ["ACE_isUnconscious",false,true,QUOTE(ADDON)] call FUNC(defineVariable); diff --git a/addons/common/functions/fnc_carryObj.sqf b/addons/common/functions/fnc_carryObj.sqf index c8c66ab7b3..6d911029a2 100644 --- a/addons/common/functions/fnc_carryObj.sqf +++ b/addons/common/functions/fnc_carryObj.sqf @@ -37,8 +37,8 @@ if (((typeName _to) == "OBJECT" && (isNull ([_unit] call FUNC(getCarriedObj)))) [format["fnc_carryObj - UNIT: %1 TO %2 - attachTo offset: %3",_unit,_to,(_this select 2)],2] call FUNC(debug); }; }; - // ["carryObject", [_unit], [_unit, _to, _fallDown]] call EFUNC(common,targetEvent); - ["carryObject", [_unit, _to, _fallDown]] call ace_common_fnc_localEvent; + ["carryObject", [_unit], [_unit, _to, _fallDown]] call EFUNC(common,targetEvent); + // ["carryObject", [_unit, _to, _fallDown]] call ace_common_fnc_localEvent; }; } else { if (!isNull ([_unit] call FUNC(getCarriedObj))) then { @@ -61,8 +61,8 @@ if (((typeName _to) == "OBJECT" && (isNull ([_unit] call FUNC(getCarriedObj)))) _unit setvariable [QGVAR(carriedObj),_to,true]; _return = true; - // ["carryObjectDropped", [_unit], [_unit, _to, _fallDown]] call EFUNC(common,targetEvent); - ["carryObjectDropped", [_unit, _to, _fallDown]] call ace_common_fnc_localEvent; + ["carryObjectDropped", [_unit], [_unit, _to, _fallDown]] call EFUNC(common,targetEvent); + // ["carryObjectDropped", [_unit, _to, _fallDown]] call ace_common_fnc_localEvent; }; }; diff --git a/addons/common/functions/fnc_debug.sqf b/addons/common/functions/fnc_debug.sqf index dfb5ba7dd1..aa7cab6dc1 100644 --- a/addons/common/functions/fnc_debug.sqf +++ b/addons/common/functions/fnc_debug.sqf @@ -16,21 +16,26 @@ private ["_msg", "_level", "_prefix", "_defaultLoglevel","_defaultLogDisplayLeve _msg = _this select 0; _level = if (count _this > 1) then {_this select 1} else { 2 }; +if (typeName _level != "NUMBER") then { + _level = 2; +}; + _defaultLoglevel = if (isNil QGVAR(LOGLEVEL)) then { DEFAULT_LOGGING_LEVEL; } else { GVAR(LOGLEVEL); }; +if (_defaultLoglevel < 0) exitwith { + false +}; + _defaultLogDisplayLevel = if (isnil QGVAR(LOGDISPLAY_LEVEL)) then { DEFAULT_TEXT_DISPLAY; } else { GVAR(LOGDISPLAY_LEVEL); }; -if (_defaultLoglevel < 0) exitwith { - false -}; if (_level <= _defaultLoglevel) then { _prefix = switch (_level) do { @@ -42,7 +47,7 @@ if (_level <= _defaultLoglevel) then { }; _message = format["[%1] %2",_prefix,_msg]; - if (_level >= _defaultLogDisplayLevel) then { + if (_level <= _defaultLogDisplayLevel) then { systemChat _message; }; diag_log _message; diff --git a/addons/common/functions/fnc_doAnimation.sqf b/addons/common/functions/fnc_doAnimation.sqf index 969a57fd6d..7bf2b93969 100644 --- a/addons/common/functions/fnc_doAnimation.sqf +++ b/addons/common/functions/fnc_doAnimation.sqf @@ -43,7 +43,7 @@ if (_unit getVariable ["ACE_isUnconscious", false] && {!_force}) exitWith { }; // don't go unconscious if the unit isn't unconscious -if (_animation == "Unconscious" && {!(_unit getVariable ["ACE_isUnconscious", false])}) exitWith {}; +if (_animation == "Unconscious" && {!((_unit getVariable ["ACE_isUnconscious", false]) || (_unit getVariable ["ACE_isDead", false]))}) exitWith {}; // switchMove "" no longer works in dev 1.37 if (_animation == "") then { diff --git a/addons/common/functions/fnc_isAwake.sqf b/addons/common/functions/fnc_isAwake.sqf index 462968efa4..4a5ed86aa8 100644 --- a/addons/common/functions/fnc_isAwake.sqf +++ b/addons/common/functions/fnc_isAwake.sqf @@ -12,4 +12,4 @@ private ["_unit","_return"]; _unit = _this select 0; -(!([_unit] call FUNC(isUnconscious))) && alive _unit && !(_unit getvariable [QGVAR(isDead),false]); +(!([_unit] call FUNC(isUnconscious))) && alive _unit && !(_unit getvariable ["ACE_isDead",false]); diff --git a/addons/common/functions/fnc_makeCopyOfBody_f.sqf b/addons/common/functions/fnc_makeCopyOfBody_f.sqf index 498e8a2168..eed890cca8 100644 --- a/addons/common/functions/fnc_makeCopyOfBody_f.sqf +++ b/addons/common/functions/fnc_makeCopyOfBody_f.sqf @@ -35,7 +35,7 @@ _caller = _this select 1; _newUnit disableAI "MOVE"; _newUnit disableAI "ANIM"; _newUnit disableAI "FSM"; - _newUnit setvariable [QGVAR(isDead),true,true]; + _newUnit setvariable ["ACE_isDead",true,true]; removeallweapons _newUnit; removeallassigneditems _newUnit; diff --git a/addons/common/functions/fnc_resetAllDefaults_f.sqf b/addons/common/functions/fnc_resetAllDefaults_f.sqf index 571526dbf6..00b2fad13e 100644 --- a/addons/common/functions/fnc_resetAllDefaults_f.sqf +++ b/addons/common/functions/fnc_resetAllDefaults_f.sqf @@ -13,7 +13,7 @@ private ["_unit","_oldUnit","_sets"]; _unit = _this select 0; -_unit setvariable [QGVAR(isDead),nil,true]; +_unit setvariable ["ACE_isDead",nil,true]; _unit setvariable ["ACE_isUnconscious", nil, true]; if (isPlayer _unit) then { diff --git a/addons/common/functions/fnc_setDead.sqf b/addons/common/functions/fnc_setDead.sqf index 1b24a0552e..8a274e26f1 100644 --- a/addons/common/functions/fnc_setDead.sqf +++ b/addons/common/functions/fnc_setDead.sqf @@ -62,7 +62,7 @@ if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == if (isPlayer _unit) then { titleText ["You died..","PLAIN DOWN"]; }; - [_unit,QGVAR(isDead), true, true] call FUNC(setDefinedVariable); + [_unit,"ACE_isDead", true, true] call FUNC(setDefinedVariable); if (_playerDead) then { [_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable); }; @@ -78,7 +78,7 @@ if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == }; -[_unit,QGVAR(isDead),true,true] call FUNC(setDefinedVariable); +[_unit,"ACE_isDead",true,true] call FUNC(setDefinedVariable); if (isPLayer _unit) then { [_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable); };