DayZ 1.28
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 int condition_mask = ActionBase.ComputeConditionMask(m_Player, m_CurrentActionData.m_Target, m_CurrentActionData.m_MainItem);
72
73 m_CurrentActionData.m_Action.ClearInventoryReservationEx(m_CurrentActionData);
74 bool can_be_action_done = ((condition_mask & m_CurrentActionData.m_Action.m_ConditionMask) == condition_mask);
75 // check currentCommandID before start or reject
76 if (m_ActionPossible && can_be_action_done)
77 {
78 m_CurrentActionData.m_Action.InventoryReservation(m_CurrentActionData);
81
82 if (m_CurrentActionData.m_Action.IsInstant())
84 }
85 else
86 {
89 }
91 break;
92
93 case UA_AM_REJECTED:
96 break;
97
98 default:
101 break;
102 }
103 }
104
105#ifdef DEVELOPER
107 {
108 m_ActionPossible = false;
110 }
111 else
112 {
113#endif
115 {
116 bool isMenuOpen = false;
117#ifndef NO_GUI
119#endif
120 if (m_Player.IsRaised() || isMenuOpen)
121 {
122 m_Targets.Clear();
123 }
124 else
125 {
126 m_Targets.Update();
127 }
128 FindContextualUserActions(currentCommandID);
129 }
130
131 InputsUpdate();
132#ifdef DEVELOPER
133 }
134#endif
135
136 }
137
139 {
141 {
143
144 for (int i = 0; i < m_ActionsArray.Count(); i++)
145 {
146 ActionBase action = m_ActionsArray.Get(i);
147 typename input_type_name = action.GetInputType();
148 ref ActionInput ai;
149
150 ai = ActionInput.Cast(m_RegistredInputsMap.Get(input_type_name));
151 if (!ai)
152 {
153 ai = ActionInput.Cast(input_type_name.Spawn());
154 m_RegistredInputsMap.Insert(input_type_name, ai);
155 }
156 action.SetInput(ai);
157 }
158
159 for (int j = 0; j < m_RegistredInputsMap.Count(); j++)
160 {
161 m_RegistredInputsMap.GetElement(j).Init(player, this);
162 }
164 }
165
166 }
167
168 //Set order of inputs base of priority (output -> m_OrederedAllActionInput)
170 {
171 int i, j;
172 int priority;
173 ActionInput input;
175
177 array<int> array_of_priorities_to_sort = new array<int>;
178 ref array<ActionInput> same_priority_input_array;
179
180 for (i = 0; i < m_RegistredInputsMap.Count(); i++)
181 {
182 input = m_RegistredInputsMap.GetElement(i);
183 priority = input.GetPriority();
184 same_priority_input_array = temp_map_for_sort.Get(priority);
185 if (same_priority_input_array)
186 {
187 same_priority_input_array.Insert(input);
188 continue;
189 }
190
191 same_priority_input_array = new array<ActionInput>;
192 same_priority_input_array.Insert(input);
193 temp_map_for_sort.Insert(priority,same_priority_input_array);
194 array_of_priorities_to_sort.Insert(priority);
195 }
196 array_of_priorities_to_sort.Sort();
197
198 for (i = 0; i < array_of_priorities_to_sort.Count(); i++)
199 {
200 priority = array_of_priorities_to_sort[i];
201 same_priority_input_array = temp_map_for_sort.Get(priority);
202 for (j = 0; j < same_priority_input_array.Count(); j++)
203 {
204 input = same_priority_input_array.Get(j);
205 m_OrederedAllActionInput.Insert(input);
206 }
207 }
208
210 }
211
212 //Order for user action inputs - will be dynamically change base on context (more complex handling viz set m_OrderedStandartActionInputs in UpdateActionCategoryPriority())
214 {
215 int i, j;
219 if (input)
220 {
221 m_OrderedStandartActionInputs.Insert(input);
222 }
223
225 if (input)
226 {
227 m_OrderedStandartActionInputs.Insert(input);
228 }
229
231 if (input)
232 {
233 m_OrderedStandartActionInputs.Insert(input);
234 }
235
237 if (input)
238 {
239 m_OrderedStandartActionInputs.Insert(input);
240 }
241
242 for (i = 0; i < m_OrederedAllActionInput.Count(); i++)
243 {
244 for (j = 0; j < m_OrderedStandartActionInputs.Count(); j++)
245 {
247 {
249 break;
250 }
251 }
252 }
253 }
254
255 static ActionVariantManager GetVariantManager(typename actionName)
256 {
257 ActionBase action = GetAction(actionName);
258 if (action)
259 {
260 return action.GetVariantManager();
261 }
262 //VME ACTION not exist typo most likely
263 return null;
264 }
265
266 override void RequestEndAction()
267 {
269 {
271 }
272 }
273
274 override void EndActionInput()
275 {
277 {
279 }
280 }
281
283 {
284 ActionInput ain;
286 {
288 {
289 ActionInput ai = m_CurrentActionData.m_Action.GetInput();
290 ai.Update();
291 if (m_Player.IsQBControl())
292 {
293 if (ai.JustActivate())
294 m_Player.SetActionEndInput(m_CurrentActionData.m_Action);
295 }
296 else
297 {
298 if (ai.WasEnded() && (ai.GetInputType() == ActionInputType.AIT_CONTINUOUS || ai.GetInputType() == ActionInputType.AIT_CLICKCONTINUOUS) && !m_IgnoreAutoInputEnd)
299 {
301 }
302 }
303 }
304 }
305 else
306 {
308 {
309 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
310 {
311
313 ain.Update();
314
315 if (ain.JustActivate())
316 {
317 ActionBase action = ain.GetAction();
318 if (action)
319 {
320 ActionStart(action, ain.GetUsedActionTarget(), ain.GetUsedMainItem());
321 break;
322 }
323 }
324 }
325 }
326 }
327 }
328
330 {
332 {
333 if (GetGame().IsMultiplayer() && !m_CurrentActionData.m_Action.IsLocal())
334 {
336 {
338 {
339 Debug.ActionLog("Time stamp: " + m_Player.GetSimulationTimeStamp(), m_CurrentActionData.m_Action.ToString() , "n/a", "EndRequest", m_CurrentActionData.m_Player.ToString());
340 }
343 ctx.Send();
344
346
348 m_CurrentActionData.m_Action.EndRequest(m_CurrentActionData);
349 }
350 }
351 else
352 {
354 m_CurrentActionData.m_Action.EndRequest(m_CurrentActionData);
355 }
356 }
357 }
358
360 {
362 {
363 if (GetGame().IsMultiplayer() && !m_CurrentActionData.m_Action.IsLocal())
364 {
366 {
368 {
369 Debug.ActionLog("Time stamp: " + m_Player.GetSimulationTimeStamp(), m_CurrentActionData.m_Action.ToString() , "n/a", "EndInput", m_CurrentActionData.m_Player.ToString());
370 }
373 ctxi.Send();
374
376
377 m_ActionInputWantEnd = false;
378 m_CurrentActionData.m_Action.EndInput(m_CurrentActionData);
379 }
380 }
381 else
382 {
384 {
386 m_ActionInputWantEnd = false;
387 m_CurrentActionData.m_Action.EndInput(m_CurrentActionData);
388 }
389 }
390 }
391 }
392
393 ActionBase GetPossibleAction(typename inputType)
394 {
395 ActionInput action_input = m_RegistredInputsMap.Get(inputType);
396 if (action_input)
397 {
398 return action_input.GetAction();
399 }
400 return NULL;
401 }
402
404 {
405 ActionInput action_input = m_RegistredInputsMap.Get(inputType);
406 if (action_input)
407 {
408 return action_input.GetPossibleActions();
409 }
410 return NULL;
411 }
412
413 int GetPossibleActionIndex(typename inputType)
414 {
415 ActionInput action_input = m_RegistredInputsMap.Get(inputType);
416 if (action_input)
417 {
418 return action_input.GetPossibleActionIndex();
419 }
420 return -1;
421 }
422
423 int GetPossibleActionCount(typename inputType)
424 {
425 ActionInput action_input = m_RegistredInputsMap.Get(inputType);
426 if (action_input)
427 {
428 return action_input.GetPossibleActionsCount();
429 }
430 return 0;
431 }
432
433 //--------------------------------------------------------
434 // Alows to set different action to current contextual one
435 //--------------------------------------------------------
436 void InjectAction(ActionBase action, ActionTarget target, ItemBase item)
437 {
438 ActionInput ai = action.GetInput();
439 ai.ForceAction(action, target, item);
440 }
441
442 void InjectAction(typename actionType, ActionTarget target, ItemBase item)
443 {
444 ActionBase action = GetAction(actionType);
445 InjectAction(action, target, item);
446 }
447
449 {
450 ActionInput ai = action.GetInput();
452 }
453
454 void EjectAction(typename actionType)
455 {
456 ActionBase action = GetAction(actionType);
457 EjectAction(action);
458 }
459
460 void ForceTarget(Object targetObject)
461 {
462 Object parent = null;
463 EntityAI targetEntity = EntityAI.Cast(targetObject);
464 if (targetEntity)
465 parent = targetEntity.GetHierarchyParent();
466 m_ForceTarget = new ActionTarget(targetObject, parent, -1, vector.Zero, -1);
467 }
468
470 {
471 m_ForceTarget = NULL;
472 }
473
474
475 //-------------------------------------------------------------------------
477 {
478 if (m_ForceTarget)
479 return m_ForceTarget;
480
481 ActionTarget action_target;
482 action_target = NULL;
483 int targetsCount = m_Targets.GetTargetsCount();
484 if (targetsCount)
485 {
486 for (int i = 0; i < targetsCount; ++i)
487 {
488 action_target = m_Targets.GetTarget(i);
489 Object targetObject = action_target.GetObject();
490 Object targetParent = action_target.GetParent();
491 int surfaceLiquidType = action_target.GetSurfaceLiquidType();
492
493 if (targetParent)
494 {
495 break;
496 }
497
498 if (targetObject)
499 {
500 break;
501 }
502
503 if (surfaceLiquidType != LIQUID_NONE)
504 {
505 break;
506 }
507 }
508 }
509 else
510 {
511 action_target = new ActionTarget(null, null, -1, vector.Zero, -1);
512 }
513 return action_target;
514 }
515
517 {
518 ItemBase item;
519 if (m_Player && m_Player.GetItemInHands() && m_Player.GetItemInHands().IsItemBase())
520 {
521 item = m_Player.GetItemInHands();
522 }
523 return item;
524 }
525
527 {
528 m_HandInventoryLocationTest.SetHands(m_Player,m_Player.GetItemInHands());
529 if (m_Player.GetHumanInventory().HasInventoryReservation(m_Player.GetItemInHands(),m_HandInventoryLocationTest))
530 return true;
531 return false;
532 }
533
534 protected void FindContextualUserActions(int pCurrentCommandID)
535 {
536 // TODO: NEEDS OPTIMIZATION (focus on UpdatePossibleActions > CraftingManager::OnUpdate)
537
538 m_ActionsAvaibale = false;
539 if (!m_ActionPossible || HasHandInventoryReservation() || GetGame().IsInventoryOpen())
540 {
542 return;
543 }
544
545 if (!GetRunningAction())
546 {
547 ActionBase action;
548 ActionTarget target;
549 ItemBase item;
550
551 // Gathering current inputs
552 m_ActionsAvaibale = true;
553
554 item = FindActionItem();
555 target = FindActionTarget();
556
557 int actionConditionMask = ActionBase.ComputeConditionMask(m_Player,target,item);
558 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
559 {
561 ain.UpdatePossibleActions(m_Player,target,item, actionConditionMask);
562 }
563
565 SetActionContext(target,item);
566 }
567 }
568
569 //TOOD MW In progress
570 protected bool LockInventory(ActionData action_data)
571 {
572 bool success = false;
573 if (action_data.m_Action.IsInstant())
574 {
576 {
577 Debug.ActionLog("(-) Inventory lock - Not Used", action_data.m_Action.ToString() , "n/a", "LockInventory", action_data.m_Player.ToString());
578 }
579 success = true;
580 }
581 else
582 {
584 {
585 Debug.ActionLog("(X) Inventory lock", action_data.m_Action.ToString() , "n/a", "LockInventory", action_data.m_Player.ToString());
586 }
587 if (action_data.m_Action)
588 {
589 success = action_data.m_Action.InventoryReservation(action_data);
590 }
591 }
592 return success;
593 }
594 void UnlockInventory(ActionData action_data)
595 {
597 {
598 Debug.ActionLog("(O) Inventory unlock", action_data.m_Action.ToString() , "n/a", "UnlockInventory", action_data.m_Player.ToString());
599 }
600 if (action_data.m_Action)
601 action_data.m_Action.ClearInventoryReservationEx(action_data);
602 }
603
604 protected void ActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data = NULL)
605 {
606 if (!m_CurrentActionData && action && ActionPossibilityCheck(m_Player.GetCurrentCommandID()))
607 {
611 m_ActionInputWantEnd = false;
612
613 if (action.CanBePerformedFromQuickbar())
614 m_Player.SetActionEndInput(action);
615
617
619 {
620 if ( target )
621 {
622 Debug.ActionLog("Item = " + item + ", " + target.DumpToString(), action.ToString() , "n/a", "ActionStart", m_Player.ToString());
623 }
624 else
625 {
626 Debug.ActionLog("Item = " + item + ", no target", action.ToString() , "n/a", "ActionStart", m_Player.ToString());
627 }
628 }
629 m_Interrupted = false;
630 if (GetGame().IsMultiplayer() && !action.IsLocal())
631 {
633 {
634 DPrint("ScriptInputUserData already posted - ActionManagerClient");
635
637 {
638 Debug.ActionLog("Cannot start because ScriptInputUserData is already used", action.ToString() , "n/a", "ActionStart", m_Player.ToString());
639 }
640 return;
641 }
642 }
643
644 if (!action.SetupAction(m_Player, target, item, m_CurrentActionData, extra_data))
645 {
646 DPrint("Can not inicialize action" + action + " - ActionManagerClient");
647 m_CurrentActionData = NULL;
648 return;
649 }
650
652 {
653 Debug.ActionLog("Action data created wait to start", action.ToString() , "n/a", "ActionStart", m_Player.ToString());
654 }
655
656 if (GetGame().IsMultiplayer() && !action.IsLocal())
657 {
660 ctx.Write(action.GetID());
661
663
664 if (action.UseAcknowledgment())
665 {
668
670 }
671
672 ctx.Send();
673
674 if (!action.UseAcknowledgment())
675 {
677 if (action.IsInstant())
678 OnActionEnd();
679 }
680 }
681 else
682 {
684 if (action.IsInstant())
685 OnActionEnd();
686 }
687 }
688 }
689
691 {
692 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
693 {
695 if (action.GetInput() == ain)
696 {
697 ain.OnActionStart();
698 }
699 else
700 {
701 ain.Reset();
702 }
703 }
704 }
705
707 {
709 }
710
712 {
713 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
714 {
716 ain.Reset();
717 }
718 }
719
721 {
722 for (int i = 0; i < m_OrederedAllActionInput.Count();i++)
723 {
725 ain.ActionsSelectReset();
726 }
727 }
728
729 override void OnJumpStart()
730 {
732 }
733
735 {
737 {
739 {
740 OnActionEnd();
742 }
743 else
744 {
745 m_CurrentActionData.m_Action.Interrupt(m_CurrentActionData);
746 }
747 }
748 }
749
750 //Instant Action (Debug Actions) ---------------------------------
751 override void OnInstantAction(typename user_action_type, Param data = NULL)
752 {
753 ActionBase action = GetAction(user_action_type);
754 if (action)
755 {
756 ActionStart(action,NULL,NULL, data);
757 }
758 }
759
760#ifdef BOT
762 void PerformAction(int user_action_id, ActionTarget target, ItemBase item, Param extraData = NULL)
763 {
764 ActionStart(GetAction(user_action_id), target, item, extraData);
765 }
766#endif
767
768 void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data = NULL)
769 {
770 if (!GetGame().IsMultiplayer())
771 {
773
774 if (!action.SetupAction(m_Player,target,item,m_PendingActionData,extra_data))
775 m_PendingActionData = null;
776 }
777 else
778 ActionStart(action, target, item, extra_data);
779 }
780
781 override void OnActionEnd()
782 {
784 {
786 if (m_CurrentActionData.m_Action.RemoveForceTargetAfterUse())
787 m_InventoryActionHandler.DeactiveAction();
788
789 super.OnActionEnd();
791 }
792 }
793
794 void SetInventoryAction(ActionBase action_name, ItemBase target_item, ItemBase main_item)
795 {
796 m_InventoryActionHandler.SetAction(action_name, target_item, main_item);
797 }
798
799 void SetInventoryAction(ActionBase action_name, ActionTarget target, ItemBase main_item)
800 {
801 m_InventoryActionHandler.SetAction(action_name, target, main_item);
802 }
803
805 {
806 m_InventoryActionHandler.DeactiveAction();
807 }
808
813
815 {
816 int i;
817 int last_target_index = 0;
818 for (i = 0; i < m_DefaultOrderOfActionInputs.Count(); i++)
819 {
821 {
823 last_target_index++;
824 }
825 }
826
827 for (i = 0; i < m_DefaultOrderOfActionInputs.Count(); i++)
828 {
830 {
832 last_target_index++;
833 }
834 }
835 }
836
838 {
841
842 for (int index = 0; index < m_OrderedStandartActionInputs.Count(); index++)
843 {
845 {
847 break;
848 }
849 }
850 }
851
853 {
854 int index;
855
857 {
858 if (++index >= m_OrderedStandartActionInputs.Count())
859 {
860 index = 0;
861 }
863 {
865 break;
866 }
867 }
868 }
869
871 {
872 int index;
873
875 {
876 if (--index < 0)
877 {
878 index = m_OrderedStandartActionInputs.Count() - 1;
879 }
880
882 {
884 break;
885 }
886 }
887 }
888
889
890 override void SelectNextAction()
891 {
892 ActionInput ai;
894 {
896 if (ai && ai.GetPossibleActionsCount() > 1)
897 {
898 ai.SelectNextAction();
899 }
900 }
901 }
902
903 override void SelectPrevAction()
904 {
905 ActionInput ai;
907 {
909 if (ai && ai.GetPossibleActionsCount() > 1)
910 {
911 ai.SelectPrevAction();
912 }
913 }
914 }
915
917 {
918 ItemBase itemInHand = m_Player.GetItemInHands();
919 ActionTarget target;
920 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
921 bool hasTarget = targetItem != NULL;
922
923 if (mainItem)
924 {
926 ActionBase picked_action;
927 int i;
928
929 mainItem.GetActions(QuickaBarActionInput, actions);
930 if (actions)
931 {
932 for (i = 0; i < actions.Count(); i++)
933 {
934 picked_action = ActionBase.Cast(actions[i]);
935 if (picked_action && picked_action.Can(m_Player,target, itemInHand))
936 {
937 if (hasTarget == picked_action.HasTarget())
938 return true;
939 }
940 }
941 }
942 //First check continuous actions
943 mainItem.GetActions(ContinuousDefaultActionInput, actions);
944 if (actions)
945 {
946 for (i = 0; i < actions.Count(); i++)
947 {
948 picked_action = ActionBase.Cast(actions[i]);
949 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
950 {
951 if (hasTarget == picked_action.HasTarget())
952 return true;
953 }
954 }
955 }
956 //second single use actions
957 mainItem.GetActions(DefaultActionInput, actions);
958 if (actions)
959 {
960 for (i = 0; i < actions.Count(); i++)
961 {
962 picked_action = ActionBase.Cast(actions[i]);
963 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
964 {
965 if (hasTarget == picked_action.HasTarget())
966 return true;
967 }
968 }
969 }
970 }
971 return false;
972 }
973
974 void PerformActionFromQuickbar(ItemBase mainItem, ItemBase targetItem)
975 {
976 ItemBase itemInHand = m_Player.GetItemInHands();
977 ActionTarget target;
978 ItemBase parent = null;
979 if (targetItem)
980 parent = ItemBase.Cast(targetItem.GetHierarchyParent());
981 target = new ActionTarget(targetItem, parent, -1, vector.Zero, -1);
982 bool hasTarget = targetItem != NULL;
983
984 if (mainItem)
985 {
986 ActionBase picked_action;
988 int i;
989
990 mainItem.GetActions(QuickaBarActionInput, actions);
991 if (actions)
992 {
993 for (i = 0; i < actions.Count(); i++)
994 {
995 picked_action = ActionBase.Cast(actions[i]);
996 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player,target, itemInHand))
997 {
998 if (hasTarget == picked_action.HasTarget())
999 {
1000 ActionStart(picked_action, target, mainItem);
1001 return;
1002 }
1003 }
1004 }
1005 }
1006
1007 //First continuous actions
1008 mainItem.GetActions(ContinuousDefaultActionInput, actions);
1009 if (actions)
1010 {
1011 for (i = 0; i < actions.Count(); i++)
1012 {
1013 picked_action = ActionBase.Cast(actions[i]);
1014 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
1015 {
1016 if (hasTarget == picked_action.HasTarget())
1017 {
1018 ActionStart(picked_action, target, mainItem);
1019 return;
1020 }
1021 }
1022 }
1023 }
1024 //Second check single use actions
1025 mainItem.GetActions(DefaultActionInput, actions);
1026 if (actions)
1027 {
1028 for (i = 0; i < actions.Count(); i++)
1029 {
1030 picked_action = ActionBase.Cast(actions[i]);
1031 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromQuickbar())
1032 {
1033 if (hasTarget == picked_action.HasTarget())
1034 {
1035 ActionStart(picked_action, target, mainItem);
1036 return;
1037 }
1038 }
1039 }
1040 }
1041
1042 }
1043 }
1044
1045 //TODO Variants support ???
1047 {
1048 ItemBase itemInHand = m_Player.GetItemInHands();
1049 ActionTarget target;
1050 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
1051 bool hasTarget = targetItem != NULL;
1052
1053 if (mainItem)
1054 {
1056 ActionBase picked_action;
1057 int i;
1058
1059 //First check single use actions
1060 mainItem.GetActions(DefaultActionInput, actions);
1061 if (actions)
1062 {
1063 for (i = 0; i < actions.Count(); i++)
1064 {
1065 picked_action = ActionBase.Cast(actions[i]);
1066 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromInventory())
1067 {
1068 if (hasTarget == picked_action.HasTarget())
1069 return true;
1070 }
1071 }
1072 }
1073
1074 //Inventory specific actions
1075 mainItem.GetActions(InventoryOnlyActionInput, actions);
1076 if (actions)
1077 {
1078 for (i = 0; i < actions.Count(); i++)
1079 {
1080 picked_action = ActionBase.Cast(actions[i]);
1081 if (picked_action && picked_action.Can(m_Player,target, itemInHand))
1082 {
1083 if (hasTarget == picked_action.HasTarget())
1084 return true;
1085 }
1086 }
1087 }
1088 }
1089 return false;
1090 }
1091
1092 //TODO Variants support ???
1094 {
1095 ItemBase itemInHand = m_Player.GetItemInHands();
1096 ActionTarget target;
1097 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
1098 bool hasTarget = targetItem != NULL;
1099
1100 if (mainItem)
1101 {
1102 ActionBase picked_action;
1104 int i;
1105
1106 //First check single use actions
1107 mainItem.GetActions(DefaultActionInput, actions);
1108 if (actions)
1109 {
1110 for (i = 0; i < actions.Count(); i++)
1111 {
1112 picked_action = ActionBase.Cast(actions[i]);
1113 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBePerformedFromInventory())
1114 {
1115 if (hasTarget == picked_action.HasTarget())
1116 {
1117 ActionStart(picked_action, target, mainItem);
1118 return;
1119 }
1120 }
1121 }
1122 }
1123
1124 //Inventory specific actions
1125 mainItem.GetActions(InventoryOnlyActionInput, actions);
1126 if (actions)
1127 {
1128 for (i = 0; i < actions.Count(); i++)
1129 {
1130 picked_action = ActionBase.Cast(actions[i]);
1131 if (picked_action && picked_action.Can(m_Player,target, itemInHand))
1132 {
1133 if (hasTarget == picked_action.HasTarget())
1134 {
1135 ActionStart(picked_action, target, mainItem);
1136 return;
1137 }
1138 }
1139 }
1140 }
1141 }
1142 }
1143
1145 {
1146 ItemBase itemInHand = m_Player.GetItemInHands();
1147 ActionTarget target;
1148 EntityAI parent = null;
1149 if (targetItem)
1150 {
1151 parent = targetItem.GetHierarchyParent();
1152 }
1153 target = new ActionTarget(targetItem, parent, -1, vector.Zero, -1);
1154 bool hasTarget = targetItem != NULL;
1155
1156 if (mainItem)
1157 {
1159 array<ref ActionBase> variant_actions;
1160 ActionBase picked_action;
1161 int variants_count,v;
1162
1163 //First check single use actions
1164 mainItem.GetActions(DefaultActionInput, actions);
1165 if (actions)
1166 {
1167 for (int i = 0; i < actions.Count(); i++)
1168 {
1169 picked_action = ActionBase.Cast(actions[i]);
1170 if (picked_action.HasVariants())
1171 {
1172 picked_action.UpdateVariants(itemInHand, targetItem, -1);
1173 picked_action.GetVariants(variant_actions);
1174 for (v = 0; v < variant_actions.Count(); v ++)
1175 {
1176 picked_action = variant_actions[v];
1177 if (picked_action && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player,target, itemInHand))
1178 {
1179 if (hasTarget == picked_action.HasTarget())
1180 return true;
1181 }
1182 }
1183 }
1184 else
1185 {
1186 if (picked_action && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player,target, itemInHand))
1187 {
1188 if (hasTarget == picked_action.HasTarget())
1189 return true;
1190 }
1191 }
1192 }
1193 }
1194 //second continuous actions
1195 mainItem.GetActions(ContinuousDefaultActionInput, actions);
1196 if (actions)
1197 {
1198 for (int j = 0; j < actions.Count(); j++)
1199 {
1200 picked_action = ActionBase.Cast(actions[j]);
1201 if (picked_action.HasVariants())
1202 {
1203 picked_action.UpdateVariants(itemInHand, targetItem, -1);
1204 picked_action.GetVariants(variant_actions);
1205 for (v = 0; v < variant_actions.Count(); v ++)
1206 {
1207 picked_action = variant_actions[v];
1208 if (picked_action && picked_action.HasTarget() && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player,target, itemInHand))
1209 {
1210 if (hasTarget == picked_action.HasTarget())
1211 return true;
1212 }
1213 }
1214 }
1215 else
1216 {
1217 if (picked_action && picked_action.HasTarget() && picked_action.CanBeSetFromInventory() && picked_action.Can(m_Player,target, itemInHand))
1218 {
1219 if (hasTarget == picked_action.HasTarget())
1220 return true;
1221 }
1222 }
1223 }
1224 }
1225 }
1226 return false;
1227 }
1228
1229 //TODO fix for variants
1230 void SetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
1231 {
1232 ItemBase itemInHand = m_Player.GetItemInHands();
1233 ActionTarget target;
1234 target = new ActionTarget(targetItem, null, -1, vector.Zero, -1);
1235 bool hasTarget = targetItem != NULL;
1236
1237 if (mainItem)
1238 {
1240 ActionBase picked_action;
1241
1242 //First check single use actions
1243 mainItem.GetActions(DefaultActionInput, actions);
1244 if (actions)
1245 {
1246 for (int i = 0; i < actions.Count(); i++)
1247 {
1248 picked_action = ActionBase.Cast(actions[i]);
1249 if (picked_action && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBeSetFromInventory())
1250 {
1251 if (hasTarget == picked_action.HasTarget())
1252 {
1253 SetInventoryAction(picked_action, target, itemInHand);
1254 return;
1255 }
1256 }
1257 }
1258 }
1259 //second continuous actions
1260 mainItem.GetActions(ContinuousDefaultActionInput, actions);
1261 if (actions)
1262 {
1263 for (int j = 0; j < actions.Count(); j++)
1264 {
1265 picked_action = ActionBase.Cast(actions[j]);
1266 if (picked_action && picked_action.HasTarget() && picked_action.Can(m_Player,target, itemInHand) && picked_action.CanBeSetFromInventory())
1267 {
1268 if (hasTarget == picked_action.HasTarget())
1269 {
1270 SetInventoryAction(picked_action, target, itemInHand);
1271 return;
1272 }
1273 }
1274 }
1275 }
1276 }
1277 }
1278
1279 // disables automatic end of continuous action when input ended
1281 {
1282 m_IgnoreAutoInputEnd = state;
1283 }
1284
1287 {
1289 {
1292 ctx.Write(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
1293 ctx.Send();
1294 }
1295 }
1296
1299};
const int INPUT_UDT_STANDARD_ACTION_END_REQUEST
const int INPUT_UDT_STANDARD_ACTION_START
const int INPUT_UDT_STANDARD_ACTION_INPUT_END
ActionBase ActionData
Определения ActionBase.c:30
void ContinuousDefaultActionInput(PlayerBase player)
Определения ActionInput.c:607
override ActionBase GetAction()
Определения ActionInput.c:483
ActionInputType
Определения ActionInput.c:2
override int GetPossibleActionsCount()
Определения ActionInput.c:468
override bool HasTarget()
Определения ActionInput.c:473
bool m_Interrupted
Определения ActionManagerBase.c:49
ref ActionData m_CurrentActionData
Определения ActionManagerBase.c:61
void SetActionContext(ActionTarget target, ItemBase item)
Определения ActionManagerBase.c:255
bool m_ActionsAvaibale
Определения ActionManagerBase.c:55
bool m_ActionInputWantEnd
Определения ActionManagerBase.c:53
bool ActionPossibilityCheck(int pCurrentCommandID)
Определения ActionManagerBase.c:244
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:121
map
Определения ControlsXboxNew.c:4
DayZPlayer m_Player
Определения Hand_Events.c:42
int GetVariants(out array< ref ActionBase > variants)
Определения ActionBase.c:964
int GetID()
Определения ActionBase.c:1360
bool HasVariants()
Определения ActionBase.c:951
void UpdateVariants(Object item, Object target, int componet_index)
Определения ActionBase.c:982
bool CanBePerformedFromInventory()
Определения ActionBase.c:308
bool HasTarget()
Определения ActionBase.c:244
void Start(ActionData action_data)
Определения ActionBase.c:761
bool CanBePerformedFromQuickbar()
Определения ActionBase.c:303
bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
Определения ActionBase.c:897
bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
Определения ActionBase.c:156
bool UseAcknowledgment()
Определения ActionBase.c:1162
void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
Определения ActionBase.c:432
ActionVariantManager GetVariantManager()
Определения ActionBase.c:990
bool IsInstant()
Определения ActionBase.c:262
bool CanBeSetFromInventory()
Определения ActionBase.c:319
GetInputType()
Определения ActionBase.c:215
ActionInput GetInput()
Определения ActionBase.c:1350
void SetInput(ActionInput ai)
Определения ActionBase.c:220
bool IsLocal()
Определения ActionBase.c:256
static int ComputeConditionMask(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionBase.c:843
Определения ActionBase.c:53
int GetPossibleActionsCount()
Определения ActionInput.c:274
void ActionsSelectReset()
Определения ActionInput.c:227
void UpdatePossibleActions(PlayerBase player, ActionTarget target, ItemBase item, int action_condition_mask)
Определения ActionInput.c:178
void Update()
Определения ActionInput.c:114
array< ActionBase > GetPossibleActions()
Определения ActionInput.c:197
void OnActionStart()
Определения ActionInput.c:217
void SelectPrevAction()
Определения ActionInput.c:271
void ClearForcedAction()
Определения ActionInput.c:243
void SelectNextAction()
Определения ActionInput.c:267
int GetPossibleActionIndex()
Определения ActionInput.c:207
ActionBase GetAction()
Определения ActionInput.c:182
int GetPriority()
Определения ActionInput.c:284
bool WasEnded()
Определения ActionInput.c:109
int GetInputType()
Определения ActionInput.c:89
void ForceAction(ActionBase action, ActionTarget target, ItemBase item)
Определения ActionInput.c:230
ItemBase GetUsedMainItem()
Определения ActionInput.c:192
ActionTarget GetUsedActionTarget()
Определения ActionInput.c:187
bool JustActivate()
Определения ActionInput.c:99
void Reset()
Определения ActionInput.c:172
Определения ActionInput.c:20
override void SelectNextAction()
Определения ActionManagerClient.c:890
void SetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1230
ref array< ActionInput > m_OrderedStandartActionInputs
Определения ActionManagerClient.c:15
override void SelectFirstActionCategory()
Определения ActionManagerClient.c:837
bool CanPerformActionFromQuickbar(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:916
void EjectAction(typename actionType)
Определения ActionManagerClient.c:454
void RegisterInputs(PlayerBase player)
Определения ActionManagerClient.c:138
void SetDefaultInputsOrder()
Определения ActionManagerClient.c:213
int GetPossibleActionCount(typename inputType)
Определения ActionManagerClient.c:423
array< ActionBase > GetPossibleActions(typename inputType)
Определения ActionManagerClient.c:403
override void OnActionEnd()
Определения ActionManagerClient.c:781
void ProcessActionRequestEnd()
Определения ActionManagerClient.c:329
ActionBase GetPossibleAction(typename inputType)
Определения ActionManagerClient.c:393
void SetInventoryAction(ActionBase action_name, ItemBase target_item, ItemBase main_item)
Определения ActionManagerClient.c:794
void ClearForceTarget()
Определения ActionManagerClient.c:469
void ActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
Определения ActionManagerClient.c:604
override GetSelectedActionCategory()
Определения ActionManagerClient.c:809
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:169
void InjectAction(ActionBase action, ActionTarget target, ItemBase item)
Определения ActionManagerClient.c:436
override ActionTarget FindActionTarget()
Определения ActionManagerClient.c:476
void PerformActionFromQuickbar(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:974
override void SelectNextActionCategory()
Определения ActionManagerClient.c:852
void SetInventoryAction(ActionBase action_name, ActionTarget target, ItemBase main_item)
Определения ActionManagerClient.c:799
override void RequestInterruptAction()
client requests action interrupt
Определения ActionManagerClient.c:1286
bool LockInventory(ActionData action_data)
Определения ActionManagerClient.c:570
void FindContextualUserActions(int pCurrentCommandID)
Определения ActionManagerClient.c:534
void HandleInputsOnActionEnd()
Определения ActionManagerClient.c:706
void UnlockInventory(ActionData action_data)
Определения ActionManagerClient.c:594
override void EndOrInterruptCurrentAction()
Определения ActionManagerClient.c:734
void UnsetInventoryAction()
Определения ActionManagerClient.c:804
void InputsUpdate()
Определения ActionManagerClient.c:282
bool m_ActionWantEndRequest_Send
Определения ActionManagerClient.c:22
override void RequestEndAction()
Определения ActionManagerClient.c:266
void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
Определения ActionManagerClient.c:768
ref array< ActionInput > m_DefaultOrderOfActionInputs
Определения ActionManagerClient.c:16
ref array< ActionInput > m_OrederedAllActionInput
Определения ActionManagerClient.c:14
override void SelectPrevAction()
Определения ActionManagerClient.c:903
bool HasHandInventoryReservation()
Определения ActionManagerClient.c:526
override void OnJumpStart()
Определения ActionManagerClient.c:729
void InjectAction(typename actionType, ActionTarget target, ItemBase item)
Определения ActionManagerClient.c:442
ref ActionTargets m_Targets
Определения ActionManagerClient.c:1298
void ResetInputsActions()
Определения ActionManagerClient.c:720
void PerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1093
override void OnInstantAction(typename user_action_type, Param data=NULL)
Определения ActionManagerClient.c:751
override void EndActionInput()
Определения ActionManagerClient.c:274
ref InventoryLocation m_HandInventoryLocationTest
Определения ActionManagerClient.c:12
override void Update(int pCurrentCommandID)
Определения ActionManagerClient.c:41
void ForceTarget(Object targetObject)
Определения ActionManagerClient.c:460
ref ActionTarget m_ForceTarget
Определения ActionManagerClient.c:1297
void HandleInputsOnActionStart(ActionBase action)
Определения ActionManagerClient.c:690
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1046
void UpdateActionCategoryPriority()
Определения ActionManagerClient.c:814
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:359
int m_LastAcknowledgmentID
Определения ActionManagerClient.c:8
static ActionVariantManager GetVariantManager(typename actionName)
Определения ActionManagerClient.c:255
void EjectAction(ActionBase action)
Определения ActionManagerClient.c:448
int GetPossibleActionIndex(typename inputType)
Определения ActionManagerClient.c:413
ref ActionData m_PendingActionData
Определения ActionManagerClient.c:20
override void SelectPrevActionCategory()
Определения ActionManagerClient.c:870
ItemBase FindActionItem()
Определения ActionManagerClient.c:516
bool m_ActionInputWantEnd_Send
Определения ActionManagerClient.c:23
void SetIgnoreAutomaticInputEnd(bool state)
Определения ActionManagerClient.c:1280
void ResetInputsState()
Определения ActionManagerClient.c:711
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1144
Определения ActionTargets.c:204
proto native UIManager GetUIManager()
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/tools/Debug.c:127
Определения 3_Game/tools/Debug.c:2
static bool IsFreeCameraEnabledNoPlayerMovement()
Определения DeveloperFreeCamera.c:28
Client only - manage set up crafting on client.
Определения InventoryActionHandler.c:3
InventoryLocation.
Определения InventoryLocation.c:29
static bool IsActionLogEnable()
Определения 3_Game/tools/Debug.c:638
Определения 3_Game/tools/Debug.c:594
Определения 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)
bool IsMenuOpen(int id)
Returns true if menu with specific ID is opened (see MenuID)
Определения UIManager.c:154
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static const vector Zero
Определения EnConvert.c:110
Определения EnConvert.c:106
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()
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 LIQUID_NONE
Определения 3_Game/constants.c:529
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
const int UA_START
Определения 3_Game/constants.c:469
const int UA_AM_ACCEPTED
Определения 3_Game/constants.c:477
const int UA_AM_REJECTED
Определения 3_Game/constants.c:478
const int UA_AM_PENDING
Определения 3_Game/constants.c:476
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
Определения ActionManagerBase.c:91