Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
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 {
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};
ActionBase ActionData
Definition actionbase.c:30
class ActionTargets ActionTarget
ref CCIBase m_ConditionItem
Definition actionbase.c:70
ref CCTBase m_ConditionTarget
Definition actionbase.c:71
void ActionBase()
Definition actionbase.c:88
override void Start(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
const float DEFAULT