mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use macro for unconscious variable
This commit is contained in:
parent
563742bdd8
commit
ff33f8e954
@ -23,7 +23,7 @@
|
||||
private _unit = cursorTarget;
|
||||
if (!(_unit isKindOf "CAManBase")) then {_unit = cursorObject};
|
||||
if (!(_unit isKindOf "CAManBase")) then {_unit = ACE_player};
|
||||
if ((_unit != ACE_player) && {ACE_player getVariable ["ACE_isUnconscious", false]}) then {_unit = ACE_player};
|
||||
if ((_unit != ACE_player) && {IS_UNCONSCIOUS(ACE_player)}) then {_unit = ACE_player};
|
||||
if (!(_unit isKindOf "CAManBase")) exitWith {"No Unit?"};
|
||||
|
||||
private _return = [];
|
||||
@ -37,7 +37,7 @@
|
||||
private _targetState = [_unit, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState;
|
||||
if (!local _unit) then {_targetState = "NotLocal";};
|
||||
private _color = switch (_targetState) do {case "Default": {"33FF33"}; case "Injured": {"FF3333"}; case "Unconscious": {"FF8833"}; case "CardiacArrest": {"FF33AA"}; default {"555555"}};
|
||||
private _unconcFlag = if (_unit getVariable ["ACE_isUnconscious", false]) then {"[<t color='#FFFFFF'>U</t>]"} else {""};
|
||||
private _unconcFlag = if IS_UNCONSCIOUS(_unit) then {"[<t color='#FFFFFF'>U</t>]"} else {""};
|
||||
_return pushBack format ["<t color='#%1'>State: %2</t> [StableVitals: %3] %4", _color, _targetState, _hasStableVitals, _unconcFlag];
|
||||
|
||||
// Blood:
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
params ["_unit", "_local"];
|
||||
if (_local) then {
|
||||
if ((_unit getVariable ["ACE_isUnconscious",false]) && {count (_unit getVariable [QGVAR(unconsciousArguments), []]) >= 6}) then {
|
||||
if (IS_UNCONSCIOUS(_unit) && {count (_unit getVariable [QGVAR(unconsciousArguments), []]) >= 6}) then {
|
||||
private _arguments = (_unit getVariable [QGVAR(unconsciousArguments), []]);
|
||||
_arguments set [2, CBA_missionTime];
|
||||
|
||||
|
@ -21,7 +21,7 @@ params ["_unit"];
|
||||
[_unit] call FUNC(init);
|
||||
|
||||
// Reset captive status for respawning unit
|
||||
if (!(_unit getVariable ["ACE_isUnconscious", false])) then {
|
||||
if !IS_UNCONSCIOUS(_unit) then {
|
||||
[_unit, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
|
||||
};
|
||||
|
||||
|
@ -21,9 +21,9 @@
|
||||
params ["_unit", "_knockOut"];
|
||||
TRACE_2("setUnconsciousStatemachine",_unit,_knockOut);
|
||||
|
||||
if (_knockOut isEqualTo (_unit getVariable ["ACE_isUnconscious", false])) exitWith {TRACE_1("No Change - Exiting",_knockOut);};
|
||||
if (_knockOut isEqualTo IS_UNCONSCIOUS(_unit)) exitWith {TRACE_1("No Change - Exiting",_knockOut);};
|
||||
|
||||
_unit setVariable ["ACE_isUnconscious", _knockOut, true];
|
||||
_unit setVariable [VAR_UNCON, _knockOut, true];
|
||||
["ace_unconscious", [_unit, _knockOut]] call CBA_fnc_globalEvent;
|
||||
[_unit, _knockOut] call EFUNC(medical_engine,setUnconsciousAnim);
|
||||
|
||||
|
@ -34,7 +34,7 @@ if (!alive _unit) exitWith {
|
||||
_unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||
};
|
||||
if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
|
||||
[_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide);
|
||||
[_unit, false, VAR_UNCON, side group _unit] call EFUNC(common,switchToGroupSide);
|
||||
};
|
||||
[_unit, "setHidden", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, false] call EFUNC(common,disableAI);
|
||||
@ -49,7 +49,7 @@ if (!alive _unit) exitWith {
|
||||
};
|
||||
|
||||
// In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation
|
||||
if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith {
|
||||
if !IS_UNCONSCIOUS(_unit) exitWith {
|
||||
TRACE_7("ACE_DEBUG_Unconscious_PFH",_unit, _args, [_unit] call EFUNC(medical_status,isBeingCarried), [_unit] call EFUNC(medical_status,isBeingDragged), _idPFH, _unit getVariable QGVAR(unconsciousArguments),animationState _unit);
|
||||
// TODO, handle this with carry instead, so we can remove the PFH here.
|
||||
// Wait until the unit isn't being carried anymore, so we won't end up with wierd animations
|
||||
@ -109,7 +109,7 @@ if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith {
|
||||
// Swhich the unit back to its original group
|
||||
//Unconscious units shouldn't be put in another group #527:
|
||||
if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
|
||||
[_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide);
|
||||
[_unit, false, VAR_UNCON, side group _unit] call EFUNC(common,switchToGroupSide);
|
||||
};
|
||||
[_unit, false] call EFUNC(common,disableAI);
|
||||
_unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP)
|
||||
@ -141,6 +141,6 @@ if (!local _unit) exitWith {
|
||||
if ((CBA_missionTime - _startingTime) >= _minWaitingTime) exitWith {
|
||||
TRACE_2("ACE_DEBUG_Unconscious_Temp knock outs",_unit, [_unit] call FUNC(getUnconsciousCondition));
|
||||
if (!([_unit] call FUNC(getUnconsciousCondition))) then {
|
||||
_unit setVariable ["ACE_isUnconscious", false, true];
|
||||
_unit setVariable [VAR_UNCON, false, true];
|
||||
};
|
||||
};
|
||||
|
@ -67,7 +67,7 @@
|
||||
#define VAR_HEART_RATE QEGVAR(medical,heartRate)
|
||||
#define VAR_PAIN QEGVAR(medical,pain)
|
||||
#define VAR_PAIN_SUPP QEGVAR(medical,painSuppress)
|
||||
#define VAR_UNCON QEGVAR(medical,isUnconscious)
|
||||
#define VAR_UNCON "ACE_isUnconscious"
|
||||
// These variables track gradual adjustments (from medication, etc.)
|
||||
#define VAR_HEART_RATE_ADJ QEGVAR(medical,heartRateAdjustments)
|
||||
#define VAR_PAIN_SUPP_ADJ QEGVAR(medical,painSuppressAdjustments)
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Can't heal other units when unconscious
|
||||
if (_this getVariable ["ACE_isUnconscious", false]) exitWith {};
|
||||
if IS_UNCONSCIOUS(_this) exitWith {};
|
||||
// Check if we're still treating
|
||||
if ((_this getVariable [QGVAR(treatmentOverAt), CBA_missionTime]) > CBA_missionTime) exitWith {};
|
||||
|
||||
|
@ -45,7 +45,7 @@ _unit setVariable [QGVAR(stitchedWounds), [], true];
|
||||
_unit setVariable [QEGVAR(medical_engine,isLimping), false, true];
|
||||
|
||||
// - Misc ---------------------------------------------------------------------
|
||||
_unit setVariable [QGVAR(isUnconscious), false, true];
|
||||
_unit setVariable [VAR_UNCON, false, true];
|
||||
|
||||
// - Treatments ---------------------------------------------------------------
|
||||
_unit setVariable [QGVAR(tourniquets), [0,0,0,0,0,0], true];
|
||||
|
@ -37,7 +37,7 @@ if (!local _unit) exitWith {
|
||||
[QGVAR(setUnconscious), [_unit, _knockOut], _unit] call CBA_fnc_targetEvent;
|
||||
true
|
||||
};
|
||||
if (_knockOut isEqualTo (_unit getVariable ["ACE_isUnconscious", false])) exitWith {
|
||||
if (_knockOut isEqualTo IS_UNCONSCIOUS(_unit)) exitWith {
|
||||
WARNING_2("setUnconscious called with no change [Unit %1] [State [%2]", _unit, _knockOut);
|
||||
false
|
||||
};
|
||||
|
@ -61,7 +61,7 @@ if (isNil _callbackProgress) then {
|
||||
// play patient animation
|
||||
private _patientAnim = getText (_config >> "animationPatient");
|
||||
|
||||
if (_target getVariable ["ACE_isUnconscious", false] && EGVAR(medical,allowUnconsciousAnimationOnTreatment)) then {
|
||||
if (IS_UNCONSCIOUS(_target) && EGVAR(medical,allowUnconsciousAnimationOnTreatment)) then {
|
||||
if !(animationState _target in (getArray (_config >> "animationPatientUnconsciousExcludeOn"))) then {
|
||||
_patientAnim = getText (_config >> "animationPatientUnconscious");
|
||||
};
|
||||
@ -70,7 +70,7 @@ if (_target getVariable ["ACE_isUnconscious", false] && EGVAR(medical,allowUncon
|
||||
private _isSelf = _caller isEqualTo _target;
|
||||
|
||||
if (!_isSelf && {vehicle _target == _target} && {_patientAnim != ""}) then {
|
||||
if (_target getVariable ["ACE_isUnconscious", false]) then {
|
||||
if IS_UNCONSCIOUS(_target) then {
|
||||
[_target, _patientAnim, 2, true] call EFUNC(common,doAnimation);
|
||||
} else {
|
||||
[_target, _patientAnim, 1, true] call EFUNC(common,doAnimation);
|
||||
|
@ -48,7 +48,7 @@ _target setVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0], true];
|
||||
|
||||
// generic medical admin
|
||||
_target setVariable [QEGVAR(medical,inCardiacArrest), false, true];
|
||||
_target setVariable ["ACE_isUnconscious", false, true];
|
||||
_target setVariable [VAR_UNCON, false, true];
|
||||
_target setVariable [QEGVAR(medical,hasLostBlood), 0, true];
|
||||
_target setVariable [QEGVAR(medical,isBleeding), false, true];
|
||||
_target setVariable [QEGVAR(medical,hasPain), false, true];
|
||||
|
Loading…
Reference in New Issue
Block a user