DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionTurnOffHeadtorch.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
23 {
26 }
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 {
42 return true;
43 }
44
45 return false;
46 }
47
48 override void Start( ActionData action_data )
49 {
50 super.Start( action_data );
51
52 Headtorch_ColorBase headtorch;
53 headtorch = Headtorch_ColorBase.Cast(action_data.m_Target.GetObject());
54 if ( headtorch.HasEnergyManager() )
55 {
56 if ( headtorch.GetCompEM().IsSwitchedOn() )
57 {
58 headtorch.GetCompEM().SwitchOff();
59 }
60 }
61 }
62};
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
void ActionBase()
Definition ActionBase.c:73
class ActionTargets ActionTarget
ref ActionTarget m_Target
Definition ActionBase.c:32
override void Start(ActionData action_data)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
const float DEFAULT