Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
truck_02.c
Go to the documentation of this file.
1 class Truck_02 extends CarScript
2 {
6 
7  void Truck_02()
8  {
9  //m_dmgContactCoef = 0.018;
10  m_enginePtcPos = "0 1.346 2.205";
11  }
12 
13  override void EEInit()
14  {
15  super.EEInit();
16 
17  if (GetGame().IsServer() || !GetGame().IsMultiplayer())
18  {
20  m_UTSSettings.m_ManualUpdate = true;
21  m_UTSSettings.m_TemperatureMin = 0;
22  m_UTSSettings.m_TemperatureMax = 30;
23  m_UTSSettings.m_RangeFull = 0.5;
24  m_UTSSettings.m_RangeMax = 2;
25  m_UTSSettings.m_TemperatureCap = 25;
26 
29  }
30  }
31 
32  override void OnEngineStart()
33  {
34  super.OnEngineStart();
35 
36  if (GetGame().IsServer() || !GetGame().IsMultiplayer())
37  {
38  m_UTSource.SetDefferedActive(true, 20.0);
39  }
40  }
41 
42  override void OnEngineStop()
43  {
44  super.OnEngineStop();
45 
46  if (GetGame().IsServer() || !GetGame().IsMultiplayer())
47  {
48  m_UTSource.SetDefferedActive(false, 10.0);
49  }
50  }
51 
52  override void EOnPostSimulate(IEntity other, float timeSlice)
53  {
54  if (GetGame().IsServer() || !GetGame().IsMultiplayer())
55  {
56  if (m_UTSource.IsActive())
57  {
59  }
60  }
61  }
62 
63  override int GetAnimInstance()
64  {
65  return VehicleAnimInstances.MULTICAR;
66  }
67 
68  override int GetSeatAnimationType( int posIdx )
69  {
70  switch( posIdx )
71  {
72  case 0:
73  return DayZPlayerConstants.VEHICLESEAT_DRIVER;
74  case 1:
75  return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
76  }
77 
78  return 0;
79  }
80 
81  override int GetCarDoorsState( string slotType )
82  {
83  CarDoor carDoor;
84 
85  switch( slotType )
86  {
87  case "Truck_02_Door_1_1":
88  Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
89  if ( carDoor )
90  {
91  if ( GetAnimationPhase("DoorsDriver") > 0.5 )
92  {
93  return CarDoorState.DOORS_OPEN;
94  }
95  else
96  {
97  return CarDoorState.DOORS_CLOSED;
98  }
99  }
100 
101  return CarDoorState.DOORS_MISSING;
102  break;
103 
104  case "Truck_02_Door_2_1":
105  Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
106  if ( carDoor )
107  {
108  if ( GetAnimationPhase("DoorsCoDriver") > 0.5 )
109  {
110  return CarDoorState.DOORS_OPEN;
111  }
112  else
113  {
114  return CarDoorState.DOORS_CLOSED;
115  }
116  }
117 
118  return CarDoorState.DOORS_MISSING;
119  break;
120  }
121 
122  return CarDoorState.DOORS_MISSING;
123  }
124 
125  override bool CrewCanGetThrough( int posIdx )
126  {
127  CarDoor carDoor;
128  switch( posIdx )
129  {
130  case 0:
131  if ( GetCarDoorsState( "Truck_02_Door_1_1" ) == CarDoorState.DOORS_CLOSED )
132  {
133  return false;
134  }
135 
136  return true;
137  break;
138 
139  case 1:
140  if ( GetCarDoorsState( "Truck_02_Door_2_1" ) == CarDoorState.DOORS_CLOSED )
141  {
142  return false;
143  }
144 
145  return true;
146  break;
147  }
148 
149  return false;
150  }
151 
152  override float OnSound( CarSoundCtrl ctrl, float oldValue )
153  {
154  switch ( ctrl )
155  {
156  case CarSoundCtrl.DOORS:
157  float newValue = 0;
158 
159  //-----
160  if ( GetCarDoorsState( "Truck_02_Door_1_1" ) == CarDoorState.DOORS_CLOSED )
161  {
162  newValue += 0.4;
163  }
164 
165  if ( GetCarDoorsState( "Truck_02_Door_2_1" ) == CarDoorState.DOORS_CLOSED )
166  {
167  newValue += 0.4;
168  }
169 
170  if ( newValue > 1 )
171  newValue = 1;
172 
173  return newValue;
174  break;
175  }
176 
177  return oldValue;
178  }
179 
180  override string GetAnimSourceFromSelection( string selection )
181  {
182  switch( selection )
183  {
184  case "doors_driver":
185  return "DoorsDriver";
186  case "doors_codriver":
187  return "DoorsCoDriver";
188  case "doors_hood":
189  return "DoorsHood";
190  case "doors_trunk":
191  return "DoorsTrunk";
192  case "wheelsideplate1":
193  return "WheelSidePlate1";
194  case "wheelsideplate2":
195  return "WheelSidePlate2";
196  }
197 
198  return "";
199  }
200 
201  override bool IsVitalCarBattery()
202  {
203  return false;
204  }
205 
206  override bool IsVitalSparkPlug()
207  {
208  return false;
209  }
210 
211  override bool IsVitalGlowPlug()
212  {
213  return false;
214  }
215 
216  override bool IsVitalEngineBelt()
217  {
218  return false;
219  }
220 
221  override bool IsVitalRadiator()
222  {
223  return false;
224  }
225 
226  override bool CanReachSeatFromSeat( int currentSeat, int nextSeat )
227  {
228  switch( currentSeat )
229  {
230  case 0:
231  if ( nextSeat == 1 )
232  return true;
233  break;
234 
235  case 1:
236  if ( nextSeat == 0 )
237  return true;
238  break;
239  }
240 
241  return false;
242  }
243 
244  override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
245  {
246  switch( pCurrentSeat )
247  {
248  case 0:
249  if (pDoorsSelection == "DoorsDriver")
250  {
251  return true;
252  }
253  break;
254 
255  case 1:
256  if (pDoorsSelection == "DoorsCoDriver")
257  {
258  return true;
259  }
260  break;
261  }
262 
263  return false;
264  }
265 
266  override int GetSeatIndexFromDoor( string pDoorSelection )
267  {
268  switch (pDoorSelection)
269  {
270  case "DoorsDriver":
271  return 0;
272  break;
273  case "DoorsCoDriver":
274  return 1;
275  break;
276  }
277  return -1;
278  }
279 
280  override void OnDebugSpawn()
281  {
282  EntityAI entity;
283 
284  if ( Class.CastTo(entity, this) )
285  {
286  entity.GetInventory().CreateInInventory( "Truck_02_Wheel" );
287  entity.GetInventory().CreateInInventory( "Truck_02_Wheel" );
288  entity.GetInventory().CreateInInventory( "Truck_02_Wheel" );
289  entity.GetInventory().CreateInInventory( "Truck_02_Wheel" );
290 
291  entity.GetInventory().CreateInInventory( "TruckBattery" );
292  entity.GetInventory().CreateInInventory( "SparkPlug" );
293 
294  entity.GetInventory().CreateInInventory( "Truck_02_Door_1_1" );
295  entity.GetInventory().CreateInInventory( "Truck_02_Door_2_1" );
296 
297  entity.GetInventory().CreateInInventory( "HeadlightH7" );
298  entity.GetInventory().CreateInInventory( "HeadlightH7" );
299  }
300 
301  Fill( CarFluid.FUEL, 50 );
302  Fill( CarFluid.OIL, 4.0 );
303  };
304 }
GetGame
proto native CGame GetGame()
m_UTSource
protected ref UniversalTemperatureSource m_UTSource
Definition: fireplacebase.c:224
CarDoor
Definition: inventoryitem.c:496
OnSound
override float OnSound(CarSoundCtrl ctrl, float oldValue)
Definition: carscript.c:1301
UniversalTemperatureSourceLambdaEngine
Definition: universaltemperaturesourcelambdabaseimpl.c:62
OnEngineStart
override void OnEngineStart()
Gets called everytime the engine starts.
Definition: carscript.c:1612
CrewCanGetThrough
override bool CrewCanGetThrough(int posIdx)
Definition: civiliansedan.c:204
CarScript
Definition: civiliansedan.c:1
GetAnimSourceFromSelection
string GetAnimSourceFromSelection(string selection)
Definition: carscript.c:2199
GetAnimInstance
override int GetAnimInstance()
Definition: civiliansedan.c:75
IsVitalEngineBelt
bool IsVitalEngineBelt()
Definition: carscript.c:2284
UniversalTemperatureSource
original Timer deletes m_params which is unwanted
Definition: universaltemperaturesource.c:25
GetCarDoorsState
int GetCarDoorsState(string slotType)
Definition: carscript.c:2331
IsVitalCarBattery
bool IsVitalCarBattery()
Definition: carscript.c:2264
CarSoundCtrl
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition: car.c:3
m_UTSSettings
protected ref UniversalTemperatureSourceSettings m_UTSSettings
Definition: fireplacebase.c:225
IEntity
Definition: enentity.c:164
OnDebugSpawn
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
Definition: hatchback_02.c:404
CarFluid
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition: car.c:18
GetSeatIndexFromDoor
override int GetSeatIndexFromDoor(string pDoorSelection)
Definition: offroadhatchback.c:427
UniversalTemperatureSourceSettings
Definition: universaltemperaturesource.c:1
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
CarDoorState
CarDoorState
Definition: carscript.c:1
IsVitalRadiator
bool IsVitalRadiator()
Definition: carscript.c:2289
m_UTSLEngine
protected ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
Definition: civiliansedan.c:4
EOnPostSimulate
override void EOnPostSimulate(IEntity other, float timeSlice)
Definition: land_underground_waterreservoir.c:166
CanReachDoorsFromSeat
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Definition: civiliansedan.c:378
GetSeatAnimationType
override int GetSeatAnimationType(int posIdx)
Definition: civiliansedan.c:85
IsVitalGlowPlug
bool IsVitalGlowPlug()
Definition: carscript.c:2279
EEInit
override void EEInit()
Definition: contaminatedarea.c:27
VehicleAnimInstances
VehicleAnimInstances
Definition: vehicleaniminstances.c:1
CanReachSeatFromSeat
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Definition: civiliansedan.c:358
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
IsVitalSparkPlug
bool IsVitalSparkPlug()
Definition: carscript.c:2274
EntityAI
Definition: building.c:5
m_enginePtcPos
protected vector m_enginePtcPos
Definition: carscript.c:195
OnEngineStop
override void OnEngineStop()
Gets called everytime the engine stops.
Definition: carscript.c:1628