Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiondisarmmine.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.DISARM_MINE);
6  }
7 }
8 
10 {
12  {
13  m_CallbackClass = ActionDisarmMineCB;
14  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
15  m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
16  m_FullBody = true;
17 
18  m_Text = "#disarm";
19  }
20 
21  override void CreateConditionComponents()
22  {
25  }
26 
27  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
28  {
29  if (!target)
30  {
31  return false;
32  }
33 
34  LandMineTrap targetMine;
35  if (Class.CastTo(targetMine, target.GetObject()) && item && IsInReach(player, target, UAMaxDistances.DEFAULT))
36  {
37  return targetMine.IsActive() && targetMine.CanBeDisarmed();
38  }
39 
40  return false;
41  }
42 
43  override void OnStartAnimationLoop(ActionData action_data)
44  {
45  if (!GetGame().IsMultiplayer() || GetGame().IsServer())
46  {
47  LandMineTrap targetMine = LandMineTrap.Cast(action_data.m_Target.GetObject());
48  Param1<bool> play = new Param1<bool>(true);
49  GetGame().RPCSingleParam(targetMine, SoundTypeMine.DISARMING, play, true);
50  }
51  }
52 
53  override void OnAnimationEvent(ActionData action_data)
54  {
55  if (!GetGame().IsMultiplayer() || GetGame().IsServer())
56  {
57  LandMineTrap targetMine = LandMineTrap.Cast(action_data.m_Target.GetObject());
58  Param1<bool> play = new Param1<bool>(true);
59  GetGame().RPCSingleParam(targetMine, SoundTypeMine.DISARMING, play, true);
60  }
61  }
62 
63  override void OnEndAnimationLoop( ActionData action_data )
64  {
65  if (!GetGame().IsMultiplayer() || GetGame().IsServer())
66  {
67  LandMineTrap targetMine = LandMineTrap.Cast(action_data.m_Target.GetObject());
68  Param1<bool> play = new Param1<bool>(false);
69  GetGame().RPCSingleParam(targetMine, SoundTypeMine.DISARMING, play, true);
70  }
71  }
72 
73  override void OnFinishProgressServer(ActionData action_data)
74  {
75  LandMineTrap targetMine;
76  Class.CastTo(targetMine, action_data.m_Target.GetObject());
77 
78  ToolBase tool;
79  Class.CastTo(tool, action_data.m_MainItem);
80 
81  if (Math.RandomIntInclusive(0, 100) < tool.GetDisarmRate())
82  {
83  targetMine.Disarm();
84  }
85  else
86  {
87  targetMine.OnSteppedOn(action_data.m_Player);
88  }
89 
90  MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 2);
91  }
92 };
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition: actiondisarmmine.c:73
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actiondisarmmine.c:27
SoundTypeMine
SoundTypeMine
Definition: trap_landmine.c:1
CAContinuousTime
Definition: cacontinuoustime.c:1
ActionDisarmMineCB
Definition: actiondisarmmine.c:1
LandMineTrap
void LandMineTrap()
Definition: trap_landmine.c:17
UAMaxDistances
Definition: actionconstants.c:104
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
PlayerBase
Definition: playerbaseclient.c:1
OnAnimationEvent
override void OnAnimationEvent(ActionData action_data)
Definition: actiondisarmmine.c:53
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ToolBase
Definition: boneknife.c:1
CreateConditionComponents
override void CreateConditionComponents()
Definition: actiondisarmmine.c:21
CCTCursor
Definition: cctcursor.c:1
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
ActionDisarmMine
ActionDisarmMineCB ActionContinuousBaseCB ActionDisarmMine()
Definition: actiondisarmmine.c:11
IsInReach
protected bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition: actionbase.c:928
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
OnStartAnimationLoop
override void OnStartAnimationLoop(ActionData action_data)
Definition: actiondisarmmine.c:43
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
Math
Definition: enmath.c:6
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
OnEndAnimationLoop
override void OnEndAnimationLoop(ActionData action_data)
Definition: actiondisarmmine.c:63