Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiontriggerremotely.c
Go to the documentation of this file.
2 {
4  {
5  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PRESS_TRIGGER;
6  m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PRESS_TRIGGER;
7  m_Text = "#STR_Detonate";
8  }
9 
10  override void CreateConditionComponents()
11  {
12  m_ConditionTarget = new CCTNone();
14  }
15 
16  override bool HasProgress()
17  {
18  return true;
19  }
20 
21  override bool HasTarget()
22  {
23  return false;
24  }
25 
26  override bool HasProneException()
27  {
28  return true;
29  }
30 
31  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
32  {
34  if (rdt && rdt.IsConnected())
35  {
36  ExplosivesBase controlledDevice = ExplosivesBase.Cast(rdt.GetControlledDevice());
37  if (controlledDevice && controlledDevice.GetPairDevice() != item)
38  {
39  rdt.UpdateLED(ERemoteDetonatorLEDState.OFF);
40 
41  return false;
42  }
43 
44  if (controlledDevice && !controlledDevice.IsRuined() && controlledDevice.GetArmed())
45  {
46  if (vector.DistanceSq(player.GetPosition(), controlledDevice.GetPosition()) <= Math.SqrFloat(UAMaxDistances.EXPLOSIVE_REMOTE_ACTIVATION))
47  {
48  rdt.UpdateLED(ERemoteDetonatorLEDState.LIT);
49 
50  return true;
51  }
52  }
53  }
54 
55  rdt.UpdateLED(ERemoteDetonatorLEDState.OFF);
56 
57  return false;
58  }
59 
60  override void OnExecuteServer(ActionData action_data)
61  {
62  super.OnExecuteServer(action_data);
63 
64  RemoteDetonatorTrigger rdt = RemoteDetonatorTrigger.Cast(action_data.m_MainItem);
65  if (rdt && rdt.IsConnected())
66  {
67  ItemBase controlledDevice = ItemBase.Cast(rdt.GetControlledDevice());
68  if (controlledDevice && !controlledDevice.IsRuined())
69  {
70  controlledDevice.OnActivatedByItem(action_data.m_MainItem);
71  action_data.m_MainItem.SetAnimationPhase("trigger", 1);
72  action_data.m_MainItem.SetAnimationPhase("lever", 1);
73  }
74  }
75  }
76 }
ItemBase
Definition: inventoryitem.c:730
ERemoteDetonatorLEDState
ERemoteDetonatorLEDState
Definition: remotedetonator.c:1
ActionTriggerRemotely
Definition: actiontriggerremotely.c:1
CCTNone
Definition: cctnone.c:1
UAMaxDistances
Definition: actionconstants.c:104
ExplosivesBase
void ExplosivesBase()
Definition: explosivesbase.c:40
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
RemoteDetonatorTrigger
Definition: remotedetonator.c:46
m_Text
protected string m_Text
Definition: actionbase.c:49
ActionSingleUseBase
Definition: actionsingleusebase.c:41
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
CCINonRuined
Definition: ccinonruined.c:1
Math
Definition: enmath.c:6
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56