DayZ 1.24
Loading...
Searching...
No Matches
CivilianSedan.c
Go to the documentation of this file.
2{
6
8 {
9 //m_dmgContactCoef = 0.065;
10
11 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
12 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
13 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
14 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
15 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
16
17 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
18 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
19
20 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
21 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
22
23 SetEnginePos("0 0.7 1.6");
24 }
25
26 override void EEInit()
27 {
28 super.EEInit();
29
30 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
31 {
33 m_UTSSettings.m_ManualUpdate = true;
34 m_UTSSettings.m_TemperatureMin = 0;
35 m_UTSSettings.m_TemperatureMax = 30;
36 m_UTSSettings.m_RangeFull = 0.5;
37 m_UTSSettings.m_RangeMax = 2;
38 m_UTSSettings.m_TemperatureCap = 25;
39
42 }
43 }
44
45 override void OnEngineStart()
46 {
47 super.OnEngineStart();
48
49 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
50 m_UTSource.SetDefferedActive(true, 20.0);
51 }
52
53 override void OnEngineStop()
54 {
55 super.OnEngineStop();
56
57 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
58 m_UTSource.SetDefferedActive(false, 10.0);
59 }
60
61 override void EOnPostSimulate(IEntity other, float timeSlice)
62 {
63 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
64 {
65 if (m_UTSource.IsActive())
67 }
68 }
69
70 override int GetAnimInstance()
71 {
72 return VehicleAnimInstances.SEDAN;
73 }
74
76 {
77 return 4.5;
78 }
79
80 override int GetSeatAnimationType(int posIdx)
81 {
82 switch (posIdx)
83 {
84 case 0:
85 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
86 case 1:
87 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
88 case 2:
89 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
90 case 3:
91 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
92 }
93
94 return 0;
95 }
96
97 // Override for car-specific light type
99 {
100 return CarLightBase.Cast(ScriptedLightBase.CreateLight(CivilianSedanFrontLight));
101 }
102
103 // Override for car-specific light type
105 {
106 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(CivilianSedanRearLight));
107 }
108
110 {
111 if (!super.CanReleaseAttachment(attachment))
112 return false;
113
114 string attType = attachment.GetType();
115
116 if (EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
117 {
118 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
119 return false;
120 }
121
122 return true;
123 }
124
125 override protected bool CanManipulateSpareWheel(string slotSelectionName)
126 {
127 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
128 }
129
131 {
132 //super
133 if (!super.CanDisplayAttachmentCategory(category_name))
134 return false;
135 //
136
137 category_name.ToLower();
138 if (category_name.Contains("engine"))
139 {
140 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
141 return false;
142 }
143
144 return true;
145 }
146
147 override bool CanDisplayCargo()
148 {
149 if (!super.CanDisplayCargo())
150 return false;
151
152 if (GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED)
153 return false;
154
155 return true;
156 }
157
158 override int GetCarDoorsState(string slotType)
159 {
161
162 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
163 if (!carDoor)
164 return CarDoorState.DOORS_MISSING;
165
166 switch (slotType)
167 {
168 case "CivSedanDriverDoors":
169 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
170 break;
171
172 case "CivSedanCoDriverDoors":
173 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
174 break;
175
176 case "CivSedanCargo1Doors":
177 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
178 break;
179
180 case "CivSedanCargo2Doors":
181 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
182 break;
183
184 case "CivSedanTrunk":
185 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
186 break;
187
188 case "CivSedanHood":
189 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
190 break;
191 }
192
193 return CarDoorState.DOORS_MISSING;
194 }
195
196
197 override bool CrewCanGetThrough(int posIdx)
198 {
199 switch (posIdx)
200 {
201 case 0:
202 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
203 return false;
204
205 return true;
206 break;
207
208 case 1:
209 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
210 return false;
211
212 return true;
213 break;
214
215 case 2:
216 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
217 return false;
218
219 return true;
220 break;
221
222 case 3:
223 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
224 return false;
225
226 return true;
227 break;
228 }
229
230 return false;
231 }
232
234 {
235 switch (posIdx)
236 {
237 case 0:
238 return "doors_driver";
239 break;
240 case 1:
241 return "doors_codriver";
242 break;
243 case 2:
244 return "doors_cargo1";
245 break;
246 case 3:
247 return "doors_cargo2";
248 break;
249 }
250
251 return super.GetDoorSelectionNameFromSeatPos(posIdx);
252 }
253
255 {
256 switch (posIdx)
257 {
258 case 0:
259 return "CivSedanDriverDoors";
260 break;
261 case 1:
262 return "CivSedanCoDriverDoors";
263 break;
264 case 2:
265 return "CivSedanCargo1Doors";
266 break;
267 case 3:
268 return "CivSedanCargo2Doors";
269 break;
270 }
271
272 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
273 }
274
275 // 0 full ambient and engine sound
276 // 1 zero ambient and engine sound
277 override float OnSound(CarSoundCtrl ctrl, float oldValue)
278 {
279 switch (ctrl)
280 {
281 case CarSoundCtrl.DOORS:
282 float newValue = 0;
283 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
284 newValue += 0.25;
285
286 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
287 newValue += 0.25;
288
289 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
290 newValue += 0.25;
291
292 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
293 newValue += 0.25;
294
295 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
296 newValue -= 0.6;
297
298 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
299 newValue -= 0.6;
300
301 return Math.Clamp(newValue, 0, 1);
302 break;
303 }
304
305 return super.OnSound(ctrl, oldValue);
306 }
307
308 override string GetAnimSourceFromSelection(string selection)
309 {
310 switch (selection)
311 {
312 case "doors_driver":
313 return "DoorsDriver";
314 case "doors_codriver":
315 return "DoorsCoDriver";
316 case "doors_cargo1":
317 return "DoorsCargo1";
318 case "doors_cargo2":
319 return "DoorsCargo2";
320 case "doors_hood":
321 return "DoorsHood";
322 case "doors_trunk":
323 return "DoorsTrunk";
324 }
325
326 return "";
327 }
328
329 override bool IsVitalTruckBattery()
330 {
331 return false;
332 }
333
334 override bool IsVitalGlowPlug()
335 {
336 return false;
337 }
338
340 {
341 switch (currentSeat)
342 {
343 case 0:
344 return nextSeat == 1;
345
346 case 1:
347 return nextSeat == 0;
348
349 case 2:
350 return nextSeat == 3;
351
352 case 3:
353 return nextSeat == 2;
354 }
355
356 return false;
357 }
358
360 {
361 switch (pCurrentSeat)
362 {
363 case 0:
364 return pDoorsSelection == "DoorsDriver";
365
366 case 1:
367 return pDoorsSelection == "DoorsCoDriver";
368
369 case 2:
370 return pDoorsSelection == "DoorsCargo1";
371
372 case 3:
373 return pDoorsSelection == "DoorsCargo2";
374 }
375
376 return false;
377 }
378
379 override void OnDebugSpawn()
380 {
384
385 GetInventory().CreateInInventory("CivSedanWheel");
386 GetInventory().CreateInInventory("CivSedanWheel");
387 GetInventory().CreateInInventory("CivSedanWheel");
388 GetInventory().CreateInInventory("CivSedanWheel");
389
390 GetInventory().CreateInInventory("CivSedanDoors_Driver");
391 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
392 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
393 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
394 GetInventory().CreateInInventory("CivSedanHood");
395 GetInventory().CreateInInventory("CivSedanTrunk");
396
397 //-----IN CAR CARGO
398 GetInventory().CreateInInventory("CivSedanWheel");
399 GetInventory().CreateInInventory("CivSedanWheel");
400 }
401
403 {
404 return 1.5;
405 }
406}
407
409{
410 override void OnDebugSpawn()
416 GetInventory().CreateInInventory("CivSedanWheel");
417 GetInventory().CreateInInventory("CivSedanWheel");
418 GetInventory().CreateInInventory("CivSedanWheel");
419 GetInventory().CreateInInventory("CivSedanWheel");
420
421 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
422 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
423 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
424 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
425 GetInventory().CreateInInventory("CivSedanHood_Wine");
426 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
427
428 //-----IN CAR CARGO
429 GetInventory().CreateInInventory("CivSedanWheel");
430 GetInventory().CreateInInventory("CivSedanWheel");
431 }
432}
433
435{
436 override void OnDebugSpawn()
437 {
441
442 GetInventory().CreateInInventory("CivSedanWheel");
443 GetInventory().CreateInInventory("CivSedanWheel");
444 GetInventory().CreateInInventory("CivSedanWheel");
445 GetInventory().CreateInInventory("CivSedanWheel");
446
447 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
448 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
449 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
450 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
451 GetInventory().CreateInInventory("CivSedanHood_Black");
452 GetInventory().CreateInInventory("CivSedanTrunk_Black");
454 //-----IN CAR CARGO
455 GetInventory().CreateInInventory("CivSedanWheel");
456 GetInventory().CreateInInventory("CivSedanWheel");
457 }
458}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition Car.c:4
void SpawnUniversalParts()
Definition CarScript.c:2516
CarDoorState TranslateAnimationPhaseToCarDoorState(string animation)
Definition CarScript.c:2241
CarDoorState
Definition CarScript.c:2
void SpawnAdditionalItems()
Definition CarScript.c:2554
string m_EngineStartOK
Sounds.
Definition CarScript.c:207
string m_CarDoorCloseSound
Definition CarScript.c:214
string m_EngineStartBattery
Definition CarScript.c:208
string m_EngineStartPlug
Definition CarScript.c:209
string m_EngineStartFuel
Definition CarScript.c:210
string m_CarHornShortSoundName
Definition CarScript.c:218
void FillUpCarFluids()
Definition CarScript.c:2578
string m_CarHornLongSoundName
Definition CarScript.c:219
string m_EngineStopFuel
Definition CarScript.c:211
string m_CarDoorOpenSound
Definition CarScript.c:213
ref UniversalTemperatureSourceSettings m_UTSSettings
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
ref UniversalTemperatureSource m_UTSource
override int GetCarDoorsState(string slotType)
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
VehicleAnimInstances
override float OnSound(CarSoundCtrl ctrl, float oldValue)
void CivilianSedan()
override float GetTransportCameraDistance()
override string GetDoorSelectionNameFromSeatPos(int posIdx)
override int GetAnimInstance()
override CarRearLightBase CreateRearLight()
override void OnDebugSpawn()
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
override CarLightBase CreateFrontLight()
override bool IsVitalGlowPlug()
override int GetCarDoorsState(string slotType)
override bool IsVitalTruckBattery()
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
override string GetAnimSourceFromSelection(string selection)
override bool CanDisplayCargo()
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
override void EOnPostSimulate(IEntity other, float timeSlice)
override void OnEngineStart()
override bool CanReleaseAttachment(EntityAI attachment)
override void EEInit()
override bool CrewCanGetThrough(int posIdx)
ref UniversalTemperatureSource m_UTSource
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
bool CanManipulateSpareWheel(string slotSelectionName)
override float GetPushForceCoefficientMultiplier()
override void OnEngineStop()
override bool CanDisplayAttachmentCategory(string category_name)
override int GetSeatAnimationType(int posIdx)
ref UniversalTemperatureSourceSettings m_UTSSettings
override void OnDebugSpawn()
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition EnMath.c:7
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.
const int STATE_RUINED
Definition constants.c:757
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.