DayZ 1.24
Loading...
Searching...
No Matches
ActionDisarmExplosive.c File Reference

Go to the source code of this file.

Classes

class  ActionDisarmExplosiveCB
 

Functions

ActionDisarmExplosiveCB ActionContinuousBaseCB ActionDisarmExplosive ()
 
override void CreateActionComponent ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnFinishProgressServer (ActionData action_data)
 

Function Documentation

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )

Definition at line 27 of file ActionDisarmExplosive.c.

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 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo().

◆ ActionDisarmExplosive()

Definition at line 1 of file ActionDisarmExplosive.c.

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 }
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

Referenced by ActionConstructor::RegisterActions(), ToolBase::SetActions(), and Lockpick::SetActions().

◆ CreateActionComponent()

override void ActionDisarmExplosive::CreateActionComponent ( )

Definition at line 12 of file ActionDisarmExplosive.c.

12 {
13 m_CallbackClass = ActionDisarmExplosiveCB;
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
15 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;

References m_FullBody, m_StanceMask, and m_Text.

◆ CreateConditionComponents()

override void CreateConditionComponents ( )

Definition at line 21 of file ActionDisarmExplosive.c.

22 {
25 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ OnFinishProgressServer()

override void OnFinishProgressServer ( ActionData action_data)

Definition at line 39 of file ActionDisarmExplosive.c.

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 }
Definition EnMath.c:7
const float DEFUSE_TOOLS
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54

References UADamageApplied::DEFUSE_TOOLS, and Math::RandomIntInclusive().