Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionturnoffwhileinhands.c
Go to the documentation of this file.
2 {
4  {
5  m_Text = "#switch_off";
6  }
7 
8  override void CreateConditionComponents()
9  {
11  m_ConditionTarget = new CCTNone();
12  }
13 
14  override bool HasTarget()
15  {
16  return false;
17  }
18 
19  override bool HasProneException()
20  {
21  return true;
22  }
23 
24  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
25  {
26  if (item.IsInherited(Roadflare))
27  {
28  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_LIGHTFLARE;
29  m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_LIGHTFLARE;
30  }
31  else if (item.IsInherited(Chemlight_ColorBase))
32  {
33  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_LITCHEMLIGHT;
34  m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_LITCHEMLIGHT;
35  }
36  else if (item.IsInherited(GPSReceiver))
37  {
38  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PRESS_TRIGGER;
39  m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PRESS_TRIGGER;
40  }
41  else
42  {
43  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ITEM_OFF;
44  m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_ITEM_OFF;
45  }
46 
47  return item.HasEnergyManager() && item.GetCompEM().CanSwitchOff();
48  }
49 
50  override void OnExecuteServer(ActionData action_data)
51  {
52  action_data.m_MainItem.GetCompEM().SwitchOff();
53  }
54 }
ItemBase
Definition: inventoryitem.c:730
CCTNone
Definition: cctnone.c:1
Roadflare
Definition: roadflare.c:24
PlayerBase
Definition: playerbaseclient.c:1
Chemlight_ColorBase
Definition: chemlight.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ActionTurnOffWhileInHands
Definition: actionturnoffwhileinhands.c:1
GPSReceiver
Definition: gpsreceiver.c:1
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
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56