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

Go to the source code of this file.

Classes

class  ActionDisarmMineCB
 

Functions

ActionDisarmMineCB ActionContinuousBaseCB ActionDisarmMine ()
 
override void CreateActionComponent ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnStartAnimationLoop (ActionData action_data)
 
override void OnAnimationEvent (ActionData action_data)
 
override void OnEndAnimationLoop (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 

Function Documentation

◆ ActionCondition()

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

Definition at line 27 of file ActionDisarmMine.c.

28 {
29 if (!target)
30 return false;
31
34 return targetMine.IsActive() && targetMine.CanBeDisarmed();
35
36 return false;
37 }
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
void LandMineTrap()
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), UAMaxDistances::DEFAULT, IsInReach(), and LandMineTrap().

◆ ActionDisarmMine()

Definition at line 1 of file ActionDisarmMine.c.

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 }
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 ActionDisarmMine::CreateActionComponent ( )

Definition at line 12 of file ActionDisarmMine.c.

12 {
13 m_CallbackClass = ActionDisarmMineCB;
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 ActionDisarmMine.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.

◆ OnAnimationEvent()

override void OnAnimationEvent ( ActionData action_data)

Definition at line 49 of file ActionDisarmMine.c.

50 {
51 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
52 {
53 LandMineTrap targetMine = LandMineTrap.Cast(action_data.m_Target.GetObject());
54 Param1<bool> play = new Param1<bool>(true);
55 GetGame().RPCSingleParam(targetMine, SoundTypeMine.DISARMING, play, true);
56 }
57 }
SoundTypeMine
proto native CGame GetGame()

References GetGame(), and LandMineTrap().

◆ OnEndAnimationLoop()

override void OnEndAnimationLoop ( ActionData action_data)

Definition at line 59 of file ActionDisarmMine.c.

60 {
61 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
62 {
63 LandMineTrap targetMine = LandMineTrap.Cast(action_data.m_Target.GetObject());
64 Param1<bool> play = new Param1<bool>(false);
65 GetGame().RPCSingleParam(targetMine, SoundTypeMine.DISARMING, play, true);
66 }
67 }

References GetGame(), and LandMineTrap().

◆ OnFinishProgressServer()

override void OnFinishProgressServer ( ActionData action_data)

Definition at line 69 of file ActionDisarmMine.c.

70 {
72 Class.CastTo(targetMine, action_data.m_Target.GetObject());
73
75 Class.CastTo(tool, action_data.m_MainItem);
76
77 if (Math.RandomIntInclusive(0, 100) < tool.GetDisarmRate())
78 targetMine.Disarm();
79 else
80 targetMine.OnSteppedOn(action_data.m_Player);
81
82 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 2);
83 }
Definition EnMath.c:7
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54

References Class::CastTo(), LandMineTrap(), and Math::RandomIntInclusive().

◆ OnStartAnimationLoop()

override void OnStartAnimationLoop ( ActionData action_data)

Definition at line 39 of file ActionDisarmMine.c.

40 {
41 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
42 {
43 LandMineTrap targetMine = LandMineTrap.Cast(action_data.m_Target.GetObject());
44 Param1<bool> play = new Param1<bool>(true);
45 GetGame().RPCSingleParam(targetMine, SoundTypeMine.DISARMING, play, true);
46 }
47 }

References GetGame(), and LandMineTrap().