Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionswitchlights.c
Go to the documentation of this file.
1
class
ActionSwitchLights
:
ActionInteractBase
2
{
3
void
ActionSwitchLights
()
4
{
5
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONMOD_HEADLIGHT;
6
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_CROUCH |
DayZPlayerConstants
.STANCEMASK_ERECT;
7
m_Text
=
"#switch_lights"
;
8
}
9
10
override
void
CreateConditionComponents
()
11
{
12
m_ConditionItem
=
new
CCINone
;
13
m_ConditionTarget
=
new
CCTNone
;
14
}
15
16
override
typename
GetInputType
()
17
{
18
return
ToggleLightsActionInput
;
19
}
20
21
override
bool
HasTarget
()
22
{
23
return
false
;
24
}
25
26
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
27
{
28
HumanCommandVehicle
vehCommand = player.GetCommand_Vehicle();
29
30
if
( vehCommand )
31
{
32
Transport
trans = vehCommand.
GetTransport
();
33
if
( trans )
34
{
35
CarScript
car;
36
if
(
Class
.
CastTo
(car, trans) )
37
{
38
if
( car.CrewMemberIndex( player ) ==
DayZPlayerConstants
.VEHICLESEAT_DRIVER )
39
{
40
if
( !car.IsScriptedLightsOn() )
41
{
42
EntityAI
neededItem = null;
43
44
if
( car.
IsVitalCarBattery
() ) neededItem = car.FindAttachmentBySlotName(
"CarBattery"
);
45
if
( car.
IsVitalTruckBattery
() ) neededItem = car.FindAttachmentBySlotName(
"TruckBattery"
);
46
47
if
(neededItem && !neededItem.IsRuined())
48
{
49
return
neededItem.GetCompEM() && neededItem.GetCompEM().GetEnergy() > 0;
50
}
51
}
52
else
53
{
54
return
true
;
55
}
56
}
57
}
58
}
59
}
60
61
return
false
;
62
}
63
64
override
void
OnExecuteServer
(
ActionData
action_data )
65
{
66
HumanCommandVehicle
vehCommand = action_data.m_Player.GetCommand_Vehicle();
67
if
( vehCommand )
68
{
69
Transport
trans = vehCommand.
GetTransport
();
70
if
( trans )
71
{
72
CarScript
car;
73
if
(
Class
.
CastTo
(car, trans) )
74
{
75
car.ToggleHeadlights();
76
}
77
}
78
}
79
}
80
81
override
bool
CanBeUsedInVehicle
()
82
{
83
return
true
;
84
}
85
};
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionInteractBase::ActionInteractBase
void ActionInteractBase()
Definition
actioninteractbase.c:43
ActionSwitchLights::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
actionswitchlights.c:64
ActionSwitchLights::ActionSwitchLights
void ActionSwitchLights()
Definition
actionswitchlights.c:3
ActionSwitchLights::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionswitchlights.c:10
ActionSwitchLights::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionswitchlights.c:26
ActionSwitchLights::GetInputType
override GetInputType()
Definition
actionswitchlights.c:16
ActionSwitchLights::HasTarget
override bool HasTarget()
Definition
actionswitchlights.c:21
ActionSwitchLights::CanBeUsedInVehicle
override bool CanBeUsedInVehicle()
Definition
actionswitchlights.c:81
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
CCINone
Definition
ccinone.c:2
CCTNone
Definition
cctnone.c:2
CarScript
Definition
civiliansedan.c:2
CarScript::IsVitalCarBattery
override bool IsVitalCarBattery()
Definition
truck_01_base.c:346
CarScript::IsVitalTruckBattery
override bool IsVitalTruckBattery()
Definition
civiliansedan.c:358
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
EntityAI
Definition
inventoryitem.c:2
HumanCommandVehicle
Definition
human.c:690
HumanCommandVehicle::GetTransport
proto native Transport GetTransport()
ItemBase
Definition
inventoryitem.c:742
PlayerBase
Definition
playerbaseclient.c:2
ToggleLightsActionInput
Definition
actioninput.c:748
Transport
Native class for boats - handles physics simulation.
Definition
boat.c:32
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
interact
vehicles
actionswitchlights.c
Generated by
1.17.0