DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionSwitchLights.c
См. документацию.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_HEADLIGHT;
6 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
7 m_Text = "#switch_lights";
8 }
9
11 {
14 }
15
16 override typename GetInputType()
17 {
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};
ActionBase ActionData
Определения ActionBase.c:30
class ActionTargets ActionTarget
int m_StanceMask
Определения ActionBase.c:62
string m_Text
Определения ActionBase.c:58
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
void ActionInteractBase()
Определения ActionInteractBase.c:43
override GetInputType()
Определения ActionSwitchLights.c:16
void ActionSwitchLights()
Определения ActionSwitchLights.c:3
override bool CanBeUsedInVehicle()
Определения ActionSwitchLights.c:81
override bool HasTarget()
Определения ActionSwitchLights.c:21
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionSwitchLights.c:26
override void CreateConditionComponents()
Определения ActionSwitchLights.c:10
override void OnExecuteServer(ActionData action_data)
Определения ActionSwitchLights.c:64
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения CCINone.c:2
Определения CCTNone.c:2
override bool IsVitalTruckBattery()
Определения CivilianSedan.c:348
override bool IsVitalCarBattery()
Определения Truck_01_Base.c:335
Определения CivilianSedan.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения Building.c:6
proto native Transport GetTransport()
Определения human.c:690
Определения InventoryItem.c:731
Определения PlayerBaseClient.c:2
Base native class for all motorized wheeled vehicles.
Определения Boat.c:28
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.