DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Vehicles/InheritedCars/Offroad_02.c
См. документацию.
2{
6
7 void Offroad_02()
8 {
9 //m_dmgContactCoef = 0.0365;
10
11 m_EngineStartOK = "Offroad_02_engine_start_SoundSet";
12 m_EngineStartBattery = "Offroad_02_engine_failed_start_battery_SoundSet";
13 m_EngineStartPlug = "Offroad_02_engine_failed_start_sparkplugs_SoundSet";
14 m_EngineStartFuel = "Offroad_02_engine_failed_start_fuel_SoundSet";
15 m_EngineStop = "Offroad_02_engine_stop_SoundSet";
16 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
17
18 m_CarDoorOpenSound = "offroad_02_door_open_SoundSet";
19 m_CarDoorCloseSound = "offroad_02_door_close_SoundSet";
20
21 m_LightsComponent.RegisterLight("Front", new VehicleLightData(new Offroad_02LightProfileFront()));
22 m_LightsComponent.RegisterLight("Rear", new VehicleLightData(new Offroad_02LightProfileRear()));
23
24 m_LightsComponent.RegisterSelection("BrakesOn", {
25 new VehicleLightSelectionData(SELECTION_ID_TAIL_LIGHT_L, "brakeReflectorMatOn"),
26 new VehicleLightSelectionData(SELECTION_ID_TAIL_LIGHT_R, "brakeReflectorMatOn"),
27 });
28 m_LightsComponent.RegisterSelection("BrakesOff", {
29 new VehicleLightSelectionData(SELECTION_ID_TAIL_LIGHT_L, "brakeReflectorMatOff"),
30 new VehicleLightSelectionData(SELECTION_ID_TAIL_LIGHT_R, "brakeReflectorMatOff"),
31 });
32
33 m_HornComponent.RegisterSound(VehicleHornMode.SHORT, "Offroad_02_Horn_Short_SoundSet");
34 m_HornComponent.RegisterSound(VehicleHornMode.LONG, "Offroad_02_Horn_SoundSet");
35
36 SetEnginePos("0 0.7 1.7");
37
39 m_CarHornShortSoundName = "Offroad_02_Horn_Short_SoundSet";
40 m_CarHornLongSoundName = "Offroad_02_Horn_SoundSet";
41 }
42
44 {
45 m_UTSource = null;
46 m_UTSSettings = null;
47 m_UTSLEngine = null;
48 }
49
50 override void EEInit()
51 {
52 super.EEInit();
53
54 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
55 {
57 m_UTSSettings.m_ManualUpdate = true;
59 m_UTSSettings.m_TemperatureCap = 0;
60 m_UTSSettings.m_RangeFull = 0.5;
61 m_UTSSettings.m_RangeMax = 2;
62
65 }
66 }
67
69 {
70 return true;
71 }
72
74 {
75 return true;
76 }
77
79 {
80 super.GetElectricitySourceDevice();
81
82 return GetInventory().FindAttachment(CarBattery.SLOT_ID);
83 }
84
86 {
87 return "CarBattery";
88 }
89
90 override void OnEngineStart()
91 {
92 super.OnEngineStart();
93
94 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
95 {
96 if (m_UTSource)
97 m_UTSource.SetDefferedActive(true, 20.0);
98 }
99 }
100
101 override void OnEngineStop()
102 {
103 super.OnEngineStop();
104
105 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
106 {
107 if (m_UTSource)
108 m_UTSource.SetDefferedActive(false, 10.0);
109 }
110 }
111
112 override void EOnPostSimulate(IEntity other, float timeSlice)
113 {
114 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
115 {
116 if (m_UTSource && m_UTSource.IsActive())
117 {
119 }
120 }
121 }
122
123 override int GetAnimInstance()
124 {
125 return VehicleAnimInstances.HMMWV;
126 }
127
129 {
130 return 5.1;
131 }
132
133 override float GetWeightCoef()
134 {
135 return 1.5;
136 }
137
138 override int GetSeatAnimationType(int posIdx)
139 {
140 switch (posIdx)
141 {
142 case 0:
143 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
144 case 1:
145 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
146 case 2:
147 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
148 case 3:
149 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
150 }
151
152 return 0;
153 }
154
155 override bool CanReleaseAttachment( EntityAI attachment )
156 {
157 if (!super.CanReleaseAttachment(attachment))
158 {
159 return false;
160 }
161
162 string attType = attachment.GetType();
163 switch (attType)
164 {
165 case "CarBattery":
166 if (GetCarDoorsState("Offroad_02_Hood") == CarDoorState.DOORS_CLOSED || EngineIsOn())
167 {
168 return false;
169 }
170 break;
171
172 case "GlowPlug":
173 if (GetCarDoorsState("Offroad_02_Hood") == CarDoorState.DOORS_CLOSED || EngineIsOn())
174 {
175 return false;
176 }
177 break;
178 }
179
180 return true;
181 }
182
183 override protected bool CanManipulateSpareWheel(string slotSelectionName)
184 {
185 return GetCarDoorsState("Offroad_02_Trunk") != CarDoorState.DOORS_CLOSED;
186 }
187
188 override bool CanDisplayAttachmentCategory(string category_name)
189 {
190 if ( !super.CanDisplayAttachmentCategory(category_name))
191 {
192 return false;
193 }
194
195 category_name.ToLower();
196 if (category_name.Contains("engine"))
197 {
198 if (GetCarDoorsState("Offroad_02_Hood") == CarDoorState.DOORS_CLOSED)
199 {
200 return false;
201 }
202 }
203
204 return true;
205 }
206
207 override bool CanDisplayCargo()
208 {
209 if ( !super.CanDisplayCargo() )
210 return false;
211
212 if ( GetCarDoorsState("Offroad_02_Trunk") == CarDoorState.DOORS_CLOSED )
213 return false;
214
215 return true;
216 }
217
218 override int GetCarDoorsState(string slotType)
219 {
220 CarDoor carDoor;
221
222 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
223 if (!carDoor)
224 {
225 return CarDoorState.DOORS_MISSING;
226 }
227
228 switch (slotType)
229 {
230 case "Offroad_02_Door_1_1":
231 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
232
233 case "Offroad_02_Door_2_1":
234 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
235
236 case "Offroad_02_Door_1_2":
237 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
238
239 case "Offroad_02_Door_2_2":
240 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
241
242 case "Offroad_02_Hood":
243 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
244
245 case "Offroad_02_Trunk":
246 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
247 }
248
249 return CarDoorState.DOORS_MISSING;
250 }
251
252
253 override bool CrewCanGetThrough( int posIdx )
254 {
255 switch( posIdx )
256 {
257 case 0:
258 if ( GetCarDoorsState("Offroad_02_Door_1_1") == CarDoorState.DOORS_CLOSED )
259 return false;
260
261 return true;
262 break;
263
264 case 1:
265 if ( GetCarDoorsState("Offroad_02_Door_2_1") == CarDoorState.DOORS_CLOSED )
266 return false;
267
268 return true;
269 break;
270
271 case 2:
272 if ( GetCarDoorsState("Offroad_02_Door_1_2") == CarDoorState.DOORS_CLOSED )
273 return false;
274
275 return true;
276 break;
277
278 case 3:
279 if ( GetCarDoorsState("Offroad_02_Door_2_2") == CarDoorState.DOORS_CLOSED )
280 return false;
281
282 return true;
283 break;
284 }
285
286 return false;
287 }
288
289 override string GetDoorSelectionNameFromSeatPos(int posIdx)
290 {
291 switch( posIdx )
292 {
293 case 0:
294 return "doors_driver";
295 break;
296 case 1:
297 return "doors_codriver";
298 break;
299 case 2:
300 return "doors_cargo1";
301 break;
302 case 3:
303 return "doors_cargo2";
304 break;
305 }
306
307 return super.GetDoorSelectionNameFromSeatPos(posIdx);
308 }
309
310 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
311 {
312 switch (posIdx)
313 {
314 case 0:
315 return "Offroad_02_Door_1_1";
316 case 1:
317 return "Offroad_02_Door_2_1";
318 case 2:
319 return "Offroad_02_Door_1_2";
320 case 3:
321 return "Offroad_02_Door_2_2";
322 }
323
324 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
325 }
326
327 override float OnSound(CarSoundCtrl ctrl, float oldValue)
328 {
329 switch ( ctrl )
330 {
331 case CarSoundCtrl.DOORS:
332 float newValue = 0;
333 if (GetCarDoorsState("Offroad_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
334 {
335 newValue += 0.25;
336 }
337
338 if (GetCarDoorsState("Offroad_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
339 {
340 newValue += 0.25;
341 }
342
343 if (GetCarDoorsState("Offroad_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
344 {
345 newValue += 0.25;
346 }
347
348 if (GetCarDoorsState("Offroad_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
349 {
350 newValue += 0.25;
351 }
352
353 return Math.Clamp(newValue, 0, 1);
354 break;
355 }
356
357 return super.OnSound(ctrl, oldValue);
358 }
359
360 override string GetAnimSourceFromSelection(string selection)
361 {
362 switch (selection)
363 {
364 case "doors_driver":
365 return "DoorsDriver";
366 case "doors_codriver":
367 return "DoorsCoDriver";
368 case "doors_cargo1":
369 return "DoorsCargo1";
370 case "doors_cargo2":
371 return "DoorsCargo2";
372 case "doors_hood":
373 return "DoorsHood";
374 case "doors_trunk":
375 return "DoorsTrunk";
376 }
377
378 return "";
379 }
380
381 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
382 {
383 switch (currentSeat)
384 {
385 case 0:
386 return nextSeat == 1;
387 case 1:
388 return nextSeat == 0;
389 case 2:
390 return nextSeat == 3;
391 case 3:
392 return nextSeat == 2;
393 }
394
395 return false;
396 }
397
398 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
399 {
400 switch (pCurrentSeat)
401 {
402 case 0:
403 return pDoorsSelection == "DoorsDriver";
404 case 1:
405 return pDoorsSelection == "DoorsCoDriver";
406 case 2:
407 return pDoorsSelection == "DoorsCargo1";
408 case 3:
409 return pDoorsSelection == "DoorsCargo2";
410 }
411
412 return false;
413 }
414
415 override bool IsVitalSparkPlug()
416 {
417 return false;
418 }
419
420 override bool IsVitalRadiator()
421 {
422 return false;
423 }
424
425 override void OnDebugSpawn()
426 {
428 SpawnAdditionalItems();
429 FillUpCarFluids();
430
431 GameInventory inventory = GetInventory();
432 inventory.CreateInInventory("Offroad_02_Wheel");
433 inventory.CreateInInventory("Offroad_02_Wheel");
434 inventory.CreateInInventory("Offroad_02_Wheel");
435 inventory.CreateInInventory("Offroad_02_Wheel");
436
437 inventory.CreateInInventory("Offroad_02_Door_1_1");
438 inventory.CreateInInventory("Offroad_02_Door_1_2");
439 inventory.CreateInInventory("Offroad_02_Door_2_1");
440 inventory.CreateInInventory("Offroad_02_Door_2_2");
441 inventory.CreateInInventory("Offroad_02_Hood");
442 inventory.CreateInInventory("Offroad_02_Trunk");
443
444 //-----IN CAR CARGO
445 inventory.CreateInInventory("Offroad_02_Wheel");
446 inventory.CreateInInventory("Offroad_02_Wheel");
447 }
448}
449
450
451class Offroad_02_Beige : Offroad_02
452{
453 override void OnDebugSpawn()
456 SpawnAdditionalItems();
457 FillUpCarFluids();
459 GetInventory().CreateInInventory("Offroad_02_Wheel");
460 GetInventory().CreateInInventory("Offroad_02_Wheel");
461 GetInventory().CreateInInventory("Offroad_02_Wheel");
462 GetInventory().CreateInInventory("Offroad_02_Wheel");
463
464 GetInventory().CreateInInventory("Offroad_02_Door_1_1_Beige");
465 GetInventory().CreateInInventory("Offroad_02_Door_1_2_Beige");
466 GetInventory().CreateInInventory("Offroad_02_Door_2_1_Beige");
467 GetInventory().CreateInInventory("Offroad_02_Door_2_2_Beige");
468 GetInventory().CreateInInventory("Offroad_02_Trunk_Beige");
469 GetInventory().CreateInInventory("Offroad_02_Hood_Beige");
470
471 //-----IN CAR CARGO
472 GetInventory().CreateInInventory("Offroad_02_Wheel");
473 GetInventory().CreateInInventory("Offroad_02_Wheel");
474 }
475}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Определения Car.c:4
CarDoorState
Определения CarScript.c:2
DayZGame g_Game
Определения DayZGame.c:4074
proto native void SetEnginePos(vector pos)
Override the position of engine (model space)
proto native bool EngineIsOn()
Returns true when engine is running, false otherwise.
void SpawnUniversalParts()
Определения MotorbikeScript.c:1425
string m_EngineStartOK
Определения MotorbikeScript.c:89
string m_EngineStartBattery
Определения MotorbikeScript.c:90
string m_EngineStartPlug
Определения MotorbikeScript.c:91
string m_EngineStartFuel
Определения MotorbikeScript.c:92
ref VehicleHornComponent m_HornComponent
Определения MotorbikeScript.c:75
string m_EngineStopFuel
Определения MotorbikeScript.c:94
ref VehicleLightsComponent m_LightsComponent
Определения MotorbikeScript.c:74
string m_EngineStop
Определения MotorbikeScript.c:93
Offroad_02LightProfileFront VehicleLightProfileFront Offroad_02LightProfileRear()
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase UniversalTemperatureSourceLambdaEngine()
VehicleAnimInstances
Определения VehicleAnimInstances.c:2
void VehicleLightData(VehicleLightProfileBase profile)
Определения VehicleLightsComponent.c:21
static int SLOT_ID
Определения CarBattery.c:3
Определения CarBattery.c:2
Определения Truck_02.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
script counterpart to engine's class Inventory
Определения EnEntity.c:165
Определения EnMath.c:7
override int GetAnimInstance()
override void OnDebugSpawn()
override bool IsVitalRadiator()
bool CanManipulateSpareWheel(string slotSelectionName)
override void OnEngineStart()
void ~Offroad_02()
override bool CanReleaseAttachment(EntityAI attachment)
override int GetCarDoorsState(string slotType)
override void EEInit()
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
override float GetWeightCoef()
ref UniversalTemperatureSourceSettings m_UTSSettings
override void OnEngineStop()
void Offroad_02()
override float GetTransportCameraDistance()
override EntityAI GetElectricitySourceDevice()
override string GetElectricitySourceDeviceType()
override void EOnPostSimulate(IEntity other, float timeSlice)
ref UniversalTemperatureSource m_UTSource
override bool CrewCanGetThrough(int posIdx)
override bool CanDisplayCargo()
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
override bool IsVitalSparkPlug()
override int GetSeatAnimationType(int posIdx)
override bool HasGangedTailAndBrakeLights()
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
override float OnSound(CarSoundCtrl ctrl, float oldValue)
override bool CanDisplayAttachmentCategory(string category_name)
override bool NeedElectricitySourceDevice()
override string GetDoorSelectionNameFromSeatPos(int posIdx)
override string GetAnimSourceFromSelection(string selection)
original Timer deletes m_params which is unwanted
Определения UniversalTemperatureSource.c:39
const int LONG
Определения VehicleHornComponent.c:5
const int SHORT
Определения VehicleHornComponent.c:4
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/DayZ/constants.c:856
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'.
bool Contains(string sample)
Returns true if sample is substring of string.
Определения EnString.c:286
proto int ToLower()
Changes string to lowercase. Returns length.