DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionDisarmExplosive.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
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
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;
46 Class.CastTo(explosive, action_data.m_Target.GetObject());
47
48 ToolBase tool;
49 Class.CastTo(tool, action_data.m_MainItem);
50
51 if (Math.RandomIntInclusive(0, 100) < tool.GetDisarmRate())
52 {
53 explosive.Disarm(true);
54 }
55 else
56 {
57 explosive.SetHealth("", "", 0.0);
58 }
59
60 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, UADamageApplied.DEFUSE_TOOLS);
61 }
62}
void CreateConditionComponents()
Definition ActionBase.c:218
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
protected bool m_FullBody
Definition ActionBase.c:52
protected int m_StanceMask
Definition ActionBase.c:53
ActionDisarmExplosiveCB ActionContinuousBaseCB ActionDisarmExplosive()
class ActionTargets ActionTarget
void ExplosivesBase()
protected ActionData m_ActionData
protected void OnFinishProgressServer(ActionData action_data)
ItemBase m_MainItem
Definition ActionBase.c:28
ref CABase m_ActionComponent
Definition ActionBase.c:30
ref ActionTarget m_Target
Definition ActionBase.c:32
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:602
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:53