From e99490616944b4a021f370bdbd83853e2cdf7669 Mon Sep 17 00:00:00 2001 From: YetheSamartaka <55753928+YetheSamartaka@users.noreply.github.com> Date: Sun, 8 May 2022 05:44:33 +0200 Subject: [PATCH] Medical - Add AI Unconsciousness exception (when using zeus module) (#8903) * Add DF-15 GForceCoef Value This adds missing ACE_GForceCoef value for DF-15 uniforms. * DF-15 PR - cfgWeapons formating DF-15 PR - cfgWeapons formating * DF-15 PR - cfgWeapons formating II Forgot to save it with braces and spaces around = * Update CfgWeapons.hpp * sync * Add AI Unconsciousness exception option - Adds AI Unconsciousness exception option. If enabled, it allows you to put AI into unconsciousness via Zeus Module even though the AI unconsciousness is disabled. This "feature" was possible before the medical rewrite and allowed to put selected AI units into unconsciousness even though the overall AI unconsciousness was disabled. This was very handy and many groups missing this option including myself. - Special thanks to Pterolatypus for consultation. * tabs to spaces tabs to spaces * last tab to space :copium: last tab to space :copium: * stringtable tabs to spaces stringtable tabs to spaces * Addon option removed, adjusted variable name - Addon option removed - adjusted variable name * utilized QEGVAR - utilized QEGVAR in getVariable * removed fnc and put the code inside the condition - I've managed to properly implement the getVariable inside the condition thus allowing me to remove the function. Also kymckay had a good point on swapping the order for faster eval. * Update XEH_PREP.hpp * setVariable optimalization - setVariable optimalization Co-authored-by: pterolatypus * Update addons/medical_statemachine/Statemachine.hpp Co-authored-by: pterolatypus Co-authored-by: PabstMirror Co-authored-by: pterolatypus --- AUTHORS.txt | 3 ++- addons/medical_statemachine/Statemachine.hpp | 2 +- addons/zeus/functions/fnc_moduleUnconscious.sqf | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 8ea1eb61c3..b6ced26e82 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -175,6 +175,7 @@ VyMajoris(W-Cephei) Walthzer Winter wizpig64 +YetheSamartaka xrufix Zakant -zGuba +zGuba \ No newline at end of file diff --git a/addons/medical_statemachine/Statemachine.hpp b/addons/medical_statemachine/Statemachine.hpp index 6508b4c34e..39ff12448e 100644 --- a/addons/medical_statemachine/Statemachine.hpp +++ b/addons/medical_statemachine/Statemachine.hpp @@ -46,7 +46,7 @@ class ACE_Medical_StateMachine { onStateEntered = QFUNC(enteredStateUnconscious); class DeathAI { targetState = "Dead"; - condition = QUOTE(!GVAR(AIUnconsciousness) && {!isPlayer _this}); + condition = QUOTE(!(_this getVariable [ARR_2(QQGVAR(AIUnconsciousness), GVAR(AIUnconsciousness))]) && {!isPlayer _this}); }; class WakeUp { targetState = "Injured"; diff --git a/addons/zeus/functions/fnc_moduleUnconscious.sqf b/addons/zeus/functions/fnc_moduleUnconscious.sqf index 9bcec2cdcb..6ee1e8fa60 100644 --- a/addons/zeus/functions/fnc_moduleUnconscious.sqf +++ b/addons/zeus/functions/fnc_moduleUnconscious.sqf @@ -38,6 +38,11 @@ if (isNil QEFUNC(medical,setUnconscious)) then { [LSTRING(OnlyAlive)] call FUNC(showMessage); } else { private _unconscious = GETVAR(_unit,ACE_isUnconscious,false); + if (_unconscious) then { + _unit setVariable [QEGVAR(medical_statemachine,AIUnconsciousness), nil, true]; + } else { + _unit setVariable [QEGVAR(medical_statemachine,AIUnconsciousness), true, true]; + }; // Function handles locality for me [_unit, !_unconscious, 10e10] call EFUNC(medical,setUnconscious); };