Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actiongetintransport.c
Go to the documentation of this file.
2{
4 {
5 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
6 m_Text = "#get_in_vehicle";
7 }
8
9
10 override void CreateConditionComponents()
11 {
14 }
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 {
28 Transport trans = null;
29
30 if (!target)
31 {
32 return false;
33 }
34
35 if (!Class.CastTo(trans, target.GetObject()))
36 {
37 return false;
38 }
39
40 if (player.GetItemInHands() && player.GetItemInHands().IsHeavyBehaviour())
41 {
42 return false;
43 }
44
45 if (player.GetCommand_Vehicle())
46 {
47 return false;
48 }
49
50 int componentIndex = target.GetComponentIndex();
51 int crew_index = trans.CrewPositionIndex(componentIndex);
52 if (crew_index < 0)
53 {
54 return false;
55 }
56
57 Human crew = trans.CrewMember(crew_index);
58 if (crew)
59 {
60 return false;
61 }
62
63 if (!trans.CrewCanGetThrough(crew_index) || !trans.IsAreaAtDoorFree(crew_index))
64 {
65 return false;
66 }
67
68 array<string> selections = new array<string>();
69 trans.GetActionComponentNameList(componentIndex, selections);
70
71 for (int i = 0; i < selections.Count(); i++)
72 {
73 if (trans.CanReachSeatFromDoors(selections[i], player.GetPosition(), 1.0))
74 {
75 return true;
76 }
77 }
78
79 return false;
80 }
81
82 override void Start(ActionData action_data)
83 {
84 super.Start( action_data );
85
86 Transport trans = Transport.Cast(action_data.m_Target.GetObject());
87 int componentIndex = action_data.m_Target.GetComponentIndex();
88 int crew_index = trans.CrewPositionIndex(componentIndex);
89
90 int seat = trans.GetSeatAnimationType(crew_index);
91 HumanCommandVehicle vehCommand = action_data.m_Player.StartCommand_Vehicle(trans, crew_index, seat);
92 if (vehCommand)
93 {
94 vehCommand.SetVehicleType(trans.GetAnimInstance());
95
96 GetDayZGame().GetBacklit().OnEnterCar();
97 }
98 }
99
100 override void OnStartServer(ActionData action_data)
101 {
102 super.OnStartServer(action_data);
103
104 CarScript car = CarScript.Cast(action_data.m_Target.GetObject());
105 if (car)
106 {
107 car.ForceUpdateLightsStart();
108 }
109 }
110
111 override bool CanBeUsedInRestrain()
112 {
113 return true;
114 }
115
116 override void OnUpdate(ActionData action_data)
117 {
118 if (action_data.m_State == UA_START)
119 {
120 if (!action_data.m_Player.GetCommand_Vehicle() || !action_data.m_Player.GetCommand_Vehicle().IsGettingIn())
121 {
122 End(action_data);
123 }
124 }
125 }
126
127 override int GetActionCategory()
128 {
129 return AC_INTERACT;
130 }
131
132 override void OnEnd(ActionData action_data)
133 {
134 CarScript car = CarScript.Cast(action_data.m_Target.GetObject());
135 if (car && GetGame().IsServer())
136 {
137 car.ForceUpdateLightsEnd();
138 }
139 }
140
141 override bool AddActionJuncture(ActionData action_data)
142 {
143 Transport trans = Transport.Cast(action_data.m_Target.GetObject());
144 bool accepted = false;
145 int nextSeat = trans.CrewPositionIndex( action_data.m_Target.GetComponentIndex() );
146 Transport transport = Transport.Cast(action_data.m_Target.GetObject());
148 if (transport)
149 {
150 il.SetVehicle(transport, action_data.m_Player, nextSeat);
151
152 //Lock target
153 if (GetGame().AddInventoryJunctureEx(action_data.m_Player, action_data.m_Player, il, true, 10000))
154 {
155 accepted = true;
156 action_data.m_ReservedInventoryLocations.Insert(il);
157 }
158 }
159
160 return accepted;
161 }
162};
const int AC_INTERACT
Definition _constants.c:4
int m_StanceMask
Definition actionbase.c:62
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
Super root of all classes in Enforce script.
Definition enscript.c:11
InventoryLocation.
Native class for boats - handles physics simulation.
Definition boat.c:28
override bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
Definition car.c:117
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame GetDayZGame()
Definition dayzgame.c:3870
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
void Start()
Plays all elements this effects consists of.
Definition effect.c:157
void End()
called on surrender end request end
proto native CGame GetGame()
void OnEnd()
Definition sound.c:226
const int UA_START
Definition constants.c:469