DayZ 1.24
Loading...
Searching...
No Matches
ActionTurnOnHelmetFlashlight.c
Go to the documentation of this file.
2{
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
27
28 override typename GetInputType()
29 {
31 }
32
33 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
34 {
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 return true;
46
47 return false;
48 }
49
51 {
52 super.Start(action_data);
53
54 Switchable_Base light;// = Switchable_Base.Cast(action_data.m_MainItem.FindAttachmentBySlotName("helmetFlashlight"));
56 helmet = Mich2001Helmet.Cast(action_data.m_Target.GetObject());
57 light = Switchable_Base.Cast(helmet.FindAttachmentBySlotName("helmetFlashlight"));
58
59 if (light.HasEnergyManager())
60 {
61 if (light.GetCompEM().CanWork())
62 light.GetCompEM().SwitchOn();
63 }
64 }
65};
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void Start(ActionData action_data)
const float DEFAULT