-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Medical - Transfer state machine state on locality (#6950)
* Medical - Transfer state machine state on locality * Fix feedback isUnconscious var * Exclude AI
- Loading branch information
1 parent
a23b22a
commit cdd1de0
Showing
9 changed files
with
76 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
#include "script_component.hpp" | ||
|
||
[QGVAR(localityTransfer), LINKFUNC(localityTransfer)] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
addons/medical_statemachine/functions/fnc_localityChangedEH.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |
26 changes: 26 additions & 0 deletions
26
addons/medical_statemachine/functions/fnc_localityTransfer.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |