DayZ 1.24
Loading...
Searching...
No Matches
ActionActivateTrap.c File Reference

Go to the source code of this file.

Classes

class  ActionActivateTrapCB
 

Functions

ActionActivateTrapCB ActionContinuousBaseCB ActionActivateTrap ()
 
override void CreateActionComponent ()
 
override void InitActionComponent ()
 
override void CreateConditionComponents ()
 
override GetInputType ()
 
override bool HasProgress ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnStartAnimationLoop (ActionData action_data)
 
override void OnEnd (ActionData action_data)
 
override void OnEndAnimationLoop (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 

Function Documentation

◆ ActionActivateTrap()

Definition at line 1 of file ActionActivateTrap.c.

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 }
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
float m_SpecialtyWeight
Definition ActionBase.c:68
int m_StanceMask
Definition ActionBase.c:53
EffectSound m_Sound
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

Referenced by ActionConstructor::RegisterActions(), SetActions(), and ItemBase::SetActions().

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )

Definition at line 46 of file ActionActivateTrap.c.

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 }

◆ CreateActionComponent()

override void ActionActivateTrap::CreateActionComponent ( )

Definition at line 19 of file ActionActivateTrap.c.

19 {
20 m_CallbackClass = ActionActivateTrapCB;
21 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_CRAFTING;
22 m_FullBody = true;

References m_FullBody, and m_StanceMask.

◆ CreateConditionComponents()

override void CreateConditionComponents ( )

Definition at line 30 of file ActionActivateTrap.c.

31 {
34 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ GetInputType()

override GetInputType ( )

Definition at line 36 of file ActionActivateTrap.c.

◆ HasProgress()

override bool HasProgress ( )

Definition at line 41 of file ActionActivateTrap.c.

42 {
43 return true;
44 }

◆ InitActionComponent()

override void ActionActivateTrap::InitActionComponent ( )

Definition at line 24 of file ActionActivateTrap.c.

◆ OnEnd()

override void OnEnd ( ActionData action_data)

Definition at line 88 of file ActionActivateTrap.c.

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 }
SoundTypeTrap
Definition TrapBase.c:2
proto native CGame GetGame()

References GetGame().

◆ OnEndAnimationLoop()

override void OnEndAnimationLoop ( ActionData action_data)

Definition at line 101 of file ActionActivateTrap.c.

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 }

References GetGame().

◆ OnFinishProgressServer()

override void OnFinishProgressServer ( ActionData action_data)

Definition at line 113 of file ActionActivateTrap.c.

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 }

◆ OnStartAnimationLoop()

override void OnStartAnimationLoop ( ActionData action_data)

Definition at line 73 of file ActionActivateTrap.c.

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 }

References GetGame().