DayZ 1.24
Loading...
Searching...
No Matches
ActionGetInTransport.c
Go to the documentation of this file.
1class ActionGetInTransport: ActionBase
2{
4 {
5 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
6 m_Text = "#get_in_vehicle";
7 }
8
9
15
16 override typename GetInputType()
17 {
19 }
20
21 override bool HasProgress()
22 {
23 return false;
24 }
25
26 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
27 {
29
30 if (!target)
31 return false;
32
33 if (!Class.CastTo(trans, target.GetObject()))
34 return false;
35
36 if (player.GetItemInHands() && player.GetItemInHands().IsHeavyBehaviour())
37 return false;
38
39 if (player.GetCommand_Vehicle())
40 return false;
41
42 int componentIndex = target.GetComponentIndex();
43 int crew_index = trans.CrewPositionIndex(componentIndex);
44 if (crew_index < 0)
45 return false;
46
47 Human crew = trans.CrewMember(crew_index);
48 if (crew)
49 return false;
50
51 if (!trans.CrewCanGetThrough(crew_index) || !trans.IsAreaAtDoorFree(crew_index))
52 return false;
53
55 trans.GetActionComponentNameList(componentIndex, selections);
56
57 for (int i = 0; i < selections.Count(); i++)
58 {
59 if (trans.CanReachSeatFromDoors(selections[i], player.GetPosition(), 1.0))
60 return true;
61 }
62
63 return false;
64 }
65
67 {
68 super.Start(action_data);
69
70 Transport trans = Transport.Cast(action_data.m_Target.GetObject());
71 int componentIndex = action_data.m_Target.GetComponentIndex();
72 int crew_index = trans.CrewPositionIndex(componentIndex);
73
74
75 int seat = trans.GetSeatAnimationType(crew_index);
76 HumanCommandVehicle vehCommand = action_data.m_Player.StartCommand_Vehicle(trans, crew_index, seat);
77 if (vehCommand)
78 {
79 vehCommand.SetVehicleType(trans.GetAnimInstance());
80
81 GetDayZGame().GetBacklit().OnEnterCar();
82 if (action_data.m_Player.GetInventory())
83 action_data.m_Player.GetInventory().LockInventory(LOCK_FROM_SCRIPT);
84 }
85 }
86
88 {
89 CarScript car = CarScript.Cast(action_data.m_Target.GetObject());
90 if (car)
91 car.ForceUpdateLightsStart();
92 }
93
94 override bool CanBeUsedInRestrain()
95 {
96 return true;
97 }
98
100 {
101
102 if (action_data.m_State == UA_START)
103 {
104 if (!action_data.m_Player.GetCommand_Vehicle() || !action_data.m_Player.GetCommand_Vehicle().IsGettingIn())
106 }
107 }
108
109 override int GetActionCategory()
110 {
111 return AC_INTERACT;
112 }
113
115 {
116 if (action_data.m_Player.GetInventory())
117 action_data.m_Player.GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
118 }
119
121 {
122 if (action_data.m_Player.GetInventory())
123 action_data.m_Player.GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
124
125 CarScript car = CarScript.Cast(action_data.m_Target.GetObject());
126 if (car)
127 car.ForceUpdateLightsEnd();
128 }
129};
const int AC_INTERACT
Definition _constants.c:4
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
DayZGame GetDayZGame()
Definition DayZGame.c:3530
void End()
called on surrender end request end
override void Start(ActionData action_data)
override void OnEndServer(ActionData action_data)
override void OnStartServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void CreateConditionComponents()
override bool CanBeUsedInRestrain()
override void OnUpdate(ActionData action_data)
override void OnEndClient(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
Base native class for all motorized wheeled vehicles.
Definition Car.c:75
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int UA_START
Definition constants.c:439