Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
truck_01_base.c
Go to the documentation of this file.
1class Truck_01_Base extends CarScript
2{
6
8 {
9 //m_dmgContactCoef = 0.018;
10 m_enginePtcPos = "0 1.346 2.205";
11
12 m_EngineStartOK = "Truck_01_engine_start_SoundSet";
13 m_EngineStartBattery = "Truck_01_engine_failed_start_battery_SoundSet";
14 m_EngineStartPlug = "Truck_01_engine_failed_start_sparkplugs_SoundSet";
15 m_EngineStartFuel = "Truck_01_engine_failed_start_fuel_SoundSet";
16 m_EngineStop = "Truck_01_engine_stop_SoundSet";
17 m_EngineStopFuel = "Truck_01_engine_stop_fuel_SoundSet";
18
19 m_CarDoorOpenSound = "Truck_01_door_open_SoundSet";
20 m_CarDoorCloseSound = "Truck_01_door_close_SoundSet";
21
22 m_CarHornShortSoundName = "Truck_01_Horn_Short_SoundSet";
23 m_CarHornLongSoundName = "Truck_01_Horn_SoundSet";
24
25 SetEnginePos("0 1.4 2.25");
26 }
27
28 override void EEInit()
29 {
30 super.EEInit();
31
32 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
33 {
35 m_UTSSettings.m_ManualUpdate = true;
36 m_UTSSettings.m_TemperatureItemCap = GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE;
37 m_UTSSettings.m_TemperatureCap = 0;
38 m_UTSSettings.m_RangeFull = 0.5;
39 m_UTSSettings.m_RangeMax = 2;
40
43 }
44 }
45
46 override void OnEngineStart()
47 {
48 super.OnEngineStart();
49
50 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
51 {
52 m_UTSource.SetDefferedActive(true, 20.0);
53 }
54 }
55
56 override void OnEngineStop()
57 {
58 super.OnEngineStop();
59
60 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
61 {
62 m_UTSource.SetDefferedActive(false, 10.0);
63 }
64 }
65
66 override void EOnPostSimulate(IEntity other, float timeSlice)
67 {
68 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
69 {
70 if (m_UTSource.IsActive())
71 {
73 }
74 }
75 }
76
78 {
79 return 6.5;
80 }
81
83 {
84 return "0 3.2 0";
85 }
86
87 override int GetAnimInstance()
88 {
89 return VehicleAnimInstances.V3S;
90 }
91
92 override int GetSeatAnimationType(int posIdx)
93 {
94 switch (posIdx)
95 {
96 case 0:
97 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
98 case 1:
99 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
100 }
101
102 return 0;
103 }
104
105 // Override for car-specific light type
107 {
108 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Truck_01FrontLight));
109 }
110
111 // Override for car-specific light type
113 {
114 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Truck_01RearLight));
115 }
116
117 override bool CanReleaseAttachment(EntityAI attachment)
118 {
119 if (!super.CanReleaseAttachment(attachment))
120 {
121 return false;
122 }
123
124 if (EngineIsOn() && attachment.GetType() == "TruckBattery")
125 {
126 return false;
127 }
128
129 return true;
130 }
131
132 override protected bool CanManipulateSpareWheel(string slotSelectionName)
133 {
134 if (slotSelectionName == "wheel_spare_1")
135 {
136 return GetAnimationPhase("wheelSidePlate1") == 1.0;
137 }
138
139 if (slotSelectionName == "wheel_spare_2")
140 {
141 return GetAnimationPhase("wheelSidePlate2") == 1.0;
142 }
143
144 return super.CanManipulateSpareWheel(slotSelectionName);
145 }
146
147 override bool CrewCanGetThrough( int posIdx )
148 {
149 CarDoor carDoor;
150 switch( posIdx )
151 {
152 case 0:
153 if ( GetCarDoorsState("Truck_01_Door_1_1") == CarDoorState.DOORS_CLOSED )
154 return false;
155
156 return true;
157
158 case 1:
159 if ( GetCarDoorsState("Truck_01_Door_2_1") == CarDoorState.DOORS_CLOSED )
160 return false;
161
162 return true;
163 }
164
165 return false;
166 }
167
168 override string GetDoorSelectionNameFromSeatPos(int posIdx)
169 {
170 switch( posIdx )
171 {
172 case 0:
173 return "doors_driver";
174 break;
175 case 1:
176 return "doors_codriver";
177 break;
178 }
179
180 return super.GetDoorSelectionNameFromSeatPos(posIdx);
181 }
182
183 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
184 {
185 switch( posIdx )
186 {
187 case 0:
188 return "Truck_01_Door_1_1";
189 break;
190 case 1:
191 return "Truck_01_Door_2_1";
192 break;
193 }
194
195 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
196 }
197
198 override float OnSound(CarSoundCtrl ctrl, float oldValue)
199 {
200 switch (ctrl)
201 {
202 case CarSoundCtrl.DOORS:
203 float newValue = 0;
204
205 //-----
206 if (GetCarDoorsState("Truck_01_Door_1_1") == CarDoorState.DOORS_CLOSED)
207 {
208 newValue += 0.4;
209 }
210
211 if (GetCarDoorsState("Truck_01_Door_2_1") == CarDoorState.DOORS_CLOSED)
212 {
213 newValue += 0.4;
214 }
215
216 return Math.Clamp(newValue, 0, 1);
217 break;
218 }
219
220 return super.OnSound(ctrl, oldValue);
221 }
222
223 override void OnAnimationPhaseStarted(string animSource, float phase)
224 {
225 super.OnAnimationPhaseStarted(animSource, phase);
226
227 #ifndef SERVER
228 switch (animSource)
229 {
230 case "wheelsideplate1":
231 case "wheelsideplate2":
232 EffectSound sound = CreateSoundForAnimationSource(animSource);
233 if (phase == 0)
234 {
235 sound.SetSoundSet("Truck_01_Gear_Open_Side_Plate_SoundSet");
236 }
237 else
238 {
239 sound.SetSoundSet("Truck_01_Gear_Close_Side_Plate_SoundSet");
240 }
241
242 sound.SetSoundFadeIn(0.1);
243 sound.SetSoundFadeOut(0.1);
244
246 sound.SoundPlay();
247 break;
248 }
249 #endif
250 }
251
252 override int GetCarDoorsState( string slotType )
253 {
254 CarDoor carDoor;
255 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
256 if (!carDoor)
257 {
258 return CarDoorState.DOORS_MISSING;
259 }
260
261 switch (slotType)
262 {
263 case "Truck_01_Door_1_1":
264 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
265 case "Truck_01_Door_2_1":
266 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
267 case "Truck_01_Hood":
268 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
269 }
270
271 return CarDoorState.DOORS_MISSING;
272 }
273
274 override string GetAnimSourceFromSelection( string selection )
275 {
276 switch( selection )
277 {
278 case "doors_driver":
279 return "DoorsDriver";
280 case "doors_codriver":
281 return "DoorsCoDriver";
282 case "doors_hood":
283 return "DoorsHood";
284 case "doors_trunk":
285 return "DoorsTrunk";
286 case "wheelsideplate1":
287 return "WheelSidePlate1";
288 case "wheelsideplate2":
289 return "WheelSidePlate2";
290 }
291
292 return "";
293 }
294
295 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
296 {
297 switch (currentSeat)
298 {
299 case 0:
300 return nextSeat == 1;
301 case 1:
302 return nextSeat == 0;
303 }
304
305 return false;
306 }
307
308 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
309 {
310 switch (pCurrentSeat)
311 {
312 case 0:
313 return pDoorsSelection == "DoorsDriver";
314
315 case 1:
316 return pDoorsSelection == "DoorsCoDriver";
317 }
318
319 return false;
320 }
321
322 override int GetSeatIndexFromDoor( string pDoorSelection )
323 {
324 switch (pDoorSelection)
325 {
326 case "DoorsDriver":
327 return 0;
328
329 case "DoorsCoDriver":
330 return 1;
331 }
332
333 return -1;
334 }
335
336
337 override bool IsVitalCarBattery()
338 {
339 return false;
340 }
341
342 override bool IsVitalSparkPlug()
343 {
344 return false;
345 }
346
347 override bool IsVitalGlowPlug()
348 {
349 return false;
350 }
351
352 override bool IsVitalEngineBelt()
353 {
354 return false;
355 }
356
357 override bool IsVitalRadiator()
358 {
359 return false;
360 }
361
373
374 override void OnDebugSpawn()
375 {
376 SpawnUniversalParts();
377 SpawnAdditionalItems();
378 FillUpCarFluids();
379
380 GetInventory().CreateInInventory("Truck_01_Wheel");
381 GetInventory().CreateInInventory("Truck_01_Wheel");
382
383 GetInventory().CreateInInventory("Truck_01_WheelDouble");
384 GetInventory().CreateInInventory("Truck_01_WheelDouble");
385 GetInventory().CreateInInventory("Truck_01_WheelDouble");
386 GetInventory().CreateInInventory("Truck_01_WheelDouble");
387
388 GetInventory().CreateInInventory("Truck_01_Door_1_1");
389 GetInventory().CreateInInventory("Truck_01_Door_2_1");
390 GetInventory().CreateInInventory("Truck_01_Hood");
391
392 //-----IN CAR CARGO
393 GetInventory().CreateInInventory("Truck_01_Wheel");
394 GetInventory().CreateInInventory("Truck_01_Wheel");
395 GetInventory().CreateInInventory("Truck_01_WheelDouble");
396 GetInventory().CreateInInventory("Truck_01_WheelDouble");
397 }
398};
ActionDetachFromTarget_SpecificSlot_WoodenPlanks ActionDetachFromTarget_SpecificSlot ActionDetachFromTarget_SpecificSlot_MetalSheets()
ActionDetachFromTarget_SpecificSlotsCategory_Barrel ActionDetachFromTarget_SpecificSlotsCategory ActionDetachFromTarget_SpecificSlotsCategory_WoodenCrate()
ActionDetachFromTarget_SpecificSlotsCategory ActionDetachFromTarget ActionDetachFromTarget_SpecificSlot_WoodenLogs()
void AddAction(typename actionName)
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
override int GetCarDoorsState(string slotType)
override float OnSound(CarSoundCtrl ctrl, float oldValue)
override bool IsVitalEngineBelt()
override float GetTransportCameraDistance()
override string GetDoorSelectionNameFromSeatPos(int posIdx)
override int GetAnimInstance()
void Truck_01_Base()
override CarRearLightBase CreateRearLight()
override void OnDebugSpawn()
override int GetSeatIndexFromDoor(string pDoorSelection)
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
override CarLightBase CreateFrontLight()
override bool IsVitalGlowPlug()
override int GetCarDoorsState(string slotType)
override void OnAnimationPhaseStarted(string animSource, float phase)
override string GetAnimSourceFromSelection(string selection)
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
override void EOnPostSimulate(IEntity other, float timeSlice)
override void OnEngineStart()
override bool CanReleaseAttachment(EntityAI attachment)
override void SetActions()
override void EEInit()
override bool IsVitalRadiator()
override bool CrewCanGetThrough(int posIdx)
override bool IsVitalCarBattery()
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
override bool IsVitalSparkPlug()
bool CanManipulateSpareWheel(string slotSelectionName)
override void OnEngineStop()
override vector GetTransportCameraOffset()
override int GetSeatAnimationType(int posIdx)
Super root of all classes in Enforce script.
Definition enscript.c:11
Wrapper class for managing sound through SEffectManager.
Definition effectsound.c:5
void SetSoundSet(string snd)
Set soundset for the sound.
void SetSoundFadeIn(float fade_in)
Set the sound fade in duration.
void SetSoundFadeOut(float fade_out)
Set the sound fade out duration.
bool SoundPlay()
Plays sound.
Definition enmath.c:7
Manager class for managing Effect (EffectParticle, EffectSound)
static int EffectRegister(Effect effect)
Registers Effect in SEffectManager.
original Timer deletes m_params which is unwanted
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
ref UniversalTemperatureSourceSettings m_UTSSettings
ref UniversalTemperatureSource m_UTSource
proto native CGame GetGame()
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase UniversalTemperatureSourceLambdaEngine()
VehicleAnimInstances