Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionattachexplosivestrigger.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.EXPLOSIVE_ARM);
6  }
7 }
8 
10 {
12  {
13  m_CallbackClass = ActionAttachExplosivesTriggerCB;
14  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_CRAFTING;
15  m_FullBody = true;
17 
18  m_Text = "#STR_ArmExplosive";
19  }
20 
21  override void CreateConditionComponents()
22  {
25  }
26 
27  override bool ActionConditionContinue(ActionData action_data)
28  {
29  return true;
30  }
31 
32  override bool CanBeSetFromInventory()
33  {
34  return true;
35  }
36 
37  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
38  {
39  if (target.GetParent())
40  {
41  return false;
42  }
43 
44  if (ClaymoreMine.Cast(target.GetObject()))
45  {
46  return false;
47  }
48 
49  ExplosivesBase explosive = ExplosivesBase.Cast(target.GetObject());
50  if (explosive)
51  {
52  ClockBase timedTrigger;
53  if (ClockBase.CastTo(timedTrigger, item))
54  {
55  return timedTrigger.IsAlarmOn() && explosive.IsTimerDetonable() && explosive.CanBeArmed();
56  }
57 
58  return explosive.CanBeArmed();
59  }
60 
61 
62  return false;
63  }
64 
65  override void OnFinishProgressServer(ActionData action_data)
66  {
67  ClearInventoryReservationEx(action_data);
68 
69  ExplosivesBase explosive = ExplosivesBase.Cast(action_data.m_Target.GetObject());
70  if (explosive)
71  {
72  explosive.OnPlacementComplete(action_data.m_Player, explosive.GetPosition(), action_data.m_Player.GetOrientation());
73  explosive.UnlockTriggerSlots();
74  }
75 
76  if (action_data.m_MainItem.IsInherited(RemoteDetonator))
77  {
79 
80  return;
81  }
82  else
83  {
84  AttachItem(action_data);
85  }
86  }
87 
88  override void OnFinishProgressClient(ActionData action_data)
89  {
90  ClearInventoryReservationEx(action_data);
91 
92  ExplosivesBase explosive = ExplosivesBase.Cast(action_data.m_Target.GetObject());
93  if (explosive)
94  {
95  explosive.UnlockTriggerSlots();
96  }
97 
98  if (!action_data.m_MainItem.IsInherited(RemoteDetonator))
99  {
100  AttachItem(action_data);
101  }
102  }
103 
105  {
106  ExplosivesBase explosive;
107  if (action_data.m_Target.IsProxy())
108  {
109  explosive = ExplosivesBase.Cast(action_data.m_Target.GetParent());
110  }
111  else
112  {
113  explosive = ExplosivesBase.Cast(action_data.m_Target.GetObject());
114  }
115 
116  if (explosive && action_data.m_MainItem)
117  {
118  explosive.UnlockTriggerSlots();
119  RemoteDetonatorTrigger.SpawnInPlayerHands(action_data.m_Player, explosive);
120  }
121  }
122 
123  protected void AttachItem(ActionData action_data)
124  {
125  EntityAI targetEAI;
126  if (action_data.m_Target.IsProxy())
127  {
128  targetEAI = EntityAI.Cast(action_data.m_Target.GetParent());
129  }
130  else
131  {
132  targetEAI = EntityAI.Cast(action_data.m_Target.GetObject());
133  }
134 
135  if (targetEAI && action_data.m_MainItem)
136  {
137  int slotId = InventorySlots.GetSlotIdFromString(action_data.m_MainItem.GetExplosiveTriggerSlotName());
138  action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx(targetEAI, action_data.m_MainItem, slotId);
139  }
140  }
141 }
ItemBase
Definition: inventoryitem.c:730
CreateConditionComponents
override void CreateConditionComponents()
Definition: actionattachexplosivestrigger.c:21
ActionConditionContinue
override bool ActionConditionContinue(ActionData action_data)
Definition: actionattachexplosivestrigger.c:27
CAContinuousTime
Definition: cacontinuoustime.c:1
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
OnFinishProgressClient
override void OnFinishProgressClient(ActionData action_data)
Definition: actionattachexplosivestrigger.c:88
UASoftSkillsWeight
Definition: actionconstants.c:118
ClaymoreMine
Definition: claymoremine.c:1
ClockBase
void ClockBase()
Definition: clockbase.c:27
ActionAttachExplosivesTrigger
ActionAttachExplosivesTriggerCB ActionContinuousBaseCB ActionAttachExplosivesTrigger()
Definition: actionattachexplosivestrigger.c:11
UAMaxDistances
Definition: actionconstants.c:104
ClearInventoryReservationEx
void ClearInventoryReservationEx(ActionData action_data)
Definition: actionbase.c:862
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actionattachexplosivestrigger.c:37
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
ExplosivesBase
void ExplosivesBase()
Definition: explosivesbase.c:40
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
CCTNonRuined
Definition: cctnonruined.c:1
OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition: actionattachexplosivestrigger.c:65
RemoteDetonatorTrigger
Definition: remotedetonator.c:46
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
ActionAttachExplosivesTriggerCB
Definition: actionattachexplosivestrigger.c:1
AttachItem
protected void AttachItem(ActionData action_data)
Definition: actionattachexplosivestrigger.c:123
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
CreateRemoteDetonatorReceiverAsAttachment
protected void CreateRemoteDetonatorReceiverAsAttachment(ActionData action_data)
Definition: actionattachexplosivestrigger.c:104
CanBeSetFromInventory
override bool CanBeSetFromInventory()
Definition: actionattachexplosivestrigger.c:32
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
EntityAI
Definition: building.c:5