DayZ 1.24
Loading...
Searching...
No Matches
Transport.c
Go to the documentation of this file.
1
4class Transport extends EntityAI
5{
9
10 void Transport()
11 {
12 }
13
14 override int GetMeleeTargetType()
15 {
16 return EMeleeTargetType.NONALIGNABLE;
17 }
18
19
22
23
26
30
34
38
40 proto void CrewEntry(int posIdx, out vector pos, out vector dir);
41
44
47
50
53
56
59
60 override bool IsTransport()
61 {
62 return true;
63 }
64
66 {
67 return false;
68 }
69
70 override bool IsHealthVisible()
71 {
72 return true;
73 }
74
75 override bool ShowZonesHealth()
76 {
77 return true;
78 }
79
81 {
82 for (int index = 0; index < CrewSize(); ++index)
83 {
84 if (CrewMember(index) != null)
85 return true;
86 }
87
88 return false;
89 }
90
92 {
93 return 4.0;
94 }
95
99
101 {
102 return "0 1.3 0";
103 }
104
106 {
107#ifndef CFGMODS_DEFINE_TEST
108 Error("GetAnimInstance() not implemented");
109 return 0;
110#else
111 return 2;
112#endif
113 }
114
116 {
117#ifndef CFGMODS_DEFINE_TEST
118 Error("GetSeatAnimationType() not implemented");
119#endif
120 return 0;
121 }
122
124 {
125#ifndef CFGMODS_DEFINE_TEST
126 Error("Get3rdPersonCameraType() not implemented");
127 return 0;
128#else
129 return 31;
130#endif
131 }
132
134 {
135#ifndef CFGMODS_DEFINE_TEST
136 return false;
137#else
138 return true;
139#endif
140 }
141
143 {
144#ifndef CFGMODS_DEFINE_TEST
145 return false;
146#else
147 return true;
148#endif
149 }
150
152 {
153#ifndef CFGMODS_DEFINE_TEST
154 return false;
155#else
156 return true;
157#endif
158 }
159
161 {
162#ifndef CFGMODS_DEFINE_TEST
163 return false;
164#else
165 return true;
166#endif
167 }
168
170 {
171 //Potientially could be fixed some other way, currently follows the unfortunate pattern that CanReachDoorsFromSeat has created
172 switch (pDoorSelection)
173 {
174 case "DoorsDriver":
175 return 0;
176 break;
177 case "DoorsCoDriver":
178 return 1;
179 break;
180 case "DoorsCargo1":
181 return 2;
182 break;
183 case "DoorsCargo2":
184 return 3;
185 break;
186 }
187 return -1;
188 }
189
191 {
192 if (!o)
193 return false;
194
198 if (!interacts)
199 return true;
200
202 if (Class.CastTo(player, o))
203 {
205 HumanCommandVehicle hcv = player.GetCommand_Vehicle();
206 if (hcv && hcv.GetTransport() == this)
207 return true;
208 }
209
210 EntityAI e = EntityAI.Cast(o);
211 // CanBeSkinned means it is a dead entity which should not block the door
212 return ((e && (e.IsZombie() || e.IsHologram())) || o.CanBeSkinned() || o.IsBush() || o.IsTree());
213 }
214
216 {
217 GetTransform(transform);
218
221 CrewEntry(currentSeat, crewPos, crewDir);
222
223 vector entry[4];
224 entry[2] = crewDir;
225 entry[0] = vector.Up * crewDir;
226 entry[1] = entry[2] * entry[0];
227 entry[3] = crewPos;
228
230
233
234 position[1] = position[1] + maxAllowedObjHeight + (extents[1] * 0.5);
235
238
239 excluded.Insert(this);
240
241 GetGame().IsBoxColliding(position, orientation, extents, excluded, collided);
242
243 orientation.RotationMatrixFromAngles(transform);
244 transform[3] = position;
245
246 foreach (Object o : collided)
247 {
248 EntityAI e = EntityAI.Cast(o);
249 if (IsIgnoredObject(o))
250 continue;
251
252 vector minmax[2];
253 if (o.GetCollisionBox(minmax))
254 return false;
255 }
256
257 return true;
258 }
259
271
273 {
274 int color = ARGB(20, 0, 255, 0);
275
276 vector transform[4];
278
282
284 color = ARGB(20, 255, 0, 0);
285
286 Shape shape = Debug.DrawBox(-extents * 0.5, extents * 0.5, color);
287 shape.SetMatrix(transform);
288 return shape;
289 }
290};
PhxInteractionLayers
Definition DayZPhysics.c:2
ECrewMemberState
EMeleeTargetType
ref TIntArray m_InteractActions
Definition ItemBase.c:4764
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Debug.c:14
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Definition Debug.c:401
bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Definition Transport.c:142
ref TIntArray m_SingleUseActions
Definition Transport.c:6
override bool IsHealthVisible()
Definition Transport.c:70
int GetAnimInstance()
Definition Transport.c:105
proto void CrewEntryWS(int posIdx, out vector pos, out vector dir)
Reads entry point and direction into vehicle on given position in world space.
proto void CrewEntry(int posIdx, out vector pos, out vector dir)
Reads entry point and direction into vehicle on given position in model space.
override bool ShowZonesHealth()
Definition Transport.c:75
proto native Human CrewMember(int posIdx)
proto void CrewTransform(int posIdx, out vector mat[4])
Returns crew transformation indside vehicle in model space.
proto native Human CrewGetOut(int posIdx)
Performs transfer of player from vehicle into world from given position.
float GetTransportCameraDistance()
Definition Transport.c:91
override int GetMeleeTargetType()
Definition Transport.c:14
void HandleByCrewMemberState(ECrewMemberState state)
void MarkCrewMemberUnconscious(int crewMemberIndex)
proto native int CrewPositionIndex(int componentIdx)
proto native int CrewMemberIndex(Human player)
bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight, inout vector extents, out vector transform[4])
Definition Transport.c:215
override bool IsTransport()
Definition Transport.c:60
proto native void Synchronize()
Synchronizes car's state in case the simulation is not running.
bool IsAnyCrewPresent()
Definition Transport.c:80
proto void CrewTransformWS(int posIdx, out vector mat[4])
Returns crew transformation indside vehicle in world space.
vector GetTransportCameraOffset()
Definition Transport.c:100
proto native int CrewSize()
Returns crew capacity of this vehicle.
bool CrewCanGetThrough(int posIdx)
Definition Transport.c:133
int GetSeatIndexFromDoor(string pDoorSelection)
Definition Transport.c:169
proto native void CrewGetIn(Human player, int posIdx)
Performs transfer of player from world into vehicle on given position.
ref TIntArray m_ContinuousActions
Definition Transport.c:7
Shape DebugFreeAreaAtDoor(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
Definition Transport.c:272
int GetSeatAnimationType(int posIdx)
Definition Transport.c:115
bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
Definition Transport.c:260
int Get3rdPersonCameraType()
Definition Transport.c:123
void Transport()
Definition Transport.c:10
void MarkCrewMemberDead(int crewMemberIndex)
override bool IsIgnoredByConstruction()
Definition Transport.c:65
bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Definition Transport.c:160
bool CanReachSeatFromDoors(string pSeatSelection, vector pFromPos, float pDistance=1.0)
Definition Transport.c:151
proto native void CrewDeath(int posIdx)
Handles death of player in vehicle and awakes its physics if needed.
bool IsIgnoredObject(Object o)
Definition Transport.c:190
Base native class for all motorized wheeled vehicles.
Definition Car.c:75
override bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
Definition Car.c:88
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static const vector Up
Definition EnConvert.c:107
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto vector MatrixToAngles(vector mat[3])
Returns angles of rotation matrix.
static proto void MatrixMultiply4(vector mat0[4], vector mat1[4], out vector res[4])
Transforms matrix.
proto native bool dGetInteractionLayer(notnull IEntity worldEntity, int mask1, int mask2)
proto native int dBodyGetInteractionLayer(notnull IEntity ent)
int ARGB(int a, int r, int g, int b)
Definition proto.c:322