DayZ 1.24
Loading...
Searching...
No Matches
ActionDisarmExplosive.c
Go to the documentation of this file.
2{
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
22 {
25 }
26
27 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
28 {
29 if (!target)
30 return false;
31
32 ExplosivesBase explosive;
33 if (Class.CastTo(explosive, target.GetObject()) && item)
34 return explosive.GetArmed() && explosive.CanBeDisarmed();
35
36 return false;
37 }
38
40 {
41 ExplosivesBase explosive = ExplosivesBase.Cast(action_data.m_Target.GetObject());
42 ToolBase tool = ToolBase.Cast(action_data.m_MainItem);
43
44 if (Math.RandomIntInclusive(0, 100) < tool.GetDisarmRate())
45 {
46 explosive.OnBeforeDisarm();
47 explosive.Disarm(true);
48 }
49 else
50 explosive.SetHealth("", "", 0.0);
51
53 }
54}
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
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
ActionDisarmExplosiveCB ActionContinuousBaseCB ActionDisarmExplosive()
ActionData m_ActionData
void OnFinishProgressServer(ActionData action_data)
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition EnMath.c:7
const float DEFUSE_TOOLS
const float DISARM_MINE
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.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54