Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionturnonhelmetflashlight.c
Go to the documentation of this file.
2 {
4  {
5  }
6 
7  override bool IsInstant()
8  {
9  return true;
10  }
11 
12  override bool HasTarget()
13  {
14  return true;
15  }
16 
17  override bool UseMainItem()
18  {
19  return false;
20  }
21 
22  override void CreateConditionComponents()
23  {
26  }
27 
28  override typename GetInputType()
29  {
31  }
32 
33  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
34  {
35  Switchable_Base light;
36  Mich2001Helmet helmet;
37  helmet = Mich2001Helmet.Cast(target.GetObject());
38  if ( !helmet )
39  return false;
40  light = Switchable_Base.Cast(helmet.FindAttachmentBySlotName("helmetFlashlight"));
41  if ( !light )
42  return false;
43 
44  if ( light.HasEnergyManager() && light.GetCompEM().CanSwitchOn() && light.GetCompEM().CanWork() ) //TODO review conditions for turning off
45  {
46  return true;
47  }
48 
49  return false;
50  }
51 
52  override void Start( ActionData action_data )
53  {
54  super.Start( action_data );
55 
56  Switchable_Base light;// = Switchable_Base.Cast(action_data.m_MainItem.FindAttachmentBySlotName("helmetFlashlight"));
57  Mich2001Helmet helmet;
58  helmet = Mich2001Helmet.Cast(action_data.m_Target.GetObject());
59  light = Switchable_Base.Cast(helmet.FindAttachmentBySlotName("helmetFlashlight"));
60 
61  if ( light.HasEnergyManager() )
62  {
63  if ( light.GetCompEM().CanWork() )
64  {
65  light.GetCompEM().SwitchOn();
66  }
67  }
68  }
69 };
ItemBase
Definition: inventoryitem.c:730
ToggleLightsActionInput
Definition: actioninput.c:746
Switchable_Base
Definition: chainsaw.c:1
CCINone
Definition: ccinone.c:1
UAMaxDistances
Definition: actionconstants.c:104
PlayerBase
Definition: playerbaseclient.c:1
ActionTurnOnHelmetFlashlight
Definition: actionturnonhelmetflashlight.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
CCTNonRuined
Definition: cctnonruined.c:1
ActionBase
void ActionBase()
Definition: actionbase.c:73
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56