DayZ 1.24
Loading...
Searching...
No Matches
ActionDisarmMine.c
Go to the documentation of this file.
2{
7}
8
10{
11 void ActionDisarmMine()
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 }
20
26
27 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
28 {
29 if (!target)
30 return false;
31
34 return targetMine.IsActive() && targetMine.CanBeDisarmed();
35
36 return false;
37 }
38
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 }
48
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 }
58
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 }
68
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 }
84};
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
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
ActionDisarmMineCB ActionContinuousBaseCB ActionDisarmMine()
void LandMineTrap()
SoundTypeMine
ActionData m_ActionData
void OnEndAnimationLoop(ActionData action_data)
void OnStartAnimationLoop(ActionData action_data)
void OnFinishProgressServer(ActionData action_data)
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
void OnAnimationEvent(ActionData action_data)
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 DEFAULT
const float DISARM_MINE
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
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