mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical - Transfer state machine state on locality (#6950)
* Medical - Transfer state machine state on locality * Fix feedback isUnconscious var * Exclude AI
This commit is contained in:
parent
a23b22aef6
commit
cdd1de04f0
@ -56,8 +56,7 @@ GVAR(heartBeatEffectRunning) = false;
|
|||||||
// Update effects to match new unit's current status (this also handles respawn)
|
// Update effects to match new unit's current status (this also handles respawn)
|
||||||
["unit", {
|
["unit", {
|
||||||
params ["_new"];
|
params ["_new"];
|
||||||
|
private _status = IS_UNCONSCIOUS(_new);
|
||||||
private _status = _new getVariable ["ace_unconscious", false];
|
|
||||||
|
|
||||||
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {
|
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {
|
||||||
_new setVariable ["tf_voiceVolume", [1, 0] select _status, true];
|
_new setVariable ["tf_voiceVolume", [1, 0] select _status, true];
|
||||||
|
@ -23,3 +23,12 @@ class Extended_Respawn_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Extended_Local_EventHandlers {
|
||||||
|
class CAManBase {
|
||||||
|
class ADDON {
|
||||||
|
local = QUOTE(call FUNC(localityChangedEH));
|
||||||
|
exclude[] = {"B_UAV_AI","O_UAV_AI","UAV_AI_base_F"};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -7,5 +7,7 @@ PREP(handleStateDefault);
|
|||||||
PREP(handleStateInjured);
|
PREP(handleStateInjured);
|
||||||
PREP(handleStateUnconscious);
|
PREP(handleStateUnconscious);
|
||||||
PREP(leftStateCardiacArrest);
|
PREP(leftStateCardiacArrest);
|
||||||
|
PREP(localityChangedEH);
|
||||||
|
PREP(localityTransfer);
|
||||||
PREP(resetStateDefault);
|
PREP(resetStateDefault);
|
||||||
PREP(transitionSecondChance);
|
PREP(transitionSecondChance);
|
||||||
|
@ -1 +1,3 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
[QGVAR(localityTransfer), LINKFUNC(localityTransfer)] call CBA_fnc_addEventHandler;
|
||||||
|
@ -19,13 +19,7 @@ params ["_unit"];
|
|||||||
|
|
||||||
// If the unit died the loop is finished
|
// If the unit died the loop is finished
|
||||||
if (!alive _unit) exitWith {};
|
if (!alive _unit) exitWith {};
|
||||||
|
if (!local _unit) exitWith {};
|
||||||
// If locality changed, broadcast the last medical state and finish the local loop
|
|
||||||
if (!local _unit) exitWith {
|
|
||||||
_unit setVariable [VAR_HEART_RATE, GET_HEART_RATE(_unit), true];
|
|
||||||
_unit setVariable [VAR_BLOOD_PRESS, _unit getVariable [VAR_BLOOD_PRESS, [80, 120]], true];
|
|
||||||
_unit setVariable [VAR_BLOOD_VOL, GET_BLOOD_VOLUME(_unit), true];
|
|
||||||
};
|
|
||||||
|
|
||||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||||
|
|
||||||
|
@ -19,13 +19,7 @@ params ["_unit"];
|
|||||||
|
|
||||||
// If the unit died the loop is finished
|
// If the unit died the loop is finished
|
||||||
if (!alive _unit) exitWith {};
|
if (!alive _unit) exitWith {};
|
||||||
|
if (!local _unit) exitWith {};
|
||||||
// If locality changed, broadcast the last medical state and finish the local loop
|
|
||||||
if (!local _unit) exitWith {
|
|
||||||
_unit setVariable [VAR_HEART_RATE, GET_HEART_RATE(_unit), true];
|
|
||||||
_unit setVariable [VAR_BLOOD_PRESS, _unit getVariable [VAR_BLOOD_PRESS, [80, 120]], true];
|
|
||||||
_unit setVariable [VAR_BLOOD_VOL, GET_BLOOD_VOLUME(_unit), true];
|
|
||||||
};
|
|
||||||
|
|
||||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||||
|
|
||||||
|
@ -19,13 +19,7 @@ params ["_unit"];
|
|||||||
|
|
||||||
// If the unit died the loop is finished
|
// If the unit died the loop is finished
|
||||||
if (!alive _unit) exitWith {};
|
if (!alive _unit) exitWith {};
|
||||||
|
if (!local _unit) exitWith {};
|
||||||
// If locality changed, broadcast the last medical state and finish the local loop
|
|
||||||
if (!local _unit) exitWith {
|
|
||||||
_unit setVariable [VAR_HEART_RATE, GET_HEART_RATE(_unit), true];
|
|
||||||
_unit setVariable [VAR_BLOOD_PRESS, _unit getVariable [VAR_BLOOD_PRESS, [80, 120]], true];
|
|
||||||
_unit setVariable [VAR_BLOOD_VOL, GET_BLOOD_VOLUME(_unit), true];
|
|
||||||
};
|
|
||||||
|
|
||||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||||
|
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: PabstMirror
|
||||||
|
* Handles locality switch.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: isLocal <BOOL>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player, true] call ace_medical_statemachine_fnc_localityChangedEH
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_unit", "_isLocal"];
|
||||||
|
TRACE_2("localityChangedEH",_unit,_isLocal);
|
||||||
|
|
||||||
|
if (!alive _unit) exitWith {TRACE_1("dead", _this)};
|
||||||
|
|
||||||
|
if (!_isLocal) then {
|
||||||
|
// If locality changed, broadcast the last medical state
|
||||||
|
_unit setVariable [VAR_HEART_RATE, GET_HEART_RATE(_unit), true];
|
||||||
|
_unit setVariable [VAR_BLOOD_PRESS, _unit getVariable [VAR_BLOOD_PRESS, [80, 120]], true];
|
||||||
|
_unit setVariable [VAR_BLOOD_VOL, GET_BLOOD_VOLUME(_unit), true];
|
||||||
|
|
||||||
|
private _currentState = [_unit, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState;
|
||||||
|
TRACE_2("sending current state",_unit,_currentState);
|
||||||
|
[QGVAR(localityTransfer), [_unit, _currentState], _unit] call CBA_fnc_targetEvent;
|
||||||
|
};
|
@ -0,0 +1,26 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: PabstMirror
|
||||||
|
* Handles locality switch.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: State <STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player, "Injured"] call ace_medical_statemachine_fnc_localityTransfer
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_unit", "_currentState"];
|
||||||
|
TRACE_2("localityTransfer",_unit,_currentState);
|
||||||
|
|
||||||
|
private _oldState = [_unit, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState;
|
||||||
|
if (_oldState != _currentState) then {
|
||||||
|
TRACE_2("changing state",_oldState,_currentState);
|
||||||
|
[_unit, EGVAR(medical,STATE_MACHINE), _oldState, _currentState, {}, "LocalityChange"] call CBA_statemachine_fnc_manualTransition;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user