DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionManagerServer.c
См. документацию.
2{
4 ref ActionReciveData m_PendingActionReciveData;
5
11
12 //------------------------------------------
13 //EVENTS
14 //------------------------------------------
15 override void OnJumpStart()
16 {
18 }
19
21 {
23 {
25 {
28 }
29 else
30 {
31 m_CurrentActionData.m_Action.Interrupt(m_CurrentActionData);
32 }
33 }
34 }
35
36 override bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
37 {
38 switch (userDataType)
39 {
41 {
42 bool success = true;
43
44 int actionID = 0;
45 if (!ctx.Read(actionID))
46 return false;
47
48 ActionBase recvAction = GetAction(actionID);
49 if (!recvAction)
50 return false;
51
52 if (!recvAction.ReadFromContext(ctx, m_PendingActionReciveData))
53 success = false;
54
55 m_PendingAction = recvAction;
56
57 if (recvAction.UseAcknowledgment())
58 {
59 int ackID;
60 if (!ctx.Read(ackID))
61 success = false;
62
64 }
65
66 break;
67
68 }
69
71 {
72 //Debug.Log("Action want end request, STS = " + m_Player.GetSimulationTimeStamp());
73 int commandID = -10;
74 ctx.Read(commandID);
75
76 if (commandID == DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT)
77 {
78 //Print("INPUT_UDT_STANDARD_ACTION_END_REQUEST | CMD_ACTIONINT_INTERRUPT");
80 }
81 else
82 {
83 //Print("INPUT_UDT_STANDARD_ACTION_END_REQUEST | m_ActionWantEndRequest");
85 }
86 }
87
89 {
90 //Debug.Log("Action input ended, STS = " + m_Player.GetSimulationTimeStamp());
92 }
93 default:
94 return false;
95 }
96
97 if (!success)
98 {
99 //Debug.Log("[AM] OnInputUserDataProcess INPUT_UDT_STANDARD_ACTION_START Error");
100 if (recvAction.UseAcknowledgment())
101 {
103 }
104 else
105 {
107 }
108
109 return false;
110 }
111 return true;
112
113 }
114
115 override void StartDeliveredAction()
116 {
118 {
120 return;
121 }
122
123 m_Interrupted = false;
124
125 bool accepted = false;
126 ActionBase pickedAction = m_CurrentActionData.m_Action;
127 ActionTarget target = m_CurrentActionData.m_Target;
128 ItemBase item = m_CurrentActionData.m_MainItem;
129
131 {
132 if (target)
133 {
134 Debug.ActionLog("Item = " + item + ", " + target.DumpToString(), pickedAction.ToString() , "n/a", "DeliveredAction", m_Player.ToString());
135 }
136 else
137 {
138 Debug.ActionLog("Item = " + item + ", NULL", pickedAction.ToString() , "n/a", "DeliveredAction", m_Player.ToString());
139 }
140 }
141
142 if (!m_Player.GetCommandModifier_Action() && !m_Player.GetCommand_Action() && !m_Player.IsSprinting() && pickedAction && pickedAction.Can(m_Player,target,item))
143 {
144 if (pickedAction.AddActionJuncture(m_CurrentActionData))
145 accepted = true;
146 }
147
148 if (accepted)
149 {
151 {
152 Debug.ActionLog("Action accepted", pickedAction.ToString() , "n/a", "CheckDeliveredAction", m_Player.ToString() );
153 }
154 //Debug.Log("[AM] Action acccepted");
155 if (pickedAction.UseAcknowledgment())
156 {
157 //Unlock target
160 }
161 else
162 {
164 }
165 }
166 else
167 {
169 {
170 Debug.ActionLog("Action rejected", pickedAction.ToString() , "n/a", "CheckDeliveredAction", m_Player.ToString() );
171 }
172
173 if (pickedAction.UseAcknowledgment())
174 {
176 }
177 else
178 {
180 }
181 }
182 }
183
184 override void OnActionEnd()
185 {
186 //Debug.Log("Action ended - hard, STS = " + m_Player.GetSimulationTimeStamp());
188 {
189 m_CurrentActionData.m_Action.ClearActionJuncture(m_CurrentActionData);
190
191 super.OnActionEnd();
192 }
193 }
194
195 //pCurrentCommandID is command ID at time of call command handler, some called methods can change actual true value (need call m_Player.GetCurrentCommandID() for actual command ID)
196 override void Update(int pCurrentCommandID)
197 {
198 super.Update(pCurrentCommandID);
199 int currentCommandID = m_Player.GetCurrentCommandID();
200
201 //Debug.Log("m_ActionWantEnd " + m_ActionInputWantEnd);
202
203 if (m_PendingAction)
204 {
206 {
208 }
209 else
210 {
212 m_ActionInputWantEnd = false;
213
214 bool success = true;
215 ActionTarget target = new ActionTarget(null, null, -1, vector.Zero, 0);
216
218 {
219 Debug.ActionLog("n/a", m_PendingAction.ToString() , "n/a", "HandlePendingAction", m_Player.ToString() );
220 }
221
222 if (!m_PendingAction.SetupAction(m_Player,target,m_Player.GetItemInHands(),m_CurrentActionData))
223 {
224 success = false;
225 }
226 //Debug.Log("[AM] Action data synced (" + m_Player + ") success: " + success);
227
228 if (success)
229 {
231 }
232 else
233 {
234 if (m_PendingAction.UseAcknowledgment())
235 {
237 }
238 else
239 {
241 }
242 }
243 }
244
245 m_PendingAction = null;
247 }
248
250 {
252 {
253 m_CurrentActionData.m_Action.OnUpdateServer(m_CurrentActionData);
254 }
255
256 //Debug.Log("m_CurrentActionData.m_State: " + m_CurrentActionData.m_State +" m_ActionWantEnd: " + m_ActionWantEndRequest );
257 switch (m_CurrentActionData.m_State)
258 {
259 case UA_AM_PENDING:
260 break;
261
262 case UA_AM_ACCEPTED:
263 // check currentCommandID before start or reject
264
265 int condition_mask = ActionBase.ComputeConditionMask(m_Player, m_CurrentActionData.m_Target, m_CurrentActionData.m_MainItem);
266 bool canActionPerform = ((condition_mask & m_CurrentActionData.m_Action.m_ConditionMask) == condition_mask);
267 if (canActionPerform && ActionPossibilityCheck(currentCommandID))
268 {
271
272 if (m_CurrentActionData.m_Action && m_CurrentActionData.m_Action.IsInstant())
273 OnActionEnd();
274 }
275 else
276 {
278 }
280 break;
281
282 case UA_AM_REJECTED:
283 OnActionEnd();
285 break;
286
287 default:
289 {
290 m_ActionInputWantEnd = false;
291 m_CurrentActionData.m_Action.EndInput(m_CurrentActionData);
292 }
293
295 {
297 m_CurrentActionData.m_Action.EndRequest(m_CurrentActionData);
298 }
299 break;
300 }
301 }
302 }
303
310
311 override ActionReciveData GetReciveData()
312 {
314 }
315}
const int INPUT_UDT_STANDARD_ACTION_END_REQUEST
Определения _constants.c:3
const int INPUT_UDT_STANDARD_ACTION_START
Определения _constants.c:2
const int INPUT_UDT_STANDARD_ACTION_INPUT_END
Определения _constants.c:4
override ActionBase GetAction()
Определения ActionInput.c:483
bool m_Interrupted
Определения ActionManagerBase.c:49
ref ActionData m_CurrentActionData
Определения ActionManagerBase.c:61
bool m_ActionInputWantEnd
Определения ActionManagerBase.c:53
bool ActionPossibilityCheck(int pCurrentCommandID)
Определения ActionManagerBase.c:244
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
int m_PendingActionAcknowledgmentID
Определения ActionManagerBase.c:59
bool m_ActionWantEndRequest
Определения ActionManagerBase.c:52
class ActionTargets ActionTarget
DayZPlayer m_Player
Определения Hand_Events.c:42
bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
Определения ActionBase.c:861
bool UseAcknowledgment()
Определения ActionBase.c:1123
bool AddActionJuncture(ActionData action_data)
Определения ActionBase.c:1054
bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
Определения ActionBase.c:482
static int ComputeConditionMask(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionBase.c:807
Определения ActionBase.c:53
ref ActionReciveData m_PendingActionReciveData
Определения ActionManagerServer.c:4
override ActionReciveData GetReciveData()
Определения ActionManagerServer.c:311
void ActionManagerServer(PlayerBase player)
Определения ActionManagerServer.c:6
override bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
Определения ActionManagerServer.c:36
override void OnJumpStart()
Определения ActionManagerServer.c:15
override void RequestInterruptAction()
server requests action interrupt
Определения ActionManagerServer.c:305
override void StartDeliveredAction()
Определения ActionManagerServer.c:115
override void Update(int pCurrentCommandID)
Определения ActionManagerServer.c:196
override void OnActionEnd()
Определения ActionManagerServer.c:184
ActionBase m_PendingAction
Определения ActionManagerServer.c:3
override void EndOrInterruptCurrentAction()
Определения ActionManagerServer.c:20
static void SendActionInterrupt(DayZPlayer pPlayer)
Определения DayZPlayerSyncJunctures.c:265
static void SendActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
Определения DayZPlayerSyncJunctures.c:280
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:127
Определения Debug.c:2
Определения InventoryItem.c:731
static bool IsActionLogEnable()
Определения Debug.c:638
Определения Debug.c:594
Определения PlayerBaseClient.c:2
proto bool Read(void value_in)
static const vector Zero
Определения EnConvert.c:110
Определения EnConvert.c:106
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
Serializer ParamsReadContext
Определения gameplay.c:15
const int UA_START
Определения constants.c:467
const int UA_AM_ACCEPTED
Определения constants.c:475
const int UA_AM_REJECTED
Определения constants.c:476
const int UA_AM_PENDING
Определения constants.c:474