DayZ 1.24
Loading...
Searching...
No Matches
ActionSwitchLights Class Reference
Inheritance diagram for ActionSwitchLights:
[legend]
Collaboration diagram for ActionSwitchLights:
[legend]

Private Member Functions

void ActionSwitchLights ()
 
override void CreateConditionComponents ()
 
override GetInputType ()
 
override bool HasTarget ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteServer (ActionData action_data)
 
override bool CanBeUsedInVehicle ()
 

Detailed Description

Definition at line 1 of file ActionSwitchLights.c.

Constructor & Destructor Documentation

◆ ActionSwitchLights()

void ActionSwitchLights::ActionSwitchLights ( )
inlineprivate

Definition at line 3 of file ActionSwitchLights.c.

4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_HEADLIGHT;
6 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
7 m_Text = "#switch_lights";
8 }
string m_Text
Definition ActionBase.c:49
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CommandUID, m_StanceMask, and m_Text.

Member Function Documentation

◆ ActionCondition()

override bool ActionSwitchLights::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 26 of file ActionSwitchLights.c.

27 {
28 HumanCommandVehicle vehCommand = player.GetCommand_Vehicle();
29
30 if (vehCommand)
31 {
32 Transport trans = vehCommand.GetTransport();
33 if (trans)
34 {
36 if (Class.CastTo(car, trans))
37 {
38 if (car.CrewMemberIndex(player) == DayZPlayerConstants.VEHICLESEAT_DRIVER)
39 {
40 if (!car.IsScriptedLightsOn())
41 {
43
44 if (car.IsVitalCarBattery()) neededItem = car.FindAttachmentBySlotName("CarBattery");
45 if (car.IsVitalTruckBattery()) neededItem = car.FindAttachmentBySlotName("TruckBattery");
46
47 if (neededItem && !neededItem.IsRuined())
48 return neededItem.GetCompEM() && neededItem.GetCompEM().GetEnergy() > 0;
49 }
50 else
51 return true;
52 }
53 }
54 }
55 }
56
57 return false;
58 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
Base native class for all motorized wheeled vehicles.
Definition Car.c:75
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo().

◆ CanBeUsedInVehicle()

override bool ActionSwitchLights::CanBeUsedInVehicle ( )
inlineprivate

Definition at line 75 of file ActionSwitchLights.c.

76 {
77 return true;
78 }

◆ CreateConditionComponents()

override void ActionSwitchLights::CreateConditionComponents ( )
inlineprivate

Definition at line 10 of file ActionSwitchLights.c.

11 {
14 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ GetInputType()

override ActionSwitchLights::GetInputType ( )
inlineprivate

Definition at line 16 of file ActionSwitchLights.c.

◆ HasTarget()

override bool ActionSwitchLights::HasTarget ( )
inlineprivate

Definition at line 21 of file ActionSwitchLights.c.

22 {
23 return false;
24 }

◆ OnExecuteServer()

override void ActionSwitchLights::OnExecuteServer ( ActionData action_data)
inlineprivate

Definition at line 60 of file ActionSwitchLights.c.

61 {
62 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
63 if (vehCommand)
64 {
65 Transport trans = vehCommand.GetTransport();
66 if (trans)
67 {
69 if (Class.CastTo(car, trans))
70 car.ToggleHeadlights();
71 }
72 }
73 }

References Class::CastTo().


The documentation for this class was generated from the following file: