Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiondisarmexplosive.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 = ActionDisarmExplosiveCB;
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  ExplosivesBase explosive;
35  if (Class.CastTo(explosive, target.GetObject()) && item)
36  {
37  return explosive.GetArmed() && explosive.CanBeDisarmed();
38  }
39 
40  return false;
41  }
42 
43  override void OnFinishProgressServer(ActionData action_data)
44  {
45  ExplosivesBase explosive = ExplosivesBase.Cast(action_data.m_Target.GetObject());
46  ToolBase tool = ToolBase.Cast(action_data.m_MainItem);
47 
48  if (Math.RandomIntInclusive(0, 100) < tool.GetDisarmRate())
49  {
50  explosive.OnBeforeDisarm();
51  explosive.Disarm(true);
52  }
53  else
54  {
55  explosive.SetHealth("", "", 0.0);
56  }
57 
58  MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, UADamageApplied.DEFUSE_TOOLS);
59  }
60 }
ItemBase
Definition: inventoryitem.c:730
UADamageApplied
Definition: actionconstants.c:130
CAContinuousTime
Definition: cacontinuoustime.c:1
ActionDisarmExplosive
ActionDisarmExplosiveCB ActionContinuousBaseCB ActionDisarmExplosive()
Definition: actiondisarmexplosive.c:11
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
ExplosivesBase
void ExplosivesBase()
Definition: explosivesbase.c:40
PlayerBase
Definition: playerbaseclient.c:1
ActionDisarmExplosiveCB
Definition: actiondisarmexplosive.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition: actiondisarmexplosive.c:43
ToolBase
Definition: boneknife.c:1
CCTCursor
Definition: cctcursor.c:1
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CreateConditionComponents
override void CreateConditionComponents()
Definition: actiondisarmexplosive.c:21
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
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actiondisarmexplosive.c:27