Dayz Explorer 1.28.160049
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#ifdef INV_DEBUG_SPAM
12 PrintToRPT("" + s); // comment/uncomment to hide/see debug logs
13#else
14 //Print("" + s); // comment/uncomment to hide/see debug logs
15#endif
16}
17void hndDebugSpamALot (string s)
18{
19#ifdef INV_DEBUG_SPAM_FREQ
20 PrintToRPT("" + s); // comment/uncomment to hide/see debug logs
21#else
22 //Print("" + s); // comment/uncomment to hide/see debug logs
23#endif
24}
25
26
27
29
30
34class HandFSM extends HFSMBase<HandStateBase, HandEventBase, HandActionBase, HandGuardBase>
35{
37 {
39 if(hState)
40 return hState.GetCurrentStateID();
41
42 return HandStateID.UNKNOWN;
43 }
44
49 protected bool SyncStateFromID (int id)
50 {
51 /*if (id == 0)
52 return false;
53
54 int s0 = id & 0x000000ff;
55 int s1 = id & 0x0000ff00;
56
57 int count = m_Transitions.Count();
58 bool set0 = false;
59 bool set1 = false;
60 for (int i = 0; i < count; ++i)
61 {
62 HandTransition t = m_Transitions.Get(i);
63 if (!set0 && t.m_srcState && s0 == t.m_srcState.GetCurrentStateID())
64 {
65 m_States[0] = t.m_srcState;
66 set0 = true;
67 }
68 if (!set1 && t.m_srcState && s1 == t.m_srcState.GetCurrentStateID())
69 {
70 m_States[1] = t.m_srcState;
71 set1 = true;
72 }
73 if (set0 && set1)
74 return true;
75 }*/
76 return false;
77 }
78
82 bool OnStoreLoad (ParamsReadContext ctx, int version)
83 {
84 /*int id = 0;
85 ctx.Read(id);
86 if (SyncStateFromID(id))
87 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] OnStoreLoad - loaded current state from id=" + id);
88 else
89 Print("[hndfsm] Warning! OnStoreLoad - cannot load curent hand state, id=" + id);*/
90 return true;
91 }
92
97 {
98 /*int id = GetCurrentStateID();
99 ctx.Write(id);
100 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] OnStoreSave - saving current state=" + GetCurrentState() + " id=" + id);*/
101 }
102
107 {
108 /*if (SyncStateFromID(id))
109 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] NetSyncCurrentStateID - loaded current state from id=" + id);
110 else
111 Print("[hndfsm] NetSyncCurrentStateID called with null, ignoring request to set current fsm state.");*/
112 }
113};
114
represents transition src -— event[guard]/action -—|> dst
bool OnStoreLoad(ParamsReadContext ctx, int version)
load state of fsm
Definition handfsm.c:82
bool SyncStateFromID(int id)
load from database - reverse lookup for state from saved id
Definition handfsm.c:49
void OnStoreSave(ParamsWriteContext ctx)
save state of fsm
Definition handfsm.c:96
void NetSyncCurrentStateID(int id)
Engine callback - network synchronization of FSM's state. not intended to direct use.
Definition handfsm.c:106
base class for hierarchic finite state machine
Hand finite state machine.
represents stable state (i.e. the basic states that the fsm will spend the most time in)
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!...
HandStateID
states
Definition hand_states.c:4
override int GetCurrentStateID()
Definition hand_states.c:29
void hndDebugSpam(string s)
Definition handfsm.c:9
void hndDebugSpamALot(string s)
Definition handfsm.c:17
void hndDebugPrint(string s)
Definition handfsm.c:1
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
Definition handfsm.c:28
enum EObjectTemperatureState m_State