mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
[Medical Rewrite] Adding respawn compatibility (#5020)
* Added respawn transition * Removed respawn transition from statemachine and added manual transition comment * Changed transiton to manual. Added easy way to get current status as well * Updated event reference * Fixed manualTransition call * Minor headers changes
This commit is contained in:
parent
b5f6169341
commit
bdea0fcdba
@ -1,3 +1,5 @@
|
|||||||
|
// Manual transitions applied to this statemachine
|
||||||
|
// - medical_fnc_handleRespawn:18
|
||||||
class ACE_Medical_StateMachine {
|
class ACE_Medical_StateMachine {
|
||||||
list = "allUnits select {local _x}";
|
list = "allUnits select {local _x}";
|
||||||
skipNull = 1;
|
skipNull = 1;
|
||||||
|
@ -23,3 +23,11 @@ class Extended_Init_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Extended_Respawn_EventHandlers {
|
||||||
|
class CAManBase {
|
||||||
|
class ADDON {
|
||||||
|
respawn = QUOTE(call FUNC(handleRespawn));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -15,9 +15,11 @@ PREP(getBloodPressure);
|
|||||||
PREP(getBloodVolumeChange);
|
PREP(getBloodVolumeChange);
|
||||||
PREP(getCardiacOutput);
|
PREP(getCardiacOutput);
|
||||||
PREP(getPainLevel);
|
PREP(getPainLevel);
|
||||||
|
PREP(getUnitState);
|
||||||
PREP(handleIncapacitation);
|
PREP(handleIncapacitation);
|
||||||
PREP(handleKilled);
|
PREP(handleKilled);
|
||||||
PREP(handleLocal);
|
PREP(handleLocal);
|
||||||
|
PREP(handleRespawn);
|
||||||
PREP(handleStateDefault);
|
PREP(handleStateDefault);
|
||||||
PREP(handleStateInjured);
|
PREP(handleStateInjured);
|
||||||
PREP(handleStateUnconscious);
|
PREP(handleStateUnconscious);
|
||||||
|
22
addons/medical/functions/fnc_getUnitState.sqf
Normal file
22
addons/medical/functions/fnc_getUnitState.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Author: Zakant
|
||||||
|
* Gets the name of the current medical state of an unit. Unit has to be local to the caller.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Name of the current medical state of the unit <STRING>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player] call ace_medical_fnc_getUnitState
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
if (!local _unit) exitWith { ERROR("unit is not local"); };
|
||||||
|
|
||||||
|
[_unit, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState
|
24
addons/medical/functions/fnc_handleRespawn.sqf
Normal file
24
addons/medical/functions/fnc_handleRespawn.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Author: Zakant
|
||||||
|
* Handles respawn of a unit.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player] call ace_medical_fnc_handleRespawn
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
TRACE_2("handleRespawn",_unit,local _unit);
|
||||||
|
|
||||||
|
if (!local _unit) exitWith {};
|
||||||
|
|
||||||
|
_unit call FUNC(init); // Call init to reset the medical states for the unit.
|
||||||
|
[_unit, GVAR(STATE_MACHINE), _unit call FUNC(getUnitState), "Default"] call CBA_statemachine_fnc_manualTransition; // Move the unit to the default medical state
|
Loading…
Reference in New Issue
Block a user