DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionManagerClient.c
См. документацию.
3
5{
6
7 //Last send AcknowledgmentID (client can send more requests before recive ackfor first action)
8 protected int m_LastAcknowledgmentID;
9 protected bool m_ActionPossible;
18 protected bool m_IgnoreAutoInputEnd;
19
21
22 protected bool m_ActionWantEndRequest_Send; //Request to server was sended
24
26 {
28 m_HandInventoryLocationTest.SetHands(player,null);
30 m_Targets = new ActionTargets(player);
31 //m_ReservedInventoryLocations = new array<ref InventoryLocation>;
33
36 RegisterInputs(player);
38 }
39
40 //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)
41 override void Update(int pCurrentCommandID)
42 {
43 m_InventoryActionHandler.OnUpdate();
44 super.Update(pCurrentCommandID);
45 int currentCommandID = m_Player.GetCurrentCommandID();
46 m_ActionPossible = ActionPossibilityCheck(currentCommandID);
47
48 if (m_PendingActionData) //SP only
49 {
51
53
54 if (m_CurrentActionData.m_Action.IsInstant())
56
58 }
59
61 {
63 m_CurrentActionData.m_Action.OnUpdateClient(m_CurrentActionData);
64
65 switch (m_CurrentActionData.m_State)
66 {
67 case UA_AM_PENDING:
68 break;
69
70 case UA_AM_ACCEPTED:
71#ifdef ENABLE_LOGGING
73 {
74 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " UA_AM_ACCEPTED", this.ToString() , "n/a", "Update", m_Player.ToString() );
75 }
76#endif
77 int condition_mask = ActionBase.ComputeConditionMask(m_Player, m_CurrentActionData.m_Target, m_CurrentActionData.m_MainItem);
78
79 m_CurrentActionData.m_Action.ClearInventoryReservationEx(m_CurrentActionData);
80 bool can_be_action_done = ((condition_mask & m_CurrentActionData.m_Action.m_ConditionMask) == condition_mask);
81 // check currentCommandID before start or reject
82 if (m_ActionPossible && can_be_action_done)
83 {
84 m_CurrentActionData.m_Action.InventoryReservation(m_CurrentActionData);
87
88 if (m_CurrentActionData.m_Action.IsInstant())
90 }
91 else
92 {
95 }
97 break;
98
99 case UA_AM_REJECTED:
100#ifdef ENABLE_LOGGING
102 {
103 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " UA_AM_REJECTED", this.ToString() , "n/a", "Update", m_Player.ToString() );
104 }
105#endif
106 OnActionEnd();
108 break;
109
110 default:
113 break;
114 }
115 }
116
117#ifdef DEVELOPER
119 {
120 m_ActionPossible = false;
122 }
123 else
124 {
125#endif
127 {
128 bool isMenuOpen = false;
129#ifndef NO_GUI
130 isMenuOpen = g_Game.GetUIManager().IsMenuOpen(MENU_INVENTORY);
131#endif
132 if (m_Player.IsRaised() || isMenuOpen)
133 {
134 m_Targets.Clear();
135 }
136 else
137 {
138 m_Targets.Update();
139 }
140 FindContextualUserActions(currentCommandID);
141 }
142
143 InputsUpdate();
144#ifdef DEVELOPER
145 }
146#endif
147
148 }
149
151 {
153 {
155
156 for (int i = 0; i < m_ActionsArray.Count(); i++)
157 {
158 ActionBase action = m_ActionsArray.Get(i);
159 typename input_type_name = action.GetInputType();
160 ref ActionInput ai;
161
162 ai = ActionInput.Cast(m_RegistredInputsMap.Get(input_type_name));
163 if (!ai)
164 {
165 ai = ActionInput.Cast(input_type_name.Spawn());
166 m_RegistredInputsMap.Insert(input_type_name, ai);
167 }
168 action.SetInput(ai);
169 }
170
171 for (int j = 0; j < m_RegistredInputsMap.Count(); j++)
172 {
173 m_RegistredInputsMap.GetElement(j).Init(player, this);
174 }
176 }
177
178 }
179
180 //Set order of inputs base of priority (output -> m_OrederedAllActionInput)
182 {
183 int i, j;
184 int priority;
185 ActionInput input;
187
189 array<int> array_of_priorities_to_sort = new array<int>;
190 ref array<ActionInput> same_priority_input_array;
191
192 for (i = 0; i < m_RegistredInputsMap.Count(); i++)
193 {
194 input = m_RegistredInputsMap.GetElement(i);
195 priority = input.GetPriority();
196 same_priority_input_array = temp_map_for_sort.Get(priority);
197 if (same_priority_input_array)
198 {
199 same_priority_input_array.Insert(input);
200 continue;
201 }
202
203 same_priority_input_array = new array<ActionInput>;
204 same_priority_input_array.Insert(input);
205 temp_map_for_sort.Insert(priority,same_priority_input_array);
206 array_of_priorities_to_sort.Insert(priority);
207 }
208 array_of_priorities_to_sort.Sort();
209
210 for (i = 0; i < array_of_priorities_to_sort.Count(); i++)
211 {
212 priority = array_of_priorities_to_sort[i];
213 same_priority_input_array = temp_map_for_sort.Get(priority);
214 for (j = 0; j < same_priority_input_array.Count(); j++)
215 {
216 input = same_priority_input_array.Get(j);
217 m_OrederedAllActionInput.Insert(input);
218 }
219 }
220
222 }
223
224 //Order for user action inputs - will be dynamically change base on context (more complex handling viz set m_OrderedStandartActionInputs in UpdateActionCategoryPriority())
226 {
227 int i, j;
231 if (input)
232 {
233 m_OrderedStandartActionInputs.Insert(input);
234 }
235
237 if (input)
238 {
239 m_OrderedStandartActionInputs.Insert(input);
240 }
241
243 if (input)
244 {
245 m_OrderedStandartActionInputs.Insert(input);
246 }
247
249 if (input)
250 {
251 m_OrderedStandartActionInputs.Insert(input);
252 }
253
254 for (i = 0; i < m_OrederedAllActionInput.Count(); i++)
255 {
256 for (j = 0; j < m_OrderedStandartActionInputs.Count(); j++)
257 {
259 {
261 break;
262 }
263 }
264 }
265 }
266
267 static ActionVariantManager GetVariantManager(typename actionName)
268 {
269 ActionBase action = GetAction(actionName);
270 if (action)
271 {
272 return action.GetVariantManager();
273 }
274 //VME ACTION not exist typo most likely
275 return null;
276 }
277
278 override void RequestEndAction()
279 {
281 {
283 }
284 }
285
286 override void EndActionInput()
287 {
288#ifdef ENABLE_LOGGING
290 {
291 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "EndActionInput", m_Player.ToString() );
292 }
293#endif
295 {
297 }
298 }
299
301 {
302 ActionInput ain;
304 {
306 {
307 ActionInput ai = m_CurrentActionData.m_Action.GetInput();
308 ai.Update();
309 if (m_Player.IsQBControl())
310 {
311 if (ai.JustActivate())
312 m_Player.SetActionEndInput(m_CurrentActionData.m_Action);
313 }
314 else
315 {
316 if (ai.WasEnded() && (ai.GetInputType() == ActionInputType.AIT_CONTINUOUS || ai.GetInputType() == ActionInputType.AIT_CLICKCONTINUOUS) && !m_IgnoreAutoInputEnd)
317 {
319 }
320 }
321 }
322 }
323 else
324 {
326 {
327 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
328 {
329
331 ain.Update();
332
333 if (ain.JustActivate())
334 {
335 ActionBase action = ain.GetAction();
336 if (action && action.CanBeStarted())
337 {
338 ActionStart(action, ain.GetUsedActionTarget(), ain.GetUsedMainItem());
339 break;
340 }
341 }
342 }
343 }
344 }
345 }
346
348 {
350 {
351 if (g_Game.IsMultiplayer() && !m_CurrentActionData.m_Action.IsLocal())
352 {
354 {
355#ifdef ENABLE_LOGGING
357 {
358 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp(), m_CurrentActionData.m_Action.ToString() , "n/a", "EndRequest", m_CurrentActionData.m_Player.ToString());
359 }
360#endif
363 ctx.Send();
364
366
368 m_CurrentActionData.m_Action.EndRequest(m_CurrentActionData);
369 }
370 }
371 else
372 {
374 m_CurrentActionData.m_Action.EndRequest(m_CurrentActionData);
375 }
376 }
377 }
378
380 {
382 {
383 if (g_Game.IsMultiplayer() && !m_CurrentActionData.m_Action.IsLocal())
384 {
386 {
387#ifdef ENABLE_LOGGING
389 {
390 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp(), m_CurrentActionData.m_Action.ToString() , "n/a", "EndInput", m_CurrentActionData.m_Player.ToString());
391 }
392#endif
395 ctxi.Send();
396
398
399 m_ActionInputWantEnd = false;
400 m_CurrentActionData.m_Action.EndInput(m_CurrentActionData);
401 }
402 }
403 else
404 {
406 {
408 m_ActionInputWantEnd = false;
409 m_CurrentActionData.m_Action.EndInput(m_CurrentActionData);
410 }
411 }
412 }
413 }
414
415 ActionBase GetPossibleAction(typename inputType)
416 {
417 ActionInput action_input = m_RegistredInputsMap.Get(inputType);
418 if (action_input)
419 {
420 return action_input.GetAction();
421 }
422 return NULL;
423 }
424
426 {
427 ActionInput action_input = m_RegistredInputsMap.Get(inputType);
428 if (action_input)
429 {
430 return action_input.GetPossibleActions();
431 }
432 return NULL;
433 }
434
435 int GetPossibleActionIndex(typename inputType)
436 {
437 ActionInput action_input = m_RegistredInputsMap.Get(inputType);
438 if (action_input)
439 {
440 return action_input.GetPossibleActionIndex();
441 }
442 return -1;
443 }
444
445 int GetPossibleActionCount(typename inputType)
446 {
447 ActionInput action_input = m_RegistredInputsMap.Get(inputType);
448 if (action_input)
449 {
450 return action_input.GetPossibleActionsCount();
451 }
452 return 0;
453 }
454
455 //--------------------------------------------------------
456 // Alows to set different action to current contextual one
457 //--------------------------------------------------------
458 void InjectAction(ActionBase action, ActionTarget target, ItemBase item)
459 {
460 ActionInput ai = action.GetInput();
461 ai.ForceAction(action, target, item);
462 }
463
464 void InjectAction(typename actionType, ActionTarget target, ItemBase item)
465 {
466 ActionBase action = GetAction(actionType);
467 InjectAction(action, target, item);
468 }
469
471 {
472 ActionInput ai = action.GetInput();
474 }
475
476 void EjectAction(typename actionType)
477 {
478 ActionBase action = GetAction(actionType);
479 EjectAction(action);
480 }
481
482 void ForceTarget(Object targetObject)
483 {
484 Object parent = null;
485 EntityAI targetEntity = EntityAI.Cast(targetObject);
486 if (targetEntity)
487 parent = targetEntity.GetHierarchyParent();
488 m_ForceTarget = new ActionTarget(targetObject, parent, -1, vector.Zero, -1);
489 }
490
492 {
493 m_ForceTarget = NULL;
494 }
495
496
497 //-------------------------------------------------------------------------
499 {
500 if (m_ForceTarget)
501 return m_ForceTarget;
502
503 ActionTarget action_target;
504 action_target = NULL;
505 int targetsCount = m_Targets.GetTargetsCount();
506 if (targetsCount)
507 {
508 for (int i = 0; i < targetsCount; ++i)
509 {
510 action_target = m_Targets.GetTarget(i);
511 Object targetObject = action_target.GetObject();
512 Object targetParent = action_target.GetParent();
513
514 if (targetParent)
515 {
516 break;
517 }
518
519 if (targetObject)
520 {
521 break;
522 }
523 }
524 }
525 else
526 {
527 action_target = new ActionTarget(null, null, -1, vector.Zero, -1);
528 }
529 return action_target;
530 }
531
533 {
534 ItemBase item;
535 if (m_Player && m_Player.GetItemInHands() && m_Player.GetItemInHands().IsItemBase())
536 {
537 item = m_Player.GetItemInHands();
538 }
539 return item;
540 }
541
543 {
544 m_HandInventoryLocationTest.SetHands(m_Player,m_Player.GetItemInHands());
545 if (m_Player.GetHumanInventory().HasInventoryReservation(m_Player.GetItemInHands(),m_HandInventoryLocationTest))
546 return true;
547 return false;
548 }
549
550 protected void FindContextualUserActions(int pCurrentCommandID)
551 {
552 // TODO: NEEDS OPTIMIZATION (focus on UpdatePossibleActions > CraftingManager::OnUpdate)
553
554 m_ActionsAvaibale = false;
555 if (!m_ActionPossible || HasHandInventoryReservation() || g_Game.IsInventoryOpen())
556 {
558 return;
559 }
560
561 if (!GetRunningAction())
562 {
563 ActionBase action;
564 ActionTarget target;
565 ItemBase item;
566
567 // Gathering current inputs
568 m_ActionsAvaibale = true;
569
570 item = FindActionItem();
571 target = FindActionTarget();
572
573 int actionConditionMask = ActionBase.ComputeConditionMask(m_Player,target,item);
574 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
575 {
577 ain.UpdatePossibleActions(m_Player,target,item, actionConditionMask);
578 }
579
581 SetActionContext(target,item);
582 }
583 }
584
585 //TOOD MW In progress
586 protected bool LockInventory(ActionData action_data)
587 {
588 bool success = false;
589 if (action_data.m_Action.IsInstant())
590 {
591#ifdef ENABLE_LOGGING
593 {
594 Debug.ActionLog("(-) Inventory lock - Not Used", action_data.m_Action.ToString() , "n/a", "LockInventory", action_data.m_Player.ToString());
595 }
596#endif
597 success = true;
598 }
599 else
600 {
601#ifdef ENABLE_LOGGING
603 {
604 Debug.ActionLog("(X) Inventory lock", action_data.m_Action.ToString() , "n/a", "LockInventory", action_data.m_Player.ToString());
605 }
606#endif
607 if (action_data.m_Action)
608 {
609 success = action_data.m_Action.InventoryReservation(action_data);
610 }
611 }
612 return success;
613 }
614 void UnlockInventory(ActionData action_data)
615 {
616#ifdef ENABLE_LOGGING
618 {
619 Debug.ActionLog("(O) Inventory unlock", action_data.m_Action.ToString() , "n/a", "UnlockInventory", action_data.m_Player.ToString());
620 }
621#endif
622 if (action_data.m_Action)
623 action_data.m_Action.ClearInventoryReservationEx(action_data);
624 }
625
626 protected void ActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data = NULL)
627 {
628 if (!m_CurrentActionData && action && ActionPossibilityCheck(m_Player.GetCurrentCommandID()))
629 {
630#ifdef ENABLE_LOGGING
632 {
633 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "ActionStart", m_Player.ToString() );
634 }
635#endif
639 m_ActionInputWantEnd = false;
640
641 if (action.CanBePerformedFromQuickbar())
642 m_Player.SetActionEndInput(action);
643
645#ifdef ENABLE_LOGGING
647 {
648 if ( target )
649 {
650 Debug.ActionLog("Item = " + item + ", " + target.DumpToString(), action.ToString() , "n/a", "ActionStart", m_Player.ToString());
651 }
652 else
653 {
654 Debug.ActionLog("Item = " + item + ", no target", action.ToString() , "n/a", "ActionStart", m_Player.ToString());
655 }
656 }
657#endif
658 m_Interrupted = false;
659 if (g_Game.IsMultiplayer() && !action.IsLocal())
660 {
662 {
663 DPrint("ScriptInputUserData already posted - ActionManagerClient");
664#ifdef ENABLE_LOGGING
666 {
667 Debug.ActionLog("Cannot start because ScriptInputUserData is already used", action.ToString() , "n/a", "ActionStart", m_Player.ToString());
668 }
669#endif
670 return;
671 }
672 }
673
674 if (!action.SetupAction(m_Player, target, item, m_CurrentActionData, extra_data))
675 {
676 DPrint("Can not inicialize action" + action + " - ActionManagerClient");
677 m_CurrentActionData = NULL;
678 return;
679 }
680#ifdef ENABLE_LOGGING
682 {
683 Debug.ActionLog("Action data created wait to start", action.ToString() , "n/a", "ActionStart", m_Player.ToString());
684 }
685#endif
686
687 if (g_Game.IsMultiplayer() && !action.IsLocal())
688 {
691 ctx.Write(action.GetID());
692
693 action.WriteToContext(ctx, m_CurrentActionData);
694
695 if (action.UseAcknowledgment())
696 {
699
701 }
702#ifdef ENABLE_LOGGING
704 {
705 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp() + " ctx.Send()", this.ToString() , "n/a", "ActionStart", m_Player.ToString() );
706 }
707#endif
708 ctx.Send();
709
710 if (!action.UseAcknowledgment())
711 {
712 action.Start(m_CurrentActionData);
713 if (action.IsInstant())
714 OnActionEnd();
715 }
716 }
717 else
718 {
719 action.Start(m_CurrentActionData);
720 if (action.IsInstant())
721 OnActionEnd();
722 }
723 }
724 }
725
727 {
728 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
729 {
731 if (action.GetInput() == ain)
732 {
733 ain.OnActionStart();
734 }
735 else
736 {
737 ain.Reset();
738 }
739 }
740 }
741
743 {
745 }
746
748 {
749 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
750 {
752 ain.Reset();
753 }
754 }
755
757 {
758 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
759 {
761 ain.ActionsSelectReset();
762 }
763 }
764
765 override void OnJumpStart()
766 {
768 }
769
771 {
773 {
775 {
776 OnActionEnd();
778 }
779 else
780 {
781 m_CurrentActionData.m_Action.Interrupt(m_CurrentActionData);
782 }
783 }
784 }
785
786 //Instant Action (Debug Actions) ---------------------------------
787 override void OnInstantAction(typename user_action_type, Param data = NULL)
788 {
789 ActionBase action = GetAction(user_action_type);
790 if (action)
791 {
792 ActionStart(action,NULL,NULL, data);
793 }
794 }
795
796#ifdef BOT
798 void PerformAction(int user_action_id, ActionTarget target, ItemBase item, Param extraData = NULL)
799 {
800 ActionStart(GetAction(user_action_id), target, item, extraData);
801 }
802#endif
803
804 void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data = NULL)
805 {
806 if (!g_Game.IsMultiplayer())
807 {
809 {
811
812 if (!action.SetupAction(m_Player, target, item, m_PendingActionData, extra_data))
813 m_PendingActionData = null;
814 }
815 }
816 else
817 {
818 ActionStart(action, target, item, extra_data);
819 }
820 }
821
822 override int GetActionState()
823 {
825 return UA_AM_INIT;
826
827 return super.GetActionState();
828 }
829
830 override void OnActionEnd()
831 {
833 {
834#ifdef ENABLE_LOGGING
836 {
837 Debug.ActionLog("STS = " + m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "OnActionEnd", m_Player.ToString() );
838 }
839#endif
841 if (m_CurrentActionData.m_Action.RemoveForceTargetAfterUse())
842 m_InventoryActionHandler.DeactiveAction();
843
844 super.OnActionEnd();
846 }
847 }
848
849 void SetInventoryAction(ActionBase action_name, ItemBase target_item, ItemBase main_item)
850 {
851 m_InventoryActionHandler.SetAction(action_name, target_item, main_item);
852 }
853
854 void SetInventoryAction(ActionBase action_name, ActionTarget target, ItemBase main_item)
855 {
856 m_InventoryActionHandler.SetAction(action_name, target, main_item);
857 }
858
860 {
861 m_InventoryActionHandler.DeactiveAction();
862 }
863
868
870 {
871 int i;
872 int last_target_index = 0;
873 for (i = 0; i < m_DefaultOrderOfActionInputs.Count(); i++)
874 {
876 {
878 last_target_index++;
879 }
880 }
881
882 for (i = 0; i < m_DefaultOrderOfActionInputs.Count(); i++)
883 {
885 {
887 last_target_index++;
888 }
889 }
890 }
891
893 {
896
897 for (int index = 0; index < m_OrderedStandartActionInputs.Count(); index++)
898 {
900 {
902 break;
903 }
904 }
905 }
906
908 {
909 int index;
910
912 {
913 if (++index >= m_OrderedStandartActionInputs.Count())
914 {
915 index = 0;
916 }
918 {
920 break;
921 }
922 }
923 }
924
926 {
927 int index;
928
930 {
931 if (--index < 0)
932 {
933 index = m_OrderedStandartActionInputs.Count() - 1;
934 }
935
937 {
939 break;
940 }
941 }
942 }
943
944
945 override void SelectNextAction()
946 {
947 ActionInput ai;
949 {
951 if (ai && ai.GetPossibleActionsCount() > 1)
952 {
953 ai.SelectNextAction();
954 }
955 }
956 }
957
958 override void SelectPrevAction()
959 {
960 ActionInput ai;
962 {
964 if (ai && ai.GetPossibleActionsCount() > 1)
965 {
966 ai.SelectPrevAction();
967 }
968 }
969 }
970
972 {
973 ItemBase itemInHand = m_Player.GetItemInHands();
974 ActionTarget target;
975 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
976 bool hasTarget = targetItem != NULL;
977
978 if (mainItem)
979 {
981 ActionBase picked_action;
982 int i;
983
984 mainItem.GetActions(QuickaBarActionInput, actions);
985 if (actions)
986 {
987 for (i = 0; i < actions.Count(); i++)
988 {
989 picked_action = ActionBase.Cast(actions[i]);
990 if (picked_action && picked_action.Can(m_Player,target, itemInHand))
991 {
992 if (hasTarget == picked_action.HasTarget())
993 return true;
994 }
995 }
996 }
997 //First check continuous actions
998 mainItem.GetActions(ContinuousDefaultActionInput, actions);
999 if (actions)
1000 {
1001 for (i = 0; i < actions.Count(); i++)
1002 {
1003 picked_action = ActionBase.Cast(actions[i]);
1004 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
1005 {
1006 if (hasTarget == picked_action.HasTarget())
1007 return true;
1008 }
1009 }
1010 }
1011 //second single use actions
1012 mainItem.GetActions(DefaultActionInput, actions);
1013 if (actions)
1014 {
1015 for (i = 0; i < actions.Count(); i++)
1016 {
1017 picked_action = ActionBase.Cast(actions[i]);
1018 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
1019 {
1020 if (hasTarget == picked_action.HasTarget())
1021 return true;
1022 }
1023 }
1024 }
1025 }
1026 return false;
1027 }
1028
1030 {
1031 ItemBase itemInHand = m_Player.GetItemInHands();
1032 ActionTarget target;
1033 ItemBase parent = null;
1034 if (targetItem)
1035 parent = ItemBase.Cast(targetItem.GetHierarchyParent());
1036 target = new ActionTarget(targetItem, parent, -1, vector.Zero, -1);
1037 bool hasTarget = targetItem != NULL;
1038
1039 if (mainItem)
1040 {
1041 ActionBase picked_action;
1043 int i;
1044
1045 mainItem.GetActions(QuickaBarActionInput, actions);
1046 if (actions)
1047 {
1048 for (i = 0; i < actions.Count(); i++)
1049 {
1050 picked_action = ActionBase.Cast(actions[i]);
1051 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player,target, itemInHand))
1052 {
1053 if (hasTarget == picked_action.HasTarget())
1054 {
1055 ActionStart(picked_action, target, mainItem);
1056 return;
1057 }
1058 }
1059 }
1060 }
1061
1062 //First continuous actions
1063 mainItem.GetActions(ContinuousDefaultActionInput, actions);
1064 if (actions)
1065 {
1066 for (i = 0; i < actions.Count(); i++)
1067 {
1068 picked_action = ActionBase.Cast(actions[i]);
1069 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
1070 {
1071 if (hasTarget == picked_action.HasTarget())
1072 {
1073 ActionStart(picked_action, target, mainItem);
1074 return;
1075 }
1076 }
1077 }
1078 }
1079 //Second check single use actions
1080 mainItem.GetActions(DefaultActionInput, actions);
1081 if (actions)
1082 {
1083 for (i = 0; i < actions.Count(); i++)
1084 {
1085 picked_action = ActionBase.Cast(actions[i]);
1086 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
1087 {
1088 if (hasTarget == picked_action.HasTarget())
1089 {
1090 ActionStart(picked_action, target, mainItem);
1091 return;
1092 }
1093 }
1094 }
1095 }
1096
1097 }
1098 }
1099
1100 //TODO Variants support ???
1102 {
1103 ItemBase itemInHand = m_Player.GetItemInHands();
1104 ActionTarget target;
1105 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
1106 bool hasTarget = targetItem != NULL;
1107
1108 if (mainItem)
1109 {
1111 ActionBase picked_action;
1112 int i;
1113
1114 //First check single use actions
1115 mainItem.GetActions(DefaultActionInput, actions);
1116 if (actions)
1117 {
1118 for (i = 0; i < actions.Count(); i++)
1119 {
1120 picked_action = ActionBase.Cast(actions[i]);
1121 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromInventory())
1122 {
1123 if (hasTarget == picked_action.HasTarget())
1124 return true;
1125 }
1126 }
1127 }
1128
1129 //Inventory specific actions
1130 mainItem.GetActions(InventoryOnlyActionInput, actions);
1131 if (actions)
1132 {
1133 for (i = 0; i < actions.Count(); i++)
1134 {
1135 picked_action = ActionBase.Cast(actions[i]);
1136 if (picked_action && picked_action.Can(m_Player,target, itemInHand))
1137 {
1138 if (hasTarget == picked_action.HasTarget())
1139 return true;
1140 }
1141 }
1142 }
1143 }
1144 return false;
1145 }
1146
1147 //TODO Variants support ???
1149 {
1150 ItemBase itemInHand = m_Player.GetItemInHands();
1151 ActionTarget target;
1152 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
1153 bool hasTarget = targetItem != NULL;
1154
1155 if (mainItem)
1156 {
1157 ActionBase picked_action;
1159 int i;
1160
1161 //First check single use actions
1162 mainItem.GetActions(DefaultActionInput, actions);
1163 if (actions)
1164 {
1165 for (i = 0; i < actions.Count(); i++)
1166 {
1167 picked_action = ActionBase.Cast(actions[i]);
1168 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromInventory())
1169 {
1170 if (hasTarget == picked_action.HasTarget())
1171 {
1172 ActionStart(picked_action, target, mainItem);
1173 return;
1174 }
1175 }
1176 }
1177 }
1178
1179 //Inventory specific actions
1180 mainItem.GetActions(InventoryOnlyActionInput, actions);
1181 if (actions)
1182 {
1183 for (i = 0; i < actions.Count(); i++)
1184 {
1185 picked_action = ActionBase.Cast(actions[i]);
1186 if (picked_action && picked_action.Can(m_Player,target, itemInHand))
1187 {
1188 if (hasTarget == picked_action.HasTarget())
1189 {
1190 ActionStart(picked_action, target, mainItem);
1191 return;
1192 }
1193 }
1194 }
1195 }
1196 }
1197 }
1198
1200 {
1201 ItemBase itemInHand = m_Player.GetItemInHands();
1202 ActionTarget target;
1203 EntityAI parent = null;
1204 if (targetItem)
1205 {
1206 parent = targetItem.GetHierarchyParent();
1207 }
1208 target = new ActionTarget(targetItem, parent, -1, vector.Zero, -1);
1209 bool hasTarget = targetItem != NULL;
1210
1211 if (mainItem)
1212 {
1214 array<ref ActionBase> variant_actions;
1215 ActionBase picked_action;
1216 int variants_count,v;
1217
1218 //First check single use actions
1219 mainItem.GetActions(DefaultActionInput, actions);
1220 if (actions)
1221 {
1222 for (int i = 0; i < actions.Count(); i++)
1223 {
1224 picked_action = ActionBase.Cast(actions[i]);
1225 if (picked_action.HasVariants())
1226 {
1227 picked_action.UpdateVariants(itemInHand, targetItem, -1);
1228 picked_action.GetVariants(variant_actions);
1229 for (v = 0; v < variant_actions.Count(); v ++)
1230 {
1231 picked_action = variant_actions[v];
1232 if (picked_action && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player,target, itemInHand))
1233 {
1234 if (hasTarget == picked_action.HasTarget())
1235 return true;
1236 }
1237 }
1238 }
1239 else
1240 {
1241 if (picked_action && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player,target, itemInHand))
1242 {
1243 if (hasTarget == picked_action.HasTarget())
1244 return true;
1245 }
1246 }
1247 }
1248 }
1249 //second continuous actions
1250 mainItem.GetActions(ContinuousDefaultActionInput, actions);
1251 if (actions)
1252 {
1253 for (int j = 0; j < actions.Count(); j++)
1254 {
1255 picked_action = ActionBase.Cast(actions[j]);
1256 if (picked_action.HasVariants())
1257 {
1258 picked_action.UpdateVariants(itemInHand, targetItem, -1);
1259 picked_action.GetVariants(variant_actions);
1260 for (v = 0; v < variant_actions.Count(); v ++)
1261 {
1262 picked_action = variant_actions[v];
1263 if (picked_action && picked_action.HasTarget() && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player,target, itemInHand))
1264 {
1265 if (hasTarget == picked_action.HasTarget())
1266 return true;
1267 }
1268 }
1269 }
1270 else
1271 {
1272 if (picked_action && picked_action.HasTarget() && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player,target, itemInHand))
1273 {
1274 if (hasTarget == picked_action.HasTarget())
1275 return true;
1276 }
1277 }
1278 }
1279 }
1280 }
1281 return false;
1282 }
1283
1284 //TODO fix for variants
1285 void SetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
1286 {
1287 ItemBase itemInHand = m_Player.GetItemInHands();
1288 ActionTarget target;
1289 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
1290 bool hasTarget = targetItem != NULL;
1291
1292 if (mainItem)
1293 {
1295 ActionBase picked_action;
1296
1297 //First check single use actions
1298 mainItem.GetActions(DefaultActionInput, actions);
1299 if (actions)
1300 {
1301 for (int i = 0; i < actions.Count(); i++)
1302 {
1303 picked_action = ActionBase.Cast(actions[i]);
1304 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBeSetFromInventory())
1305 {
1306 if (hasTarget == picked_action.HasTarget())
1307 {
1308 SetInventoryAction(picked_action, target, itemInHand);
1309 return;
1310 }
1311 }
1312 }
1313 }
1314 //second continuous actions
1315 mainItem.GetActions(ContinuousDefaultActionInput, actions);
1316 if (actions)
1317 {
1318 for (int j = 0; j < actions.Count(); j++)
1319 {
1320 picked_action = ActionBase.Cast(actions[j]);
1321 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBeSetFromInventory())
1322 {
1323 if (hasTarget == picked_action.HasTarget())
1324 {
1325 SetInventoryAction(picked_action, target, itemInHand);
1326 return;
1327 }
1328 }
1329 }
1330 }
1331 }
1332 }
1333
1334 // disables automatic end of continuous action when input ended
1336 {
1337 m_IgnoreAutoInputEnd = state;
1338 }
1339
1342 {
1344 {
1347 ctx.Write(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
1348 ctx.Send();
1349 }
1350 }
1351
1354};
const int INPUT_UDT_STANDARD_ACTION_END_REQUEST
const int INPUT_UDT_STANDARD_ACTION_START
const int INPUT_UDT_STANDARD_ACTION_INPUT_END
bool HasTarget()
Определения ActionBase.c:259
void ActionBase()
Определения ActionBase.c:82
void ContinuousDefaultActionInput(PlayerBase player)
Определения ActionInput.c:630
override ActionBase GetAction()
Определения ActionInput.c:506
ActionInputType
Определения ActionInput.c:2
override int GetPossibleActionsCount()
Определения ActionInput.c:491
bool m_Interrupted
Определения ActionManagerBase.c:49
ref ActionData m_CurrentActionData
Определения ActionManagerBase.c:61
void SetActionContext(ActionTarget target, ItemBase item)
Определения ActionManagerBase.c:273
bool m_ActionsAvaibale
Определения ActionManagerBase.c:55
bool m_ActionInputWantEnd
Определения ActionManagerBase.c:53
bool ActionPossibilityCheck(int pCurrentCommandID)
Определения ActionManagerBase.c:262
static ref array< ref ActionBase > m_ActionsArray
Определения ActionManagerBase.c:50
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
int m_PendingActionAcknowledgmentID
Определения ActionManagerBase.c:59
bool m_ActionWantEndRequest
Определения ActionManagerBase.c:52
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
map< typename, ref ActionInput > TTypeNameActionInputMap
Определения ActionManagerClient.c:2
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
DayZGame g_Game
Определения DayZGame.c:4074
DayZPlayer m_Player
Определения Hand_Events.c:42
PlayerBase m_Player
Определения ActionBase.c:40
ref ActionBase m_Action
Определения ActionBase.c:34
Определения ActionBase.c:22
int GetPossibleActionsCount()
Определения ActionInput.c:276
void ActionsSelectReset()
Определения ActionInput.c:229
void UpdatePossibleActions(PlayerBase player, ActionTarget target, ItemBase item, int action_condition_mask)
Определения ActionInput.c:180
void Update()
Определения ActionInput.c:116
array< ActionBase > GetPossibleActions()
Определения ActionInput.c:199
void OnActionStart()
Определения ActionInput.c:219
void SelectPrevAction()
Определения ActionInput.c:273
void ClearForcedAction()
Определения ActionInput.c:245
void SelectNextAction()
Определения ActionInput.c:269
int GetPossibleActionIndex()
Определения ActionInput.c:209
ActionBase GetAction()
Определения ActionInput.c:184
int GetPriority()
Определения ActionInput.c:286
bool WasEnded()
Определения ActionInput.c:111
int GetInputType()
Определения ActionInput.c:91
void ForceAction(ActionBase action, ActionTarget target, ItemBase item)
Определения ActionInput.c:232
ItemBase GetUsedMainItem()
Определения ActionInput.c:194
ActionTarget GetUsedActionTarget()
Определения ActionInput.c:189
bool JustActivate()
Определения ActionInput.c:101
void Reset()
Определения ActionInput.c:174
Определения ActionInput.c:20
override void SelectNextAction()
Определения ActionManagerClient.c:945
void SetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1285
ref array< ActionInput > m_OrderedStandartActionInputs
Определения ActionManagerClient.c:15
override void SelectFirstActionCategory()
Определения ActionManagerClient.c:892
bool CanPerformActionFromQuickbar(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:971
void EjectAction(typename actionType)
Определения ActionManagerClient.c:476
void RegisterInputs(PlayerBase player)
Определения ActionManagerClient.c:150
void SetDefaultInputsOrder()
Определения ActionManagerClient.c:225
int GetPossibleActionCount(typename inputType)
Определения ActionManagerClient.c:445
array< ActionBase > GetPossibleActions(typename inputType)
Определения ActionManagerClient.c:425
override void OnActionEnd()
Определения ActionManagerClient.c:830
void ProcessActionRequestEnd()
Определения ActionManagerClient.c:347
ActionBase GetPossibleAction(typename inputType)
Определения ActionManagerClient.c:415
void SetInventoryAction(ActionBase action_name, ItemBase target_item, ItemBase main_item)
Определения ActionManagerClient.c:849
void ClearForceTarget()
Определения ActionManagerClient.c:491
void ActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
Определения ActionManagerClient.c:626
override GetSelectedActionCategory()
Определения ActionManagerClient.c:864
bool m_IgnoreAutoInputEnd
Определения ActionManagerClient.c:18
ref array< ref InventoryLocation > m_ReservedInventoryLocations
Определения ActionManagerClient.c:10
ref InventoryActionHandler m_InventoryActionHandler
Определения ActionManagerClient.c:11
void SetActioninputOrder()
Определения ActionManagerClient.c:181
void InjectAction(ActionBase action, ActionTarget target, ItemBase item)
Определения ActionManagerClient.c:458
override ActionTarget FindActionTarget()
Определения ActionManagerClient.c:498
void PerformActionFromQuickbar(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1029
override void SelectNextActionCategory()
Определения ActionManagerClient.c:907
void SetInventoryAction(ActionBase action_name, ActionTarget target, ItemBase main_item)
Определения ActionManagerClient.c:854
override void RequestInterruptAction()
client requests action interrupt
Определения ActionManagerClient.c:1341
bool LockInventory(ActionData action_data)
Определения ActionManagerClient.c:586
void FindContextualUserActions(int pCurrentCommandID)
Определения ActionManagerClient.c:550
void HandleInputsOnActionEnd()
Определения ActionManagerClient.c:742
void UnlockInventory(ActionData action_data)
Определения ActionManagerClient.c:614
override void EndOrInterruptCurrentAction()
Определения ActionManagerClient.c:770
void UnsetInventoryAction()
Определения ActionManagerClient.c:859
void InputsUpdate()
Определения ActionManagerClient.c:300
bool m_ActionWantEndRequest_Send
Определения ActionManagerClient.c:22
override void RequestEndAction()
Определения ActionManagerClient.c:278
void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
Определения ActionManagerClient.c:804
ref array< ActionInput > m_DefaultOrderOfActionInputs
Определения ActionManagerClient.c:16
ref array< ActionInput > m_OrederedAllActionInput
Определения ActionManagerClient.c:14
override void SelectPrevAction()
Определения ActionManagerClient.c:958
override int GetActionState()
Определения ActionManagerClient.c:822
bool HasHandInventoryReservation()
Определения ActionManagerClient.c:542
override void OnJumpStart()
Определения ActionManagerClient.c:765
void InjectAction(typename actionType, ActionTarget target, ItemBase item)
Определения ActionManagerClient.c:464
ref ActionTargets m_Targets
Определения ActionManagerClient.c:1353
void ResetInputsActions()
Определения ActionManagerClient.c:756
void PerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1148
override void OnInstantAction(typename user_action_type, Param data=NULL)
Определения ActionManagerClient.c:787
override void EndActionInput()
Определения ActionManagerClient.c:286
ref InventoryLocation m_HandInventoryLocationTest
Определения ActionManagerClient.c:12
override void Update(int pCurrentCommandID)
Определения ActionManagerClient.c:41
void ForceTarget(Object targetObject)
Определения ActionManagerClient.c:482
ref ActionTarget m_ForceTarget
Определения ActionManagerClient.c:1352
void HandleInputsOnActionStart(ActionBase action)
Определения ActionManagerClient.c:726
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1101
void UpdateActionCategoryPriority()
Определения ActionManagerClient.c:869
bool m_ActionPossible
Определения ActionManagerClient.c:9
int m_SelectedActionInputToSrollIndex
Определения ActionManagerClient.c:17
ref TTypeNameActionInputMap m_RegistredInputsMap
Определения ActionManagerClient.c:13
void ActionManagerClient(PlayerBase player)
Определения ActionManagerClient.c:25
void ProcessActionInputEnd()
Определения ActionManagerClient.c:379
int m_LastAcknowledgmentID
Определения ActionManagerClient.c:8
static ActionVariantManager GetVariantManager(typename actionName)
Определения ActionManagerClient.c:267
void EjectAction(ActionBase action)
Определения ActionManagerClient.c:470
int GetPossibleActionIndex(typename inputType)
Определения ActionManagerClient.c:435
ref ActionData m_PendingActionData
Определения ActionManagerClient.c:20
override void SelectPrevActionCategory()
Определения ActionManagerClient.c:925
ItemBase FindActionItem()
Определения ActionManagerClient.c:532
bool m_ActionInputWantEnd_Send
Определения ActionManagerClient.c:23
void SetIgnoreAutomaticInputEnd(bool state)
Определения ActionManagerClient.c:1335
void ResetInputsState()
Определения ActionManagerClient.c:747
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1199
Определения ActionTargets.c:208
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения 3_Game/DayZ/tools/Debug.c:188
Определения 3_Game/DayZ/tools/Debug.c:2
static bool IsFreeCameraEnabledNoPlayerMovement()
Определения DeveloperFreeCamera.c:28
Client only - manage set up crafting on client.
Определения InventoryActionHandler.c:3
InventoryLocation.
Определения InventoryLocation.c:30
static bool IsActionLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:749
Определения ObjectTyped.c:2
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения PlayerBaseClient.c:2
proto native void Send()
proto static native bool CanStoreInputUserData()
Returns true when the channel is free, AND the InputBuffer is NOT full (same as '!...
Определения gameplay.c:121
proto bool Write(void value_out)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения Transport.c:70
static const vector Zero
Определения EnConvert.c:123
Определения EnConvert.c:119
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto void DPrint(string var)
Prints content of variable to console/log. Should be used for critical messages so it will appear in ...
const int MENU_INVENTORY
Определения 3_Game/DayZ/constants.c:186
const int UA_START
Определения 3_Game/DayZ/constants.c:501
const int UA_AM_ACCEPTED
Определения 3_Game/DayZ/constants.c:510
const int UA_AM_INIT
Определения 3_Game/DayZ/constants.c:508
const int UA_AM_REJECTED
Определения 3_Game/DayZ/constants.c:511
const int UA_AM_PENDING
Определения 3_Game/DayZ/constants.c:509
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
Определения ActionManagerBase.c:91