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

Protected Member Functions

void ActionManagerServer (PlayerBase player)
 
override void OnJumpStart ()
 
override bool OnInputUserDataProcess (int userDataType, ParamsReadContext ctx)
 
override void StartDeliveredAction ()
 
override void OnActionEnd ()
 
override void Update (int pCurrentCommandID)
 
override void Interrupt ()
 
override ActionReciveData GetReciveData ()
 

Protected Attributes

ActionBase m_PendingAction
 
ref ActionReciveData m_PendingActionReciveData
 

Detailed Description

Definition at line 1 of file ActionManagerServer.c.

Constructor & Destructor Documentation

◆ ActionManagerServer()

void ActionManagerServer::ActionManagerServer ( PlayerBase player)
inlineprotected

Definition at line 6 of file ActionManagerServer.c.

7 {
10 }
ref ActionReciveData m_PendingActionReciveData

References m_PendingAction, and m_PendingActionReciveData.

Member Function Documentation

◆ GetReciveData()

override ActionReciveData ActionManagerServer::GetReciveData ( )
inlineprotected

Definition at line 297 of file ActionManagerServer.c.

298 {
300 }

References m_PendingActionReciveData.

◆ Interrupt()

override void ActionManagerServer::Interrupt ( )
inlineprotected

Definition at line 289 of file ActionManagerServer.c.

290 {
291 super.Interrupt();
292
295 }
ref ActionData m_CurrentActionData
DayZPlayer m_Player
Definition Hand_Events.c:42
static void SendActionInterrupt(DayZPlayer pPlayer)

References m_CurrentActionData, m_Player, and DayZPlayerSyncJunctures::SendActionInterrupt().

Referenced by OnInputUserDataProcess(), StartDeliveredAction(), and Update().

◆ OnActionEnd()

override void ActionManagerServer::OnActionEnd ( )
inlineprotected

Definition at line 166 of file ActionManagerServer.c.

167 {
168 //Debug.Log("Action ended - hard, STS = " + m_Player.GetSimulationTimeStamp());
170 {
171 if (m_CurrentActionData.m_Target)
172 {
174 if (targetEntity.CastTo(targetEntity, m_CurrentActionData.m_Target.GetObject()) && !Building.Cast(targetEntity))
175 GetGame().ClearJuncture(m_CurrentActionData.m_Player, targetEntity);
176 }
177
178 super.OnActionEnd();
179 }
180 }
proto native CGame GetGame()

References GetGame(), and m_CurrentActionData.

Referenced by OnJumpStart(), and Update().

◆ OnInputUserDataProcess()

override bool ActionManagerServer::OnInputUserDataProcess ( int userDataType,
ParamsReadContext ctx )
inlineprotected

Definition at line 29 of file ActionManagerServer.c.

30 {
31 switch (userDataType)
32 {
34 {
35 bool success = true;
36
37 int actionID = 0;
38 if (!ctx.Read(actionID))
39 return false;
40
41 ActionBase recvAction = GetAction(actionID);
42 if (!recvAction)
43 return false;
44
45 if (!recvAction.ReadFromContext(ctx, m_PendingActionReciveData))
46 success = false;
47
49
50 if (recvAction.UseAcknowledgment())
51 {
52 int ackID;
53 if (!ctx.Read(ackID))
54 success = false;
55
57 }
58
59 break;
60
61 }
62
64 {
65 //Debug.Log("Action want end request, STS = " + m_Player.GetSimulationTimeStamp());
66 int commandID = -10;
67 ctx.Read(commandID);
68
69 if (commandID == DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT)
70 {
71 //Print("INPUT_UDT_STANDARD_ACTION_END_REQUEST | CMD_ACTIONINT_INTERRUPT");
72 Interrupt();
73 }
74 else
75 {
76 //Print("INPUT_UDT_STANDARD_ACTION_END_REQUEST | m_ActionWantEndRequest");
78 }
79 }
80
82 {
83 //Debug.Log("Action input ended, STS = " + m_Player.GetSimulationTimeStamp());
85 }
86 default:
87 return false;
88 }
89
90 if (!success)
91 {
92 //Debug.Log("[AM] OnInputUserDataProcess INPUT_UDT_STANDARD_ACTION_START Error");
93 if (recvAction.UseAcknowledgment())
95 else
96 Interrupt();
97
98 return false;
99 }
100 return true;
101
102 }
const int INPUT_UDT_STANDARD_ACTION_END_REQUEST
Definition _constants.c:3
const int INPUT_UDT_STANDARD_ACTION_START
Definition _constants.c:2
const int INPUT_UDT_STANDARD_ACTION_INPUT_END
Definition _constants.c:4
override ActionBase GetAction()
bool m_ActionInputWantEnd
int m_PendingActionAcknowledgmentID
bool m_ActionWantEndRequest
static void SendActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References GetAction(), INPUT_UDT_STANDARD_ACTION_END_REQUEST, INPUT_UDT_STANDARD_ACTION_INPUT_END, INPUT_UDT_STANDARD_ACTION_START, Interrupt(), m_ActionInputWantEnd, m_ActionWantEndRequest, m_PendingAction, m_PendingActionAcknowledgmentID, m_PendingActionReciveData, m_Player, and DayZPlayerSyncJunctures::SendActionAcknowledgment().

◆ OnJumpStart()

override void ActionManagerServer::OnJumpStart ( )
inlineprotected

Definition at line 15 of file ActionManagerServer.c.

16 {
18 {
20 {
23 }
24 else
25 m_CurrentActionData.m_Action.Interrupt(m_CurrentActionData);
26 }
27 }
override void OnActionEnd()
const int UA_AM_ACCEPTED
Definition constants.c:447
const int UA_AM_REJECTED
Definition constants.c:448
const int UA_AM_PENDING
Definition constants.c:446

References m_CurrentActionData, m_PendingActionAcknowledgmentID, OnActionEnd(), UA_AM_ACCEPTED, UA_AM_PENDING, and UA_AM_REJECTED.

◆ StartDeliveredAction()

override void ActionManagerServer::StartDeliveredAction ( )
inlineprotected

error - expected action data

Definition at line 104 of file ActionManagerServer.c.

105 {
107 {
109 return;
110 }
111
112 m_Interrupted = false;
113
114 bool accepted = false;
115 ActionBase pickedAction = m_CurrentActionData.m_Action;
116 ActionTarget target = m_CurrentActionData.m_Target;
117 ItemBase item = m_CurrentActionData.m_MainItem;
118
120 Debug.ActionLog("Item = " + item + ", " + target.DumpToString(), pickedAction.ToString(), "n/a", "DeliveredAction", m_Player.ToString());
121
122 if (!m_Player.GetCommandModifier_Action() && !m_Player.GetCommand_Action() && !m_Player.IsSprinting() && pickedAction && pickedAction.Can(m_Player, target, item))
123 {
124 accepted = true;
125 if (pickedAction.HasTarget())
126 {
128 if (EntityAI.CastTo(targetEntity, target.GetObject()))
129 {
130 if (!AdvancedCommunication.Cast(targetEntity) && !Building.Cast(targetEntity) && pickedAction.IsLockTargetOnUse())
131 {
132 //Lock target
133 if (!GetGame().AddActionJuncture(m_Player, targetEntity, 10000))
134 accepted = false;
135 }
136 }
137 }
138 }
139
140 if (accepted)
141 {
143 Debug.ActionLog("Action accepted", pickedAction.ToString(), "n/a", "CheckDeliveredAction", m_Player.ToString());
144 //Debug.Log("[AM] Action acccepted");
145 if (pickedAction.UseAcknowledgment())
146 {
147 //Unlock target
150 }
151 else
153 }
154 else
155 {
157 Debug.ActionLog("Action rejected", pickedAction.ToString(), "n/a", "CheckDeliveredAction", m_Player.ToString());
158
159 if (pickedAction.UseAcknowledgment())
161 else
162 Interrupt();
163 }
164 }
bool m_Interrupted
Definition Debug.c:14
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:143
static bool IsActionLogEnable()
Definition Debug.c:719

References Debug::ActionLog(), GetGame(), Interrupt(), LogManager::IsActionLogEnable(), m_CurrentActionData, m_Interrupted, m_PendingActionAcknowledgmentID, m_Player, DayZPlayerSyncJunctures::SendActionAcknowledgment(), UA_AM_ACCEPTED, and UA_AM_PENDING.

Referenced by Update().

◆ Update()

override void ActionManagerServer::Update ( int pCurrentCommandID)
inlineprotected

Definition at line 183 of file ActionManagerServer.c.

184 {
185 super.Update(pCurrentCommandID);
186 int currentCommandID = m_Player.GetCurrentCommandID();
187
188 //Debug.Log("m_ActionWantEnd " + m_ActionInputWantEnd);
189
190 if (m_PendingAction)
191 {
194 else
195 {
197 m_ActionInputWantEnd = false;
198
199 bool success = true;
200 ActionTarget target = new ActionTarget(null, null, -1, vector.Zero, 0);
201
203 Debug.ActionLog("n/a", m_PendingAction.ToString(), "n/a", "HandlePendingAction", m_Player.ToString());
204
205 if (!m_PendingAction.SetupAction(m_Player, target, m_Player.GetItemInHands(), m_CurrentActionData))
206 success = false;
207 //Debug.Log("[AM] Action data synced (" + m_Player + ") success: " + success);
208
209 if (success)
211 else
212 {
213 if (m_PendingAction.UseAcknowledgment())
215 else
216 Interrupt();
217 }
218 }
219
222 }
223
225 {
227 {
228 m_CurrentActionData.m_Action.OnUpdateServer(m_CurrentActionData);
229
230 if (m_CurrentActionData.m_RefreshJunctureTimer > 0)
231 m_CurrentActionData.m_RefreshJunctureTimer--;
232 else
233 {
234 m_CurrentActionData.m_RefreshJunctureTimer = m_CurrentActionData.m_Action.GetRefreshReservationTimerValue();
235 if (m_CurrentActionData.m_Target)
236 {
238 if (targetEntity.CastTo(targetEntity, m_CurrentActionData.m_Target.GetObject()) && !Building.Cast(targetEntity))
239 GetGame().ExtendActionJuncture(m_CurrentActionData.m_Player, targetEntity, 10000);
240 }
241 }
242 }
243
244 //Debug.Log("m_CurrentActionData.m_State: " + m_CurrentActionData.m_State +" m_ActionWantEnd: " + m_ActionWantEndRequest );
245 switch (m_CurrentActionData.m_State)
246 {
247 case UA_AM_PENDING:
248 break;
249
250 case UA_AM_ACCEPTED:
251 // check currentCommandID before start or reject
252
255 {
258
259 if (m_CurrentActionData.m_Action && m_CurrentActionData.m_Action.IsInstant())
260 OnActionEnd();
261 }
262 else
263 Interrupt();
265 break;
266
267 case UA_AM_REJECTED:
268 OnActionEnd();
270 break;
271
272 default:
274 {
275 m_ActionInputWantEnd = false;
276 m_CurrentActionData.m_Action.EndInput(m_CurrentActionData);
277 }
278
280 {
282 m_CurrentActionData.m_Action.EndRequest(m_CurrentActionData);
283 }
284 break;
285 }
286 }
287 }
bool ActionPossibilityCheck(int pCurrentCommandID)
class ActionTargets ActionTarget
override void StartDeliveredAction()
static const vector Zero
Definition EnConvert.c:110
const int UA_START
Definition constants.c:439

References Debug::ActionLog(), ActionPossibilityCheck(), ActionTarget, GetGame(), Interrupt(), LogManager::IsActionLogEnable(), m_ActionInputWantEnd, m_ActionWantEndRequest, m_CurrentActionData, m_PendingAction, m_PendingActionAcknowledgmentID, m_PendingActionReciveData, m_Player, OnActionEnd(), DayZPlayerSyncJunctures::SendActionAcknowledgment(), StartDeliveredAction(), UA_AM_ACCEPTED, UA_AM_PENDING, UA_AM_REJECTED, UA_START, and vector::Zero.

Member Data Documentation

◆ m_PendingAction

ActionBase ActionManagerServer::m_PendingAction
protected

Definition at line 3 of file ActionManagerServer.c.

Referenced by ActionManagerServer(), OnInputUserDataProcess(), and Update().

◆ m_PendingActionReciveData

ref ActionReciveData ActionManagerServer::m_PendingActionReciveData
protected

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