-
Notifications
You must be signed in to change notification settings - Fork 148
/
fnc_manualTransition.sqf
49 lines (43 loc) · 1.75 KB
/
fnc_manualTransition.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Function: CBA_statemachine_fnc_manualTransition
Description:
Manually triggers a transition.
Parameters:
_listItem - the item which should transition <any namespace type>
_stateMachine - a state machine <LOCATION>
_thisOrigin - state the transition origins from <STRING>
_thisTarget - state the transition goes to <STRING>
_onTransition - code that gets executed once transition happens <CODE>
(Default: {})
_thisTransition - name for this specific transition <STRING>
(Default: "MANUAL")
Returns:
Nothing
Examples:
(begin example)
[_stateMachine, "initial", "end", {
systemChat format [
"%1 transitioned from %2 to %3 manually.",
_this, _thisOrigin, _thisTarget
];
}, "dummyTransition"] call CBA_statemachine_fnc_manualTransition;
(end)
Author:
BaerMitUmlaut
---------------------------------------------------------------------------- */
SCRIPT(manualTransition);
params [
["_listItem", objNull, [missionNamespace, objNull, grpNull, teamMemberNull, taskNull, locationNull]],
["_stateMachine", locationNull, [locationNull]],
["_thisOrigin", "", [""]],
["_thisTarget", "", [""]],
["_onTransition", {}, [{}]],
["_thisTransition", "MANUAL", [""]]
];
private _thisState = _thisOrigin;
private _id = _stateMachine getVariable QGVAR(ID);
_listItem call (_stateMachine getVariable ONSTATELEAVING(_thisOrigin));
_listItem call _onTransition;
_listItem setVariable [QGVAR(state) + str _id, _thisTarget];
_listItem call (_stateMachine getVariable ONSTATEENTERED(_thisTarget));