DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionDisarmExplosiveWithRemoteDetonator.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
6 }
7}
8
10{
12 {
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
15 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
16 m_FullBody = true;
17 m_Text = "#disarm";
18 }
19
21 {
24 }
25
26 override bool CanBeSetFromInventory()
27 {
28 return true;
29 }
30
31 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
32 {
33 if (!target)
34 {
35 return false;
36 }
37
38 ExplosivesBase explosive = ExplosivesBase.Cast(target.GetObject());
39 if (!explosive)
40 {
41 return false;
42 }
43
44 if (explosive.IsRuined() || !explosive.GetArmed() || !explosive.CanBeDisarmed())
45 {
46 return false;
47 }
48
49 if (explosive.GetAttachmentByType(KitchenTimer) || explosive.GetAttachmentByType(AlarmClock_ColorBase))
50 {
51 return false;
52 }
53
55 if (rdt && rdt.IsConnected())
56 {
57
58 if (explosive != rdt.GetControlledDevice())
59 {
60 return false;
61 }
62
63 ExplosivesBase controlledDevice = ExplosivesBase.Cast(rdt.GetControlledDevice());
64 if (controlledDevice && !controlledDevice.IsRuined() && controlledDevice.GetArmed())
65 {
66 return true;
67 }
68 }
69
70 return false;
71 }
72
73 override void OnFinishProgressServer(ActionData action_data)
74 {
75 ExplosivesBase target;
76 Class.CastTo(target, action_data.m_Target.GetObject());
77
78 ItemBase detonator;
79 Class.CastTo(detonator, action_data.m_MainItem);
80
81 target.Disarm();
82 target.SetTakeable(true);
83
85 if (target.IsInherited(ClaymoreMine))
86 {
87 detonator.Delete();
88 return;
89 }
90
91 ReplaceItemWithNewLambdaBase lambda = new ReplaceDetonatorItemLambda(detonator, "RemoteDetonator");
92 MiscGameplayFunctions.TurnItemIntoItemEx(action_data.m_Player, lambda);
94 action_data.m_Player.GetItemAccessor().OnItemInHandsChanged();
95 }
96}
override void OnFinishProgressServer(ActionData action_data)
bool CanBeSetFromInventory()
Definition ActionBase.c:301
void CreateConditionComponents()
Definition ActionBase.c:218
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionBase.c:372
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()
ActionDisarmExplosiveWithRemoteDetonatorCB ActionDisarmExplosiveCB ActionDisarmExplosiveWithRemoteDetonator()
class ActionTargets ActionTarget
void ExplosivesBase()
protected ActionData m_ActionData
ItemBase m_MainItem
Definition ActionBase.c:28
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
ref ActionTarget m_Target
Definition ActionBase.c:32
Super root of all classes in Enforce script.
Definition EnScript.c:11
base class for transformation operations (creating one item from another)
const float DISARM_EXPLOSIVE_REMOTE_PAIRED
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.