DayZ 1.24
Loading...
Searching...
No Matches
ActionClapBearTrapWithThisItem.c
Go to the documentation of this file.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_POKE;
6 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
7 m_FullBody = true;
8 m_Text = "#trigger_bear_trap";
9 }
10
16
17 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
18 {
19 if (!target)
20 return false;
21
22 BearTrap trap;
23 if (Class.CastTo(trap, target.GetObject()))
24 return trap.IsActive() && trap.CanBeDisarmed() && IsInReach(player, target, UAMaxDistances.DEFAULT);
25
26 return false;
27 }
28
30 {
31 BearTrap trap;
32 Class.CastTo(trap, action_data.m_Target.GetObject());
33
34 trap.Disarm();
35 }
36}
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
override void OnExecuteServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.