Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
handstatebase.c
Go to the documentation of this file.
1
6
class
HandStateBase
7
{
8
Man
m_Player
;
9
HandStateBase
m_parentState
;
10
ref
HandFSM
m_FSM
;
11
void
HandStateBase
(Man player = NULL,
HandStateBase
parent = NULL) {
m_Player
= player;
m_parentState
= parent; }
12
16
void
SetParentState
(
HandStateBase
parent) {
m_parentState
= parent; }
20
HandStateBase
GetParentState
() {
return
m_parentState
; }
21
22
bool
HasFSM
() {
return
m_FSM
!= NULL; }
23
HandFSM
GetFSM
() {
return
m_FSM
; }
24
25
bool
ProcessEvent
(
HandEventBase
e)
26
{
27
if
(
HasFSM
())
28
return
m_FSM
.ProcessEvent(e);
29
return
false
;
30
}
31
35
void
AddTransition
(
HandTransition
t)
36
{
37
if
(
HasFSM
())
38
m_FSM
.AddTransition(t);
39
else
40
Error
(
"[hndfsm] adding transition to state without FSM. Configure FSM first."
);
41
}
42
43
49
void
OnEntry
(
HandEventBase
e)
50
{
51
if
(
HasFSM
() && !
m_FSM
.IsRunning())
52
{
53
if
(e)
54
{
55
if
(
LogManager
.
IsInventoryHFSMLogEnable
())
hndDebugPrint
(
"[hndfsm] { "
+
Object
.GetDebugName(e.m_Player) +
" STS = "
+ e.m_Player.GetSimulationTimeStamp() +
" "
+
this
.Type().ToString() +
" Has Sub-FSM! Starting submachine... OnEntry"
);
56
}
57
else
58
{
59
if
(
LogManager
.
IsInventoryHFSMLogEnable
())
hndDebugPrint
(
"[hndfsm] { "
+ this.
Type
().
ToString
() +
" Has Sub-FSM! Starting submachine... OnEntry"
);
60
}
61
m_FSM.Start(e);
62
}
63
else
64
{
65
if
(e)
66
{
67
if
(
LogManager
.
IsInventoryHFSMLogEnable
())
hndDebugPrint
(
"[hndfsm] { "
+
Object
.GetDebugName(e.m_Player) +
" STS = "
+ e.m_Player.GetSimulationTimeStamp() +
" "
+
this
.Type().ToString() +
" OnEntry"
);
68
}
69
else
70
{
71
if
(
LogManager
.
IsInventoryHFSMLogEnable
())
hndDebugPrint
(
"[hndfsm] { "
+ this.
Type
().
ToString
() +
" OnEntry"
);
72
}
73
}
74
}
75
81
void
OnUpdate
(
float
dt)
82
{
83
if
(
HasFSM
() &&
m_FSM
.IsRunning())
84
m_FSM
.GetCurrentState().OnUpdate(dt);
85
}
86
91
void
OnAbort
(
HandEventBase
e)
92
{
93
if
(
HasFSM
() &&
m_FSM
.IsRunning())
94
{
95
if
(
LogManager
.
IsInventoryHFSMLogEnable
())
hndDebugPrint
(
"[hndfsm] OnAbort "
+ this.
Type
().
ToString
() +
" Has Sub-FSM! Aborting submachine... OnAbort"
);
96
m_FSM.Abort(e);
97
}
98
//Debug.InventoryHFSMLog("ABORTED " + e.m_Player.GetSimulationTimeStamp(), ""/*typename.EnumToString(HandEventID, GetEventID()) */, "n/a", "OnAbort", m_Player.ToString() );
99
if
(
LogManager
.
IsInventoryHFSMLogEnable
())
hndDebugPrint
(
"[hndfsm] } "
+
Object
.GetDebugName(e.m_Player) +
" STS = "
+ e.m_Player.GetSimulationTimeStamp() +
" ABORTED "
+
this
.Type().ToString() +
" OnAbort"
);
100
}
101
106
void
OnExit
(
HandEventBase
e)
107
{
108
if
(
LogManager
.
IsInventoryHFSMLogEnable
())
hndDebugPrint
(
"[hndfsm] } "
+
Object
.GetDebugName(e.m_Player) +
" STS = "
+ e.m_Player.GetSimulationTimeStamp() +
" "
+
this
.Type().ToString() +
" OnExit"
);
109
}
110
115
bool
IsWaitingForActionFinish
() {
return
HasFSM
() &&
m_FSM
.IsRunning() &&
m_FSM
.GetCurrentState().IsWaitingForActionFinish(); }
116
121
bool
IsIdle
() {
return
false
; }
122
128
void
OnSubMachineChanged
(
HandStateBase
src,
HandStateBase
dst) { }
129
135
void
OnStateChanged
(
HandStateBase
src,
HandStateBase
dst)
136
{
137
m_Player
.GetHumanInventory().OnHandsStateChanged(src, dst);
138
}
139
};
140
141
142
HandEventBase
Abstracted event, not to be used, only inherited.
Definition
hand_events.c:212
HandFSM
Hand finite state machine.
HandStateBase
represent hand state base
Definition
handanimatedforceswapping.c:4
HandStateBase::HasFSM
bool HasFSM()
Definition
handstatebase.c:22
HandStateBase::AddTransition
void AddTransition(HandTransition t)
Definition
handstatebase.c:35
HandStateBase::OnSubMachineChanged
void OnSubMachineChanged(HandStateBase src, HandStateBase dst)
Definition
handstatebase.c:128
HandStateBase::IsIdle
bool IsIdle()
Definition
handstatebase.c:121
HandStateBase::m_FSM
ref HandFSM m_FSM
hierarchical parent state of this state (or null)
Definition
handstatebase.c:10
HandStateBase::OnEntry
void OnEntry(HandEventBase e)
Definition
handstatebase.c:49
HandStateBase::HandStateBase
void HandStateBase(Man player=NULL, HandStateBase parent=NULL)
nested state machine (or null)
Definition
handstatebase.c:11
HandStateBase::SetParentState
void SetParentState(HandStateBase parent)
Definition
handstatebase.c:16
HandStateBase::OnStateChanged
void OnStateChanged(HandStateBase src, HandStateBase dst)
Definition
handstatebase.c:135
HandStateBase::GetFSM
HandFSM GetFSM()
Definition
handstatebase.c:23
HandStateBase::ProcessEvent
bool ProcessEvent(HandEventBase e)
Definition
handstatebase.c:25
HandStateBase::OnExit
void OnExit(HandEventBase e)
Definition
handstatebase.c:106
HandStateBase::IsWaitingForActionFinish
bool IsWaitingForActionFinish()
Definition
handstatebase.c:115
HandStateBase::OnUpdate
void OnUpdate(float dt)
Definition
handstatebase.c:81
HandStateBase::OnAbort
void OnAbort(HandEventBase e)
Definition
handstatebase.c:91
HandStateBase::GetParentState
HandStateBase GetParentState()
Definition
handstatebase.c:20
HandStateBase::m_Player
Man m_Player
Definition
handstatebase.c:8
HandStateBase::m_parentState
HandStateBase m_parentState
entity that this state relates to
Definition
handstatebase.c:9
LogManager
Definition
debug.c:692
LogManager::IsInventoryHFSMLogEnable
static bool IsInventoryHFSMLogEnable()
Definition
debug.c:766
Object
Definition
objecttyped.c:2
ToString
proto string ToString()
Error
void Error(string err)
Messagebox with error message.
Definition
endebug.c:90
hndDebugPrint
void hndDebugPrint(string s)
Definition
handfsm.c:1
HandTransition
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
Definition
handfsm.c:28
Type
string Type
Definition
jsondatacontaminatedarea.c:11
Games
Dayz
scripts
3_game
systems
inventory
handstatebase.c
Generated by
1.17.0