DayZ 1.24
Loading...
Searching...
No Matches
ActionTurnOffHeadtorch.c
Go to the documentation of this file.
1class ActionTurnOffHeadtorch: ActionBase
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
27
28 override typename GetInputType()
29 {
31 }
32
33 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
34 {
35 Headtorch_ColorBase headtorch;
36 headtorch = Headtorch_ColorBase.Cast(target.GetObject());
37 if (!headtorch)
38 return false;
39
40 if (headtorch.HasEnergyManager() && headtorch.GetCompEM().CanSwitchOff()) //TODO review conditions for turning off
41 return true;
42
43 return false;
44 }
45
47 {
48 super.Start(action_data);
49
50 Headtorch_ColorBase headtorch;
51 headtorch = Headtorch_ColorBase.Cast(action_data.m_Target.GetObject());
52 if (headtorch.HasEnergyManager())
53 {
54 if (headtorch.GetCompEM().IsSwitchedOn())
55 headtorch.GetCompEM().SwitchOff();
56 }
57 }
58};
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)
override void CreateConditionComponents()
const float DEFAULT