DayZ 1.24
Loading...
Searching...
No Matches
ActionActivateTrap.c
Go to the documentation of this file.
2{
7
8 override void InitActionComponent()
9 {
10 super.InitActionComponent();
11
12 RegisterAnimationEvent("CraftingAction", UA_IN_CRAFTING);
13 }
14}
15
17{
19 {
20 m_CallbackClass = ActionActivateTrapCB;
21 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_CRAFTING;
22 m_FullBody = true;
23 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
24 m_Sound = "craft_universal_0";
26
27 m_Text = "#activate";
28 }
29
35
36 override typename GetInputType()
37 {
39 }
40
41 override bool HasProgress()
42 {
43 return true;
44 }
45
46 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
47 {
48 ItemBase targetItem = ItemBase.Cast(target.GetObject());
49 if (targetItem && targetItem.IsBeingPlaced())
50 return false;
51
52 Object targetObject = target.GetObject();
53 if (targetObject != null)
54 {
55 if (targetObject.IsInherited(TrapBase))
56 {
58 if (trap.IsActivable())
59 return true;
60 }
61 else if (targetObject.IsInherited(TrapSpawnBase))
62 {
64
65 if (spawnTrap && !spawnTrap.IsActive())
66 return spawnTrap.IsPlaceableAtPosition(spawnTrap.GetPosition());
67 }
68 }
69
70 return false;
71 }
72
74 {
75 super.OnStartAnimationLoop(action_data);
76
77 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
78 {
79 TrapBase trap = TrapBase.Cast(action_data.m_Target.GetObject());
80 if (trap)
81 {
82 Param1<bool> play = new Param1<bool>(true);
83 GetGame().RPCSingleParam(trap, SoundTypeTrap.ACTIVATING, play, true);
84 }
85 }
86 }
87
89 {
90 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
91 {
92 TrapBase trap = TrapBase.Cast(action_data.m_Target.GetObject());
93 if (trap)
94 {
95 Param1<bool> play = new Param1<bool>(false);
96 GetGame().RPCSingleParam(trap, SoundTypeTrap.ACTIVATING, play, true);
97 }
98 }
99 }
100
102 {
103 super.OnEndAnimationLoop(action_data);
104
105 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
106 {
107 TrapBase trap = TrapBase.Cast(action_data.m_Target.GetObject());
108 Param1<bool> play = new Param1<bool>(false);
109 GetGame().RPCSingleParam(trap, SoundTypeTrap.ACTIVATING, play, true);
110 }
111 }
112
114 {
115 Object targetObject = action_data.m_Target.GetObject();
116 if (targetObject != null)
117 {
118 vector orientation = action_data.m_Player.GetOrientation();
119 vector position = targetObject.GetPosition();
120
121 if (targetObject.IsInherited(TrapBase))
122 {
124 trap.OnPlacementComplete(action_data.m_Player, position, orientation);
125 trap.StartActivate(action_data.m_Player);
126 }
127 else if (targetObject.IsInherited(TrapSpawnBase))
128 {
130 spawnTrap.OnPlacementComplete(action_data.m_Player, position, orientation);
131 }
132 }
133 }
134}
ActionActivateTrapCB ActionContinuousBaseCB ActionActivateTrap()
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
void CreateConditionComponents()
Definition ActionBase.c:196
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
bool HasProgress()
For UI: hiding of progress bar.
Definition ActionBase.c:216
class DayZCreatureAnimInterface RegisterAnimationEvent(string event_name, string function_name)
EffectSound m_Sound
override void OnEnd()
Definition JumpEvents.c:53
SoundTypeTrap
Definition TrapBase.c:2
override void InitActionComponent()
override void CreateActionComponent()
ActionData m_ActionData
void OnEndAnimationLoop(ActionData action_data)
void OnStartAnimationLoop(ActionData action_data)
void OnFinishProgressServer(ActionData action_data)
ref CABase m_ActionComponent
Definition ActionBase.c:30
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
const float DEFAULT
const float DEFAULT_DEPLOY
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
const int UA_IN_CRAFTING
Definition constants.c:453