DayZ 1.24
Loading...
Searching...
No Matches
HumanCommandActionCallback Class Reference
Inheritance diagram for HumanCommandActionCallback:
[legend]
Collaboration diagram for HumanCommandActionCallback:
[legend]

Protected Member Functions

void PluginDayzPlayerActionCallback ()
 
void ~PluginDayzPlayerActionCallback ()
 
override void OnFinish (bool pCanceled)
 
bool CancelCondition ()
 
override void OnAnimationEvent (int pEventID)
 
override void OnStateChange (int pOldState, int pCurrentState)
 

Protected Attributes

float m_fTimeStart
 
TextWidget m_pStateWidget
 
TextWidget m_pAnimEventWidget
 
TextListboxWidget m_EventsHistory
 

Static Protected Attributes

static ref set< stringm_AnimEventMapping
 

Private Member Functions

override void OnFinish (bool pCanceled)
 
void Init (float run_time, PlayerBase player)
 
bool CancelCondition ()
 
override bool IsSymptomCallback ()
 

Private Attributes

float m_RunTime
 
float m_StartingTime
 
PlayerBase m_Player
 

Detailed Description

Definition at line 1 of file StateCB.c.

Constructor & Destructor Documentation

◆ ~PluginDayzPlayerActionCallback()

void HumanCommandActionCallback::~PluginDayzPlayerActionCallback ( )
inlineprotected

Definition at line 119 of file PluginDayzPlayerDebug.c.

120 {
121 //Print("Action callback deleted");
122 }

Member Function Documentation

◆ CancelCondition() [1/2]

bool HumanCommandActionCallback::CancelCondition ( )
inlineprivate

Definition at line 26 of file StateCB.c.

27 {
29 return true;
30 else
31 return false;
32 }
float GetTime()
proto native CGame GetGame()

References GetGame(), GetTime(), and m_RunTime.

◆ CancelCondition() [2/2]

bool HumanCommandActionCallback::CancelCondition ( )
inlineprotected

Definition at line 133 of file PluginDayzPlayerDebug.c.

134 {
135 // Print("Action cancel condition");
136 return DefaultCancelCondition();
137 }
proto native bool DefaultCancelCondition()
system implemented cancel condition (now raise or sprint cancels action)

References DefaultCancelCondition().

◆ Init()

void HumanCommandActionCallback::Init ( float run_time,
PlayerBase player )
inlineprivate

Definition at line 15 of file StateCB.c.

16 {
18 m_RunTime = run_time * 1000;
19 m_StartingTime = GetGame().GetTime();
21
22 if (m_Player && m_Player.GetSymptomManager())
23 m_Player.GetSymptomManager().OnAnimationStarted();
24 }
proto native void EnableCancelCondition(bool pEnable)

References EnableCancelCondition(), GetGame(), m_Player, and m_RunTime.

◆ IsSymptomCallback()

override bool HumanCommandActionCallback::IsSymptomCallback ( )
inlineprivate

Definition at line 34 of file StateCB.c.

35 {
36 return true;
37 }

◆ OnAnimationEvent()

override void HumanCommandActionCallback::OnAnimationEvent ( int pEventID)
inlineprotected

Definition at line 139 of file PluginDayzPlayerDebug.c.

140 {
141
142 //Print(pEventID);
143 //Print("--------------------------------");
144 // only one event id is registered - 1 so nothing else can be delivered
146 string eventText = eventName + " event at: ";
148
149 eventText += tFromSt.ToString();
150 m_EventsHistory.AddItem(eventText, null, 0);
152 }
static ref set< string > m_AnimEventMapping
proto native float GetWorldTime()

References GetWorldTime(), m_EventsHistory, and m_fTimeStart.

◆ OnFinish() [1/2]

override void HumanCommandActionCallback::OnFinish ( bool pCanceled)
inlineprivate

Definition at line 8 of file StateCB.c.

9 {
10 if (m_Player && m_Player.GetSymptomManager())
11 m_Player.GetSymptomManager().OnAnimationFinished();
12 }

References m_Player.

◆ OnFinish() [2/2]

override void HumanCommandActionCallback::OnFinish ( bool pCanceled)
inlineprotected

Definition at line 124 of file PluginDayzPlayerDebug.c.

125 {
126 if (pCanceled)
127 m_pStateWidget.SetText("Result: canceled");
128 else
129 m_pStateWidget.SetText("Result: ended");
130 }

◆ OnStateChange()

override void HumanCommandActionCallback::OnStateChange ( int pOldState,
int pCurrentState )
inlineprotected

Definition at line 154 of file PluginDayzPlayerDebug.c.

155 {
158
159 m_pStateWidget.SetText(oldState + "->" + newState);
160 };
string GetStateString()
returns debug string of current state
Definition human.c:391

References GetStateString().

◆ PluginDayzPlayerActionCallback()

void HumanCommandActionCallback::PluginDayzPlayerActionCallback ( )
inlineprotected

Definition at line 93 of file PluginDayzPlayerDebug.c.

94 {
95
96 //Print("Action callback created");
98 //RegisterAnimationEvent("ActionExec", 1); // really weird id
99
100 if (!m_AnimEventMapping)//making sure to only do once
101 {
103 m_AnimEventMapping.Insert("ActionExec");
104 m_AnimEventMapping.Insert("SoundWeapon");
105 m_AnimEventMapping.Insert("SoundVoice");
106 m_AnimEventMapping.Insert("SoundAttachment");
107 m_AnimEventMapping.Insert("Sound");
108 }
109
110
111 foreach (int index, string eventName: m_AnimEventMapping)
113
114 EnableStateChangeCallback(); // enable this to get OnStateChange callbacks
115
117 }
class DayZCreatureAnimInterface RegisterAnimationEvent(string event_name, string function_name)
proto native void EnableStateChangeCallback()
enables state change callback OnStateChange

Member Data Documentation

◆ m_AnimEventMapping

ref set<string> HumanCommandActionCallback::m_AnimEventMapping
staticprotected

Definition at line 92 of file PluginDayzPlayerDebug.c.

◆ m_EventsHistory

TextListboxWidget HumanCommandActionCallback::m_EventsHistory
protected

Definition at line 167 of file PluginDayzPlayerDebug.c.

◆ m_fTimeStart

float HumanCommandActionCallback::m_fTimeStart
protected

Definition at line 164 of file PluginDayzPlayerDebug.c.

Referenced by OnAnimationEvent().

◆ m_pAnimEventWidget

TextWidget HumanCommandActionCallback::m_pAnimEventWidget
protected

Definition at line 166 of file PluginDayzPlayerDebug.c.

◆ m_Player

PlayerBase HumanCommandActionCallback::m_Player
private

Definition at line 6 of file StateCB.c.

◆ m_pStateWidget

TextWidget HumanCommandActionCallback::m_pStateWidget
protected

Definition at line 165 of file PluginDayzPlayerDebug.c.

◆ m_RunTime

float HumanCommandActionCallback::m_RunTime
private

Definition at line 4 of file StateCB.c.

◆ m_StartingTime

float HumanCommandActionCallback::m_StartingTime
private

Definition at line 5 of file StateCB.c.


The documentation for this class was generated from the following files: