DayZ 1.24
Loading...
Searching...
No Matches
Van_01.c
Go to the documentation of this file.
1class Van_01 extends CarScript
2{
6
7 void Van_01()
8 {
9 //m_dmgContactCoef = 0.070; //TODO::Set proper value
10 }
11
12 override void EEInit()
13 {
14 super.EEInit();
15
16 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
17 {
19 m_UTSSettings.m_ManualUpdate = true;
20 m_UTSSettings.m_TemperatureMin = 0;
21 m_UTSSettings.m_TemperatureMax = 30;
22 m_UTSSettings.m_RangeFull = 0.5;
23 m_UTSSettings.m_RangeMax = 2;
24 m_UTSSettings.m_TemperatureCap = 25;
25
28 }
29 }
30
31 override void OnEngineStart()
32 {
33 super.OnEngineStart();
34
35 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
36 m_UTSource.SetDefferedActive(true, 20.0);
37 }
38
39 override void OnEngineStop()
40 {
41 super.OnEngineStop();
42
43 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
44 m_UTSource.SetDefferedActive(false, 10.0);
45 }
46
47 override void EOnPostSimulate(IEntity other, float timeSlice)
48 {
49 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
50 {
51 if (m_UTSource.IsActive())
53 }
54 }
55
56 //-----------------------------------------------------------
57 override int GetAnimInstance()
58 {
59 return VehicleAnimInstances.CIVVAN;
60 }
61
62 //-----------------------------------------------------------
63 override int GetSeatAnimationType(int posIdx)
64 {
65 switch (posIdx)
66 {
67 case 0:
68 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
69 case 1:
70 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
71 case 2:
72 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
73 case 3:
74 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
75 case 4:
76 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
77 }
78
79 return 0;
80 }
81
82 //-----------------------------------------------------------
83 override int GetCarDoorsState(string slotType)
84 {
86
87 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
88 if (!carDoor)
89 return CarDoorState.DOORS_MISSING;
90
91 switch (slotType)
92 {
93 case "Van_01_Door_1_1":
94 if (GetAnimationPhase("DoorsDriver") > 0.5)
95 return CarDoorState.DOORS_OPEN;
96 else
97 return CarDoorState.DOORS_CLOSED;
98
99 break;
100
101 case "Van_01_Door_2_1":
102 if (GetAnimationPhase("DoorsCoDriver") > 0.5)
103 return CarDoorState.DOORS_OPEN;
104 else
105 return CarDoorState.DOORS_CLOSED;
106
107 break;
108
109 case "Van_01_Door_2_2":
110 if (GetAnimationPhase("DoorsCargo1") > 0.5)
111 return CarDoorState.DOORS_OPEN;
112 else
113 return CarDoorState.DOORS_CLOSED;
114
115 break;
116
117 case "Van_01_Trunk_1":
118 if (GetAnimationPhase("DoorsCargo3") > 0.5)
119 return CarDoorState.DOORS_OPEN;
120 else
121 return CarDoorState.DOORS_CLOSED;
122 break;
123
124 case "Van_01_Trunk_2":
125 if (GetAnimationPhase("DoorsCargo2") > 0.5)
126 return CarDoorState.DOORS_OPEN;
127 else
128 return CarDoorState.DOORS_CLOSED;
129
130 break;
131 }
132
133 return CarDoorState.DOORS_MISSING;
134 }
135
136 //-----------------------------------------------------------
137 override bool CrewCanGetThrough(int posIdx)
138 {
139 switch (posIdx)
140 {
141 case 0:
142 if (GetCarDoorsState("Van_01_Door_1_1") == CarDoorState.DOORS_CLOSED)
143 return false;
144
145 return true;
146 break;
147
148 case 1:
149 if (GetCarDoorsState("Van_01_Door_2_1") == CarDoorState.DOORS_CLOSED)
150 return false;
151
152 return true;
153 break;
154
155 case 2:
156 if (GetCarDoorsState("Van_01_Door_2_2") == CarDoorState.DOORS_CLOSED)
157 return false;
158
159 return true;
160 break;
161
162 case 3:
163 if (GetCarDoorsState("Van_01_Door_2_2") == CarDoorState.DOORS_CLOSED)
164 return false;
165
166 case 4:
167 if (GetCarDoorsState("Van_01_Door_2_2") == CarDoorState.DOORS_CLOSED)
168 return false;
169
170 return true;
171 break;
172 }
173
174 return false;
175 }
176
177 //-----------------------------------------------------------
178 override float OnSound(CarSoundCtrl ctrl, float oldValue)
179 {
180 switch (ctrl)
181 {
182 case CarSoundCtrl.DOORS:
183 float newValue = 0;
184
185 //-----
186 if (GetCarDoorsState("Van_01_Door_1_1") == CarDoorState.DOORS_CLOSED)
187 newValue += 0.25;
188
189 //-----
190 if (GetCarDoorsState("Van_01_Door_2_1") == CarDoorState.DOORS_CLOSED)
191 newValue += 0.25;
192
193 //-----
194 if (GetCarDoorsState("Van_01_Door_2_2") == CarDoorState.DOORS_CLOSED)
195 newValue += 0.25;
196
197 //-----
198 if (GetCarDoorsState("Van_01_Trunk_1") == CarDoorState.DOORS_CLOSED)
199 newValue += 0.125;
200
201 //-----
202 if (GetCarDoorsState("Van_01_Trunk_2") == CarDoorState.DOORS_CLOSED)
203 newValue += 0.125;
204
205 if (newValue > 1)
206 newValue = 1;
207
208 return newValue;
209 break;
210 }
211
212 return oldValue;
213 }
214
215 //-----------------------------------------------------------
216 override string GetAnimSourceFromSelection(string selection)
217 {
218 switch (selection)
219 {
220 case "doors_driver":
221 return "DoorsDriver";
222 case "doors_codriver":
223 return "DoorsCoDriver";
224 case "doors_cargo1":
225 return "DoorsCargo1";
226 case "doors_cargo2":
227 return "DoorsCargo2";
228 case "doors_cargo3":
229 return "DoorsCargo3";
230 case "doors_hood":
231 return "DoorsHood";
232 }
233
234 return "";
235 }
236
237 //-----------------------------------------------------------
238 override string GetDoorConditionPointFromSelection(string selection)
239 {
240 switch (selection)
241 {
242 case "seat_driver":
243 return "seat_con_1_1";
244 break;
245 case "seat_codriver":
246 return "seat_con_2_1";
247 break;
248 case "seat_cargo1":
249 case "seat_cargo2":
250 case "seat_cargo3":
251 return "seat_con_1_2";
252 break;
253 }
254
255 return "";
256 };
257
258 //-----------------------------------------------------------
259 override bool IsVitalTruckBattery()
260 {
261 return false;
262 }
263
264 //-----------------------------------------------------------
265 override bool IsVitalGlowPlug()
266 {
267 return false;
268 }
269
270 //-----------------------------------------------------------
272 {
273 switch (currentSeat)
274 {
275 case 0:
276 if (nextSeat == 1)
277 return true;
278 break;
279 case 1:
280 if (nextSeat == 0)
281 return true;
282 break;
283 case 2:
284 if (nextSeat == 3)
285 return true;
286 break;
287 case 3:
288 if (nextSeat == 2)
289 return true;
290 break;
291 }
292
293 return false;
294 }
295
296 //-----------------------------------------------------------
298 {
299 switch (pCurrentSeat)
300 {
301 case 0:
302 if (pDoorsSelection == "DoorsDriver")
303 return true;
304 break;
305 case 1:
306 if (pDoorsSelection == "DoorsCoDriver")
307 return true;
308 break;
309 case 2:
310 if (pDoorsSelection == "DoorsCargo1")
311 return true;
312 break;
313 case 3:
314 if (pDoorsSelection == "DoorsCargo2")
315 return true;
316 break;
317 }
318
319 return false;
320 }
321}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition Car.c:4
CarDoorState
Definition CarScript.c:2
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
ref UniversalTemperatureSourceSettings m_UTSSettings
ref UniversalTemperatureSource m_UTSource
VehicleAnimInstances
override float OnSound(CarSoundCtrl ctrl, float oldValue)
Definition Van_01.c:178
override int GetAnimInstance()
Definition Van_01.c:57
override string GetDoorConditionPointFromSelection(string selection)
Definition Van_01.c:238
override bool IsVitalGlowPlug()
Definition Van_01.c:265
override int GetCarDoorsState(string slotType)
Definition Van_01.c:83
override bool IsVitalTruckBattery()
Definition Van_01.c:259
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
override string GetAnimSourceFromSelection(string selection)
Definition Van_01.c:216
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Definition Van_01.c:297
override void EOnPostSimulate(IEntity other, float timeSlice)
Definition Van_01.c:47
override void OnEngineStart()
Definition Van_01.c:31
override void EEInit()
Definition Van_01.c:12
override bool CrewCanGetThrough(int posIdx)
Definition Van_01.c:137
ref UniversalTemperatureSource m_UTSource
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Definition Van_01.c:271
override void OnEngineStop()
Definition Van_01.c:39
override int GetSeatAnimationType(int posIdx)
Definition Van_01.c:63
ref UniversalTemperatureSourceSettings m_UTSSettings
void Van_01()
Definition Van_01.c:7
Super root of all classes in Enforce script.
Definition EnScript.c:11
original Timer deletes m_params which is unwanted
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.