mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Reset default state on respawn (#6518)
* Reset default state on respawn * Remove old getUnitState function * Add locality check
This commit is contained in:
parent
14d52ee77e
commit
7fcd12c792
@ -1,4 +1,3 @@
|
||||
PREP(addDamageToUnit);
|
||||
PREP(dev_watchMedicalStats);
|
||||
PREP(getUnitState);
|
||||
PREP(setUnconscious);
|
||||
|
@ -1,22 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
if (!local _unit) exitWith { ERROR("unit is not local"); };
|
||||
|
||||
[_unit, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState
|
@ -15,3 +15,11 @@ class Extended_PostInit_EventHandlers {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Respawn_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
respawn = QUOTE(call FUNC(resetStateDefault));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Manual transitions applied to this statemachine
|
||||
// - medical_fnc_handleRespawn:18
|
||||
// - fnc_resetStateDefault on unit respawn
|
||||
class ACE_Medical_StateMachine {
|
||||
list = "allUnits select {local _x}";
|
||||
skipNull = 1;
|
||||
|
@ -7,4 +7,5 @@ PREP(handleStateDefault);
|
||||
PREP(handleStateInjured);
|
||||
PREP(handleStateUnconscious);
|
||||
PREP(leftStateCardiacArrest);
|
||||
PREP(resetStateDefault);
|
||||
PREP(transitionSecondChance);
|
||||
|
@ -0,0 +1,20 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: SilentSpike
|
||||
* Resets the default state on a unit after respawning.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
// Statemachine only handles local units
|
||||
if !(local _unit) exitWith {};
|
||||
|
||||
[_unit, EGVAR(medical,STATE_MACHINE), "Dead", "Default"] call CBA_statemachine_fnc_manualTransition;
|
Loading…
Reference in New Issue
Block a user