DayZ Scripts
v1.21.156300 · Jun 20, 2023
 
Loading...
Searching...
No Matches
HandFSM.c
Go to the documentation of this file.
1void hndDebugPrint (string s)
2{
3#ifdef INV_DEBUG
4 PrintToRPT("" + s); // comment/uncomment to hide/see debug logs
5#else
6 //Print("" + s); // comment/uncomment to hide/see debug logs
7#endif
8}
9void hndDebugSpam (string s)
10{
11 //Print("" + s); // comment/uncomment to hide/see debug spam
12}
13void hndDebugSpamALot (string s)
14{
15 //Print("" + s); // comment/uncomment to hide/see debug spam
16}
17
18
19
21
22
26class HandFSM extends HFSMBase<HandStateBase, HandEventBase, HandActionBase, HandGuardBase>
27{
29 {
30 /*if (m_States.Count() == 2)
31 {
32 int s0 = m_States[0].GetCurrentStateID();
33 int s1 = m_States[1].GetCurrentStateID() << 8;
34 return s1 | s0;
35 }*/
36 return 0;
37 }
38
43 protected bool SyncStateFromID (int id)
44 {
45 /*if (id == 0)
46 return false;
47
48 int s0 = id & 0x000000ff;
49 int s1 = id & 0x0000ff00;
50
51 int count = m_Transitions.Count();
52 bool set0 = false;
53 bool set1 = false;
54 for (int i = 0; i < count; ++i)
55 {
56 HandTransition t = m_Transitions.Get(i);
57 if (!set0 && t.m_srcState && s0 == t.m_srcState.GetCurrentStateID())
58 {
59 m_States[0] = t.m_srcState;
60 set0 = true;
61 }
62 if (!set1 && t.m_srcState && s1 == t.m_srcState.GetCurrentStateID())
63 {
64 m_States[1] = t.m_srcState;
65 set1 = true;
66 }
67 if (set0 && set1)
68 return true;
69 }*/
70 return false;
71 }
72
76 bool OnStoreLoad (ParamsReadContext ctx, int version)
77 {
78 /*int id = 0;
79 ctx.Read(id);
80 if (SyncStateFromID(id))
81 hndDebugPrint("[hndfsm] OnStoreLoad - loaded current state from id=" + id);
82 else
83 Print("[hndfsm] Warning! OnStoreLoad - cannot load curent hand state, id=" + id);*/
84 return true;
85 }
86
91 {
92 /*int id = GetCurrentStateID();
93 ctx.Write(id);
94 hndDebugPrint("[hndfsm] OnStoreSave - saving current state=" + GetCurrentState() + " id=" + id);*/
95 }
96
101 {
102 /*if (SyncStateFromID(id))
103 hndDebugPrint("[hndfsm] NetSyncCurrentStateID - loaded current state from id=" + id);
104 else
105 Print("[hndfsm] NetSyncCurrentStateID called with null, ignoring request to set current fsm state.");*/
106 }
107};
108
void hndDebugSpam(string s)
Definition HandFSM.c:9
void hndDebugSpamALot(string s)
Definition HandFSM.c:13
void hndDebugPrint(string s)
Definition HandFSM.c:1
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
Definition HandFSM.c:20
represents transition src -— event[guard]/action -—|> dst
void NetSyncCurrentStateID(int id)
Engine callback - network synchronization of FSM's state. not intended to direct use.
Definition HandFSM.c:100
void OnStoreSave(ParamsWriteContext ctx)
save state of fsm
Definition HandFSM.c:90
bool OnStoreLoad(ParamsReadContext ctx, int version)
load state of fsm
Definition HandFSM.c:76
protected bool SyncStateFromID(int id)
load from database - reverse lookup for state from saved id
Definition HandFSM.c:43
base class for hierarchic finite state machine
Hand finite state machine.
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...