DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionBase.c
Go to the documentation of this file.
2{
13}
14class ActionReciveData
15{
18}
19
21{
23 {
25 }
26
41}
42
44{
45 //STATIC DATA
46 protected int m_RefreshReservationTimerValue = 140;
47 // Configurable action parameters
48 protected string m_Sound; //sound played at the beggining of action
49 protected string m_Text;
50
51 protected bool m_LockTargetOnUse; //this parameter sets wheter player can perform actions on target while other player is already performing action on it. defaulted as true
52 protected bool m_FullBody; //tells whether action is full body or additive
53 protected int m_StanceMask;
54 protected ref TStringArray m_Sounds; //User action sound is picked from this array randomly
55 ref CCIBase m_ConditionItem; //Condition Component
56 ref CCTBase m_ConditionTarget; //Condition Component
58 protected int m_ActionID;
59 protected int m_VariantID;
62
63 //RUNTIME DATA
64 protected ref Param1<string> m_MessageParam; //used for passing messages from server to client
65 //protected ref Param2<int,int> m_MessagesParam;
66
67 //SOFT SKILLS
68 protected float m_SpecialtyWeight;
69
70 //-----------------------------------------------------
71 // Action events and methods
72 //-----------------------------------------------------
73 void ActionBase()
74 {
75 // definable
76 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_PRONE;
77 m_FullBody = false;
78 m_Sound = "";
79 m_Text = "default action text";
81 // dont override
82 m_MessageParam = new Param1<string>("");
83 //m_MessagesParam = new Param2<int,int>(0,0);
85 m_Input = null;
86 m_ActionID = 0;
88 }
89
91 {
92 return m_LockTargetOnUse;
93 }
94
96 {
97 m_ConditionMask = ActionConditionMask.ACM_NO_EXEPTION;
99 {
100 m_ConditionMask |= ActionConditionMask.ACM_IN_VEHICLE;
101 }
102
103 if (CanBeUsedOnLadder())
104 {
105 m_ConditionMask |= ActionConditionMask.ACM_ON_LADDER;
106 }
107
108 if (CanBeUsedSwimming())
109 {
110 m_ConditionMask |= ActionConditionMask.ACM_SWIMMING;
111 }
112
114 {
115 m_ConditionMask |= ActionConditionMask.ACM_RESTRAIN;
116 }
117
118 if (CanBeUsedRaised())
119 {
121 }
122
123 if (CanBeUsedOnBack())
124 {
126 }
127
128 if (CanBeUsedThrowing())
129 {
130 m_ConditionMask |= ActionConditionMask.ACM_THROWING;
131 }
132
133 if (CanBeUsedLeaning())
134 {
136 }
137
139 {
140 m_ConditionMask |= ActionConditionMask.ACM_BROKEN_LEGS;
141 }
142 }
143
144 bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL )
145 {
146 action_data = CreateActionData();
147 action_data.m_Action = this;
148 action_data.m_Player = player;
149 action_data.m_Target = target;
150 action_data.m_MainItem = item;
151 action_data.m_PossibleStanceMask = GetStanceMask(player);
152 action_data.m_ReservedInventoryLocations = new array<ref InventoryLocation>;
153 action_data.m_RefreshReservationTimer = m_RefreshReservationTimerValue;
154 action_data.m_WasExecuted = false;
155 action_data.m_WasActionStarted = false;
156 action_data.m_ReciveEndInput = false;
157
158 ActionReciveData action_recive_data = player.GetActionManager().GetReciveData();
159 if ( action_recive_data )
160 {
161 HandleReciveData(action_recive_data,action_data);
162
164 {
165 if ( player.GetItemInHands() != action_data.m_MainItem )
166 {
167 return false;
168 }
169 }
170 }
171
172 if ( !Post_SetupAction( action_data ) )
173 return false;
174
175 if ( (!GetGame().IsDedicatedServer()) && !IsInstant() )
176 {
177 if (!InventoryReservation(action_data))
178 {
179 ClearInventoryReservationEx(action_data);
180 return false;
181 }
182
184 {
185 for ( int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
186 {
187 Debug.ActionLog( InventoryLocation.DumpToStringNullSafe( action_data.m_ReservedInventoryLocations[i] ), action_data.m_Action.ToString() , "n/a", "LockInventoryList", action_data.m_Player.ToString() );
188 }
189 }
190 }
191
192 return true;
193 }
194
195 bool Post_SetupAction( ActionData action_data )
196 {
197 return true;
198 }
199
200 void ActionCleanup( ActionData action_data )
201 {}
202
203 typename GetInputType()
204 {
205 return DefaultActionInput;
206 }
207
209 {
210 m_Input = ai;
211 }
212
214 {
215 return new ActionData;
216 }
217
218 void CreateConditionComponents() //Instantiates components, called once from ActionManager on actions construction
219 {
222 }
223
225 {
226 return null;
227 }
228
233 {
234 return true;
235 }
236
239 {
240 return true;
241 }
242
243 //Action isn't synchronize to server
244 bool IsLocal()
245 {
246 return false;
247 }
248
249 //Action not using animation/callback action are executed instantly (OnStart)
251 {
252 return false;
253 }
254
257 {
258 return false;
259 }
260
262 {
263 return true;
264 }
265
267 {
268 return AC_UNCATEGORIZED;
269 }
270
271 bool IsEat()
272 {
273 return false;
274 }
275
276 bool IsDrink()
277 {
278 return false;
279 }
280
282 {
283 return false;
284 }
285
286 string GetText() //text game displays in HUD hint
287 {
288 return m_Text;
289 }
290
292 {
293 return false;
294 }
295
297 {
298 return false;
299 }
300
302 {
304 }
305
307 {
308 return false;
309 }
310
312 {
313 return false;
314 }
315
317 {
318 return false;
319 }
320
322 {
323 return false;
324 }
325
327 {
328 return false;
329 }
330
332 {
333 return false;
334 }
335
337 {
338 return false;
339 }
340
342 {
343 return true;
344 }
345
347 {
348 return true;
349 }
350
353 {
354 return false;
355 }
356
358 {
359 return true;
360 }
361
363 {
364 return true;
365 }
366
367 protected bool ActionConditionContinue( ActionData action_data ) //condition for action
368 {
369 return ActionCondition(action_data.m_Player,action_data.m_Target,action_data.m_MainItem);
370 }
371
372 protected bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item ) //condition for action
373 {
374 return true;
375 }
376
377 void ApplyModifiers(ActionData action_data);
378
380 {
382 }
383
385 {
386 int componentIndex = -1;
387 int proxyBoneIdx = -1;
388 vector cursorHitPos = vector.Zero;
389
390 array<string> selectionNames = new array<string>();
391
392 Object targetObject = null;
393 Object targetParent = null;
394
395 if (UseMainItem())
396 {
397 ctx.Write(action_data.m_MainItem);
398 }
399
400 if (HasTarget() && !IsUsingProxies())
401 {
402 // callback data
403 targetObject = action_data.m_Target.GetObject();
404 ctx.Write(targetObject);
405 targetParent = action_data.m_Target.GetParent();
406 ctx.Write(targetParent);
407 componentIndex = action_data.m_Target.GetComponentIndex();
408 ctx.Write(componentIndex);
409 cursorHitPos = action_data.m_Target.GetCursorHitPos();
410 ctx.Write(cursorHitPos);
411 }
412 else if( HasTarget() && IsUsingProxies() )
413 {
416 Entity entParent = Entity.Cast(action_data.m_Target.GetParent());
417 if (entParent)
418 {
419 action_data.m_Target.GetObject().GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selectionNames);
420 for (int s = 0; s < selectionNames.Count(); s++)
421 {
422 proxyBoneIdx = entParent.GetBoneIndex(selectionNames[s]);
423 if( proxyBoneIdx > -1 )
424 {
425 break;
426 }
427 }
428 }
429
430 ctx.Write(proxyBoneIdx);
431 targetParent = action_data.m_Target.GetParent();
432 ctx.Write(targetParent);
433 componentIndex = action_data.m_Target.GetComponentIndex();
434 ctx.Write(componentIndex);
435 cursorHitPos = action_data.m_Target.GetCursorHitPos();
436 ctx.Write(cursorHitPos);
437 }
438 }
439
440 bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data )
441 {
442 if ( !action_recive_data )
443 {
444 action_recive_data = new ActionReciveData;
445 }
446 Object actionTargetObject = null;
447 Object actionTargetParent = null;
448 int componentIndex = -1;
449 int proxyBoneIdx = -1;
450 vector cursorHitPos = vector.Zero;
451 ItemBase mainItem = null;
452
453 ref ActionTarget target;
454
455 if ( UseMainItem() )
456 {
457 if ( !ctx.Read(mainItem) )
458 return false;
459 }
460
461 if ( HasTarget() && !IsUsingProxies() )
462 {
463 if ( !ctx.Read(actionTargetObject) )
464 return false;
465
466 if ( !ctx.Read(actionTargetParent))
467 return false;
468
469 if ( !ctx.Read(componentIndex) )
470 return false;
471
472 if ( !ctx.Read(cursorHitPos) )
473 return false;
474
475 target = new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0);
476
477 action_recive_data.m_Target = target;
478 }
479 else if( HasTarget() && IsUsingProxies() )
480 {
481 if ( !ctx.Read(proxyBoneIdx) )
482 return false;
483
484 if ( !ctx.Read(actionTargetParent))
485 return false;
486
487 if ( !ctx.Read(componentIndex) )
488 return false;
489
490 if ( !ctx.Read(cursorHitPos) )
491 return false;
492
494 if ( proxyBoneIdx > -1 )
495 {
496 Entity entParent = Entity.Cast(actionTargetParent);
497
498 if (entParent)
499 {
500 actionTargetObject = entParent.GetBoneObject(proxyBoneIdx);
501 }
502 }
503 else
504 {
505 return false;
506 }
507
508 target = new ActionTarget(actionTargetObject, actionTargetParent, componentIndex, cursorHitPos, 0);
509
510 action_recive_data.m_Target = target;
511 }
512
513 action_recive_data.m_MainItem = mainItem;
514 return true;
515 }
516
517 void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
518 {
519 action_data.m_MainItem = action_recive_data.m_MainItem;
520
521 if(HasTarget())
522 {
523 if (action_recive_data.m_Target)
524 {
525 action_data.m_Target = action_recive_data.m_Target;
526 }
527 else
528 {
529 Error("Action target not created.");
530 action_data.m_Target = new ActionTarget(NULL, NULL, -1, vector.Zero, 0);
531 }
532 }
533 }
534
535 //----------------------------------------------------------------------------------------------
536 // Core methods don't override unless you know what you are doing
537 //----------------------------------------------------------------------------------------------
538 // COMMANDS -----------------------------------------------------------------------
539 protected int GetStanceMask(PlayerBase player)
540 {
541 if ( HasProneException() )
542 {
543 if ( player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_RAISEDERECT | DayZPlayerConstants.STANCEMASK_RAISEDCROUCH | DayZPlayerConstants.STANCEMASK_RAISEDPRONE))
544 return -1;
545 else if ( player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT))
546 return DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
547 else
548 return DayZPlayerConstants.STANCEMASK_PRONE;
549 }
550 return m_StanceMask;
551 }
552
554 {
555 if ( HasProneException() )
556 {
557 return !( player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT) );
558 }
559 return m_FullBody;
560 }
561
562 // if it is set to true if action have special fullbody animation for prone and additive for crouch and erect
563 protected bool HasProneException()
564 {
565 return false;
566 }
567
568 // ACTION LOGIC -------------------------------------------------------------------
569 // called from actionmanager.c
570 void Start( ActionData action_data ) //Setup on start of action
571 {
572 action_data.m_State = UA_START;
573
575 {
576 Debug.ActionLog("Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "OnStart", action_data.m_Player.ToString() );
577 }
578
579 OnStart(action_data);
580
581 if ( GetGame().IsServer() )
582 {
583 OnStartServer(action_data);
584
585 if (GetSoundCategory(action_data))
586 action_data.m_Player.SetSoundCategoryHash(GetSoundCategory(action_data).Hash());
587 }
588 else
589 {
590 OnStartClient(action_data);
591 }
592
593 InformPlayers(action_data.m_Player,action_data.m_Target,UA_START);
594 }
595
596 void End( ActionData action_data )
597 {
598 if ( action_data.m_Player )
599 {
600 OnEnd(action_data);
601
602 if ( GetGame().IsServer() )
603 {
604 OnEndServer(action_data);
605 }
606 else
607 {
608 OnEndClient(action_data);
609 }
610
611 action_data.m_Player.GetActionManager().OnActionEnd();
612 }
613 }
614
615 void Interrupt(ActionData action_data)
616 {
617 End(action_data);
618 }
619
620 void OnEndInput(ActionData action_data)
621 {}
622
623 void EndInput(ActionData action_data)
624 {
625 action_data.m_ReciveEndInput = true;
626 OnEndInput(action_data);
627 }
628
629 void OnEndRequest(ActionData action_data)
630 {}
631
632 void EndRequest(ActionData action_data)
633 {
634 OnEndRequest(action_data);
635 }
636
638 {
639 bool result = true;
640 PlayerBase target_player = PlayerBase.Cast(target.GetObject());
641
642 if (target_player)
643 {
644 result = !target_player.IsJumpInProgress();
645 result = result && !(target_player.GetCommand_Ladder() || target_player.GetCommand_Vehicle() || target_player.GetCommand_Swim());
646 }
647
648 return result;
649 }
650
651 static int ComputeConditionMask( PlayerBase player, ActionTarget target, ItemBase item )
652 {
653 int mask = 0;
654 if ( player.GetCommand_Vehicle() )
655 {
656 mask |= ActionConditionMask.ACM_IN_VEHICLE;
657 }
658
659 if ( player.GetCommand_Ladder() )
660 {
661 mask |= ActionConditionMask.ACM_ON_LADDER;
662 }
663
664 if ( player.IsRestrained() )
665 {
666 mask |= ActionConditionMask.ACM_RESTRAIN;
667 }
668
669 if ( player.GetCommand_Swim() )
670 {
671 mask |= ActionConditionMask.ACM_SWIMMING;
672 }
673
674 if ( player.IsRaised() )
675 {
676 mask |= ActionConditionMask.ACM_RAISED;
677 }
678
679 if ( player.GetCommand_Move() && player.GetCommand_Move().IsOnBack() )
680 {
681 mask |= ActionConditionMask.ACM_ON_BACK;
682 }
683
684 if ( player.GetThrowing().IsThrowingModeEnabled())
685 {
686 mask |= ActionConditionMask.ACM_THROWING;
687 }
688
689 if (player.IsLeaning())
690 {
691 mask |= ActionConditionMask.ACM_LEANING;
692 }
693
694 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
695 {
696 mask |= ActionConditionMask.ACM_BROKEN_LEGS;
697 }
698
699 return mask;
700 }
701
702 bool Can( PlayerBase player, ActionTarget target, ItemBase item, int condition_mask )
703 {
704 if ( ( (condition_mask & m_ConditionMask) != condition_mask ) || ( !IsFullBody(player) && !player.IsPlayerInStance(GetStanceMask(player)) ) || player.IsRolling() )
705 return false;
706
707 if ( HasTarget() )
708 {
709 if(!FirearmActionBase.Cast(this))
710 {
711 EntityAI entity = EntityAI.Cast(target.GetObject());
712 if ( entity && !target.GetObject().IsMan() )
713 {
714 Man man = entity.GetHierarchyRootPlayer();
715 if ( man && man != player )
716 return false;
717 }
718 }
719
720 if ( m_ConditionTarget && !m_ConditionTarget.Can(player, target))
721 return false;
722 }
723
724 if ( m_ConditionItem && !m_ConditionItem.Can(player, item))
725 return false;
726
727 if ( !ActionCondition(player, target, item) )
728 return false;
729
730 if ( IsFullBody(player) )
731 {
732 int stanceIdx = DayZPlayerUtils.ConvertStanceMaskToStanceIdx(GetStanceMask(player));
733 if (stanceIdx != -1 && !DayZPlayerUtils.PlayerCanChangeStance(player, stanceIdx ))
734 return false;
735 }
736
737 return true;
738 }
739
740 bool Can(PlayerBase player, ActionTarget target, ItemBase item)
741 {
742 int condition_mask = ComputeConditionMask(player, target, item);
743
744 return Can( player, target, item, condition_mask);
745 }
746
747 protected bool CanContinue( ActionData action_data )
748 {
749 if (!action_data.m_Player.IsPlayerInStance(action_data.m_PossibleStanceMask) || !m_ConditionItem || !m_ConditionItem.CanContinue(action_data.m_Player,action_data.m_MainItem) || !m_ConditionTarget || !m_ConditionTarget.CanContinue(action_data.m_Player,action_data.m_Target))
750 return false;
751
752 return ActionConditionContinue(action_data);
753 }
754
756 {
757 return m_VariantManager != null;
758 }
759
761 {
764
765 return 0;
766 }
767
769 {
771 return m_VariantManager.GetActions(variants);
772
773 return 0;
774 }
775
776 void SetVariantID(int ID)
777 {
778 m_VariantID = ID;
779 }
780
782 {
783 return m_VariantID;
784 }
785
786 void UpdateVariants(Object item, Object target, int componet_index)
787 {
788 if ( m_VariantManager )
789 {
790 m_VariantManager.UpdateVariants(item, target, componet_index);
791 }
792 }
793
795 {
796 if ( !m_VariantManager )
798 return m_VariantManager;
799 }
800
801 // call only on client side for lock inventory before action
802 // return if has successfuly reserved inventory
804 {
805 if ((IsLocal() || !UseAcknowledgment()) && IsInstant())
806 return true;
807
808 //action_data.m_ReservedInventoryLocations = new array<ref InventoryLocation>;
809 bool success = true;
810 InventoryLocation targetInventoryLocation = NULL;
811 InventoryLocation handInventoryLocation = NULL;
812
813 // lock target if it has target
814 if (HasTarget())
815 {
816 ItemBase targetItem;
817 if ( ItemBase.CastTo(targetItem,action_data.m_Target.GetObject()) )
818 {
819 targetInventoryLocation = new InventoryLocation;
820 targetItem.GetInventory().GetCurrentInventoryLocation(targetInventoryLocation);
821 if ( action_data.m_Player.GetInventory().HasInventoryReservation( targetItem, targetInventoryLocation) )
822 {
823 success = false;
824 }
825 else
826 {
827 action_data.m_Player.GetInventory().AddInventoryReservationEx( targetItem, targetInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
828 }
829 }
830 }
831
832 handInventoryLocation = new InventoryLocation;
833 handInventoryLocation.SetHands(action_data.m_Player,action_data.m_Player.GetItemInHands());
834
835 if (action_data.m_Player.GetInventory().HasInventoryReservation( action_data.m_Player.GetItemInHands(), handInventoryLocation))
836 {
837 if (HasTarget())
838 {
839 action_data.m_Player.GetInventory().ClearInventoryReservation(targetItem, targetInventoryLocation);
840 }
841
842 success = false;
843 }
844 else
845 {
846 action_data.m_Player.GetInventory().AddInventoryReservationEx( action_data.m_Player.GetItemInHands(), handInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
847 }
848
849 if (success)
850 {
851 if (targetInventoryLocation)
852 action_data.m_ReservedInventoryLocations.Insert(targetInventoryLocation);
853
854 if (handInventoryLocation)
855 action_data.m_ReservedInventoryLocations.Insert(handInventoryLocation);
856 }
857
858 return success;
859 }
860
862 {
863 if (action_data.m_ReservedInventoryLocations)
864 {
866 for ( int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
867 {
868 il = action_data.m_ReservedInventoryLocations.Get(i);
869 EntityAI entity = il.GetItem();
870 action_data.m_Player.GetInventory().ClearInventoryReservationEx( il.GetItem() , il );
871 }
872
873 action_data.m_ReservedInventoryLocations.Clear();
874 }
875 }
876
878 {
879 if (action_data.m_ReservedInventoryLocations)
880 {
882 for (int i = 0; i < action_data.m_ReservedInventoryLocations.Count(); i++)
883 {
884 il = action_data.m_ReservedInventoryLocations.Get(i);
885 EntityAI entity = il.GetItem();
886 action_data.m_Player.GetInventory().ExtendInventoryReservationEx(il.GetItem() , il, 10000);
887 }
888 }
889 }
890
891 // action need first have permission from server before can start
893 {
894 return true;
895 }
896
898 protected void InformPlayers( PlayerBase player, ActionTarget target, int state );
899
900 void SendMessageToClient( Object reciever, string message ) //sends given string to client, don't use if not nescessary
901 {
902 PlayerBase man;
903 if (GetGame().IsServer() && Class.CastTo(man, reciever) && m_MessageParam && reciever.IsAlive() && message != "")
904 {
905 m_MessageParam.param1 = message;
906 GetGame().RPCSingleParam(man, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, man.GetIdentity());
907 }
908 }
909
910 // ActionCondition Rules
911 // ------------------------------------------------------
912 protected bool IsDamageDestroyed(ActionTarget target)
913 {
914 return target.GetObject() && target.GetObject().IsDamageDestroyed();
915 }
916
917 protected bool IsBuilding(ActionTarget target)
918 {
919 return target.GetObject() && target.GetObject().IsBuilding();
920 }
921
922 protected bool IsTransport(ActionTarget target)
923 {
924 return target.GetObject() && target.GetObject().IsTransport();
925 }
926
927 protected bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance = 1.0)
928 {
929 Object obj = target.GetObject();
930 if (!obj)
931 return false;
932
933 float distanceRoot, distanceHead;
934 vector modelPos, worldPos, playerHeadPos;
935
936 // we're using sq distance in comparison
937 maxDistance = maxDistance * maxDistance;
938
939 // get position of Head bone
940 MiscGameplayFunctions.GetHeadBonePos(player, playerHeadPos);
941
942 array<string> componentNames = new array<string>();
943 obj.GetActionComponentNameList(target.GetComponentIndex(), componentNames);
944 foreach (string componentName : componentNames)
945 {
946 if (componentName.Contains("doorstwin"))
947 continue;
948
949 modelPos = obj.GetSelectionPositionMS(componentName);
950 worldPos = obj.ModelToWorld(modelPos);
951
952 break;
953 }
954
955 distanceRoot = vector.DistanceSq(worldPos, player.GetPosition());
956 distanceHead = vector.DistanceSq(worldPos, playerHeadPos);
957
958 return distanceRoot <= maxDistance || distanceHead <= maxDistance;
959 }
960 // ------------------------------------------------------
961
962
963
964 // SOUNDS ------------------------------------------------------
965 SoundOnVehicle PlayActionSound( PlayerBase player )
966 {
967 if ( GetGame().IsServer() && player )
968 {
969 if ( m_Sound != "" )
970 {
971 return GetGame().CreateSoundOnObject(player, m_Sound, 6, false);
972 }
973 else if ( m_Sounds && m_Sounds.Count() > 0 )
974 {
975 int rand_num = Math.RandomInt(0, m_Sounds.Count());
976 return GetGame().CreateSoundOnObject(player, m_Sounds.Get(rand_num), 6, false);
977 }
978 }
979
980 return NULL;
981 }
982
984 {
985 }
986
987 //sound category matches with a soundtable category in config, selects correct soundset
988 string GetSoundCategory(ActionData action_data)
989 {
990 return "";
991 }
992
993 // EVENTS ------------------------------------------------
994 void OnUpdate(ActionData action_data)
995 {}
996
997 void OnUpdateClient(ActionData action_data)
998 {
999 if ( !GetGame().IsDedicatedServer() )
1000 {
1001 if (action_data.m_RefreshReservationTimer > 0)
1002 {
1003 action_data.m_RefreshReservationTimer--;
1004 }
1005 else
1006 {
1008 RefreshReservations(action_data);
1009 }
1010 }
1011 }
1012
1013 void OnUpdateServer(ActionData action_data)
1014 {}
1015
1016 void OnStart(ActionData action_data)
1017 {
1018 if (action_data.m_Player != NULL && action_data.m_Player.IsPlacingLocal() && !IsDeploymentAction())
1019 action_data.m_Player.PlacingCancelLocal();
1020 }
1021
1022 void OnStartClient(ActionData action_data)
1023 {}
1024
1025 void OnStartServer(ActionData action_data)
1026 {
1027
1028 }
1029
1030 void OnEnd(ActionData action_data)
1031 {
1032
1033 }
1034
1035 void OnEndClient(ActionData action_data)
1036 {}
1037
1038 void OnEndServer(ActionData action_data)
1039 {
1040 }
1041
1042 // SOFT SKILLS ------------------------------------------------
1044 {
1045 if(m_SpecialtyWeight == 0)
1046 {
1047#ifdef DEVELOPER
1048 //Print("UserAction does not use SoftSkills");
1049#endif
1050 }
1051
1052 return m_SpecialtyWeight;
1053 }
1054
1055 int GetState( ActionData action_data )
1056 {
1057 return action_data.m_State;
1058 }
1059
1060 float GetProgress( ActionData action_data )
1061 {
1062 return -1;
1063 }
1064
1066 {
1067 return m_Input;
1068 }
1069
1070 void SetID(int actionId)
1071 {
1072 m_ActionID = actionId;
1073 }
1074
1075 int GetID()
1076 {
1077 return m_ActionID;
1078 }
1079
1080 string GetAdminLogMessage(ActionData action_data)
1081 {
1082 return "";
1083 }
1084};
void OnUpdateServer(float deltatime, float blood_scale, bool no_blood_loss)
const int AC_UNCATEGORIZED
Definition _constants.c:1
ActionData CreateActionData()
Definition ActionBase.c:213
protected bool HasProneException()
Definition ActionBase.c:563
protected ActionInput m_Input
Definition ActionBase.c:57
void OnUpdateClient(ActionData action_data)
Definition ActionBase.c:997
bool InventoryReservation(ActionData action_data)
Definition ActionBase.c:803
bool CanBeSetFromInventory()
Definition ActionBase.c:301
protected ref ActionVariantManager m_VariantManager
Definition ActionBase.c:61
class ActionData m_RefreshReservationTimerValue
ActionVariantManager GetVariantManager()
Definition ActionBase.c:794
void CreateConditionComponents()
Definition ActionBase.c:218
protected ref Param1< string > m_MessageParam
Definition ActionBase.c:64
float GetSpecialtyWeight()
void OnEndServer(ActionData action_data)
ActionConditionMask
Definition ActionBase.c:2
@ ACM_THROWING
Definition ActionBase.c:10
@ ACM_NO_EXEPTION
Definition ActionBase.c:3
@ ACM_ON_LADDER
Definition ActionBase.c:5
@ ACM_SWIMMING
Definition ActionBase.c:6
@ ACM_RAISED
Definition ActionBase.c:8
@ ACM_LEANING
Definition ActionBase.c:11
@ ACM_IN_VEHICLE
Definition ActionBase.c:4
@ ACM_RESTRAIN
Definition ActionBase.c:7
@ ACM_ON_BACK
Definition ActionBase.c:9
@ ACM_BROKEN_LEGS
Definition ActionBase.c:12
void SendMessageToClient(Object reciever, string message)
Definition ActionBase.c:900
void ApplyModifiers(ActionData action_data)
int m_ConditionMask
Definition ActionBase.c:60
protected float m_SpecialtyWeight
Definition ActionBase.c:68
bool HasTarget()
Definition ActionBase.c:232
void OnEndInput(ActionData action_data)
Definition ActionBase.c:620
bool UseAcknowledgment()
Definition ActionBase.c:892
protected bool CanContinue(ActionData action_data)
Definition ActionBase.c:747
static int ComputeConditionMask(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionBase.c:651
protected bool m_LockTargetOnUse
Definition ActionBase.c:51
int GetVariantID()
Definition ActionBase.c:781
bool IsUsingProxies()
not using plane object - it's using multiple proxies
Definition ActionBase.c:256
string GetSoundCategory(ActionData action_data)
Definition ActionBase.c:988
enum ActionConditionMask m_MainItem
bool IsLockTargetOnUse()
Definition ActionBase.c:90
int GetActionCategory()
Definition ActionBase.c:266
bool MainItemAlwaysInHands()
Definition ActionBase.c:362
void OnStartClient(ActionData action_data)
bool CanBeUsedWithBrokenLegs()
Definition ActionBase.c:346
void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionBase.c:983
void RefreshReservations(ActionData action_data)
Definition ActionBase.c:877
int GetVariantsCount()
Definition ActionBase.c:760
GetInputType()
Definition ActionBase.c:203
bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
Definition ActionBase.c:702
protected int m_ActionID
Definition ActionBase.c:58
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
protected bool IsTransport(ActionTarget target)
Definition ActionBase.c:922
void OnStartServer(ActionData action_data)
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
SoundOnVehicle PlayActionSound(PlayerBase player)
Definition ActionBase.c:965
void SetVariantID(int ID)
Definition ActionBase.c:776
void UpdateVariants(Object item, Object target, int componet_index)
Definition ActionBase.c:786
bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
Definition ActionBase.c:144
void ClearInventoryReservationEx(ActionData action_data)
Definition ActionBase.c:861
bool HasVariants()
Definition ActionBase.c:755
void SetInput(ActionInput ai)
Definition ActionBase.c:208
bool IsDrink()
Definition ActionBase.c:276
bool CanBeUsedRaised()
Definition ActionBase.c:331
ActionInput GetInput()
void OnEndRequest(ActionData action_data)
Definition ActionBase.c:629
void EndInput(ActionData action_data)
Definition ActionBase.c:623
bool CanBeUsedThrowing()
Definition ActionBase.c:336
bool CanBePerformedFromQuickbar()
Definition ActionBase.c:291
void ActionBase()
Definition ActionBase.c:73
bool RemoveForceTargetAfterUse()
Definition ActionBase.c:261
bool CanReceiveAction(ActionTarget target)
Definition ActionBase.c:637
bool CanBeUsedSwimming()
Definition ActionBase.c:321
bool IsLocal()
Definition ActionBase.c:244
protected bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionBase.c:372
bool UseMainItem()
Definition ActionBase.c:357
protected bool IsBuilding(ActionTarget target)
Definition ActionBase.c:917
int GetRefreshReservationTimerValue()
Definition ActionBase.c:379
protected bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:927
protected ref TStringArray m_Sounds
Definition ActionBase.c:54
void InitConditionMask()
Definition ActionBase.c:95
protected int m_VariantID
Definition ActionBase.c:59
string GetAdminLogMessage(ActionData action_data)
float GetProgress(ActionData action_data)
bool CanBeUsedOnBack()
Definition ActionBase.c:316
bool HasProgress()
For UI: hiding of progress bar.
Definition ActionBase.c:238
void ActionCleanup(ActionData action_data)
Definition ActionBase.c:200
void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
Definition ActionBase.c:517
bool IsShaveSelf()
Definition ActionBase.c:281
bool IsInstant()
Definition ActionBase.c:250
bool CanBeUsedInRestrain()
Definition ActionBase.c:306
bool CanBeUsedLeaning()
Definition ActionBase.c:341
protected bool IsDamageDestroyed(ActionTarget target)
Definition ActionBase.c:912
protected string m_Text
Definition ActionBase.c:49
bool CanBePerformedFromInventory()
Definition ActionBase.c:296
string GetText()
Definition ActionBase.c:286
bool IsDeploymentAction()
Is an action directly related to deployment/advanced placing.
Definition ActionBase.c:352
bool CanBeUsedInVehicle()
Definition ActionBase.c:311
protected bool m_FullBody
Definition ActionBase.c:52
protected int m_StanceMask
Definition ActionBase.c:53
Object GetDisplayInteractObject(PlayerBase player, ActionTarget target)
Definition ActionBase.c:224
protected bool ActionConditionContinue(ActionData action_data)
Definition ActionBase.c:367
bool IsEat()
Definition ActionBase.c:271
void OnEndClient(ActionData action_data)
ref ActionTarget m_Target
Definition ActionBase.c:17
protected void InformPlayers(PlayerBase player, ActionTarget target, int state)
DEPRECATED delivers message ids to clients based on given context.
int GetVariants(out array< ref ActionBase > variants)
Definition ActionBase.c:768
bool CanBeUsedOnLadder()
Definition ActionBase.c:326
void EndRequest(ActionData action_data)
Definition ActionBase.c:632
bool Post_SetupAction(ActionData action_data)
Definition ActionBase.c:195
void Interrupt()
class ActionTargets ActionTarget
private void DayZPlayerUtils()
cannot be instantiated
eBrokenLegs
Definition EBrokenLegs.c:2
ERPCs
Definition ERPCs.c:2
void Start()
Plays all elements this effects consists of.
Definition Effect.c:153
int GetID()
Get the ID registered in SEffectManager.
Definition Effect.c:525
protected void SetID(int id)
Set the ID registered in SEffectManager.
Definition Effect.c:516
void End()
called on surrender end request end
void ReadFromContext(ParamsReadContext ctx)
Definition Hand_Events.c:63
void WriteToContext(ParamsWriteContext ctx)
Definition Hand_Events.c:65
EffectSound m_Sound
string Type
override void OnEnd()
Definition JumpEvents.c:57
protected void OnStart(Param par=null)
int GetStanceMask()
bool IsFullBody()
int m_PossibleStanceMask
Definition ActionBase.c:34
ItemBase m_MainItem
Definition ActionBase.c:28
PlayerBase m_Player
Definition ActionBase.c:33
bool m_ReciveEndInput
Definition ActionBase.c:40
int m_RefreshReservationTimer
Definition ActionBase.c:36
ref ActionBase m_Action
Definition ActionBase.c:27
bool m_WasActionStarted
Definition ActionBase.c:39
bool m_WasExecuted
Definition ActionBase.c:38
void ActionData()
Definition ActionBase.c:22
ref array< ref InventoryLocation > m_ReservedInventoryLocations
Definition ActionBase.c:35
ActionBaseCB m_Callback
Definition ActionBase.c:29
int m_RefreshJunctureTimer
Definition ActionBase.c:37
ref CABase m_ActionComponent
Definition ActionBase.c:30
ref ActionTarget m_Target
Definition ActionBase.c:32
int GetActions(out array< ref ActionBase > variants_action)
void UpdateVariants(Object item, Object target, int componet_index)
Definition CABase.c:2
bool CanContinue(PlayerBase player, ItemBase item)
Definition CCIBase.c:8
bool Can(PlayerBase player, ItemBase item)
Definition CCIBase.c:3
bool CanContinue(PlayerBase player, ActionTarget target)
Definition CCTBase.c:8
bool Can(PlayerBase player, ActionTarget target)
Definition CCTBase.c:3
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
Definition Game.c:882
Super root of all classes in Enforce script.
Definition EnScript.c:11
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:138
override bool IsMan()
Definition Man.c:33
Definition Camera.c:2
script counterpart to engine's class Inventory
Definition Inventory.c:77
const int c_InventoryReservationTimeoutMS
reservations
Definition Inventory.c:683
InventoryLocation.
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
proto native EntityAI GetItem()
returns item of current inventory location
static string DumpToStringNullSafe(InventoryLocation loc)
static bool IsActionLogEnable()
Definition Debug.c:590
Definition EnMath.c:7
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static const vector Zero
Definition EnConvert.c:110
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
Definition EnScript.c:685
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
proto native void OnUpdate()
Definition tools.c:338
const int UA_START
Definition constants.c:423
const int UA_NONE
Definition constants.c:416
proto native int GetState()
returns one of STATE_...