ACE3/addons/zeus/functions/fnc_moduleUnconscious.sqf
YetheSamartaka e994906169
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 <pterolatypus@users.noreply.github.com>

* Update addons/medical_statemachine/Statemachine.hpp

Co-authored-by: pterolatypus <pterolatypus@users.noreply.github.com>

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: pterolatypus <pterolatypus@users.noreply.github.com>
2022-05-07 22:44:33 -05:00

54 lines
1.6 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: SilentSpike
* Flips the unconscious state of the unit the module is placed on.
*
* Arguments:
* 0: The module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* [LOGIC, [bob, kevin], true] call ace_zeus_fnc_moduleUnconscious
*
* Public: No
*/
params ["_logic"];
if !(local _logic) exitWith {};
if (isNil QEFUNC(medical,setUnconscious)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);
} else {
private _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
if ((_mouseOver select 0) != "OBJECT") then {
[LSTRING(NothingSelected)] call FUNC(showMessage);
} else {
private _unit = effectivecommander (_mouseOver select 1);
if !(_unit isKindOf "CAManBase") then {
[LSTRING(OnlyInfantry)] call FUNC(showMessage);
} else {
if !(alive _unit) 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);
};
};
};
};
deleteVehicle _logic;