Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
van_01.c
Go to the documentation of this file.
1 class 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  {
37  m_UTSource.SetDefferedActive(true, 20.0);
38  }
39  }
40 
41  override void OnEngineStop()
42  {
43  super.OnEngineStop();
44 
45  if (GetGame().IsServer() || !GetGame().IsMultiplayer())
46  {
47  m_UTSource.SetDefferedActive(false, 10.0);
48  }
49  }
50 
51  override void EOnPostSimulate(IEntity other, float timeSlice)
52  {
53  if (GetGame().IsServer() || !GetGame().IsMultiplayer())
54  {
55  if (m_UTSource.IsActive())
56  {
58  }
59  }
60  }
61 
62  //-----------------------------------------------------------
63  override int GetAnimInstance()
64  {
65  return VehicleAnimInstances.CIVVAN;
66  }
67 
68  //-----------------------------------------------------------
69  override int GetSeatAnimationType( int posIdx )
70  {
71  switch( posIdx )
72  {
73  case 0:
74  return DayZPlayerConstants.VEHICLESEAT_DRIVER;
75  case 1:
76  return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
77  case 2:
78  return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
79  case 3:
80  return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
81  case 4:
82  return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
83  }
84 
85  return 0;
86  }
87 
88  //-----------------------------------------------------------
89  override int GetCarDoorsState( string slotType )
90  {
91  CarDoor carDoor;
92 
93  Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
94  if ( !carDoor )
95  return CarDoorState.DOORS_MISSING;
96 
97  switch( slotType )
98  {
99  case "Van_01_Door_1_1":
100  if ( GetAnimationPhase("DoorsDriver") > 0.5 )
101  return CarDoorState.DOORS_OPEN;
102  else
103  return CarDoorState.DOORS_CLOSED;
104 
105  break;
106 
107  case "Van_01_Door_2_1":
108  if ( GetAnimationPhase("DoorsCoDriver") > 0.5 )
109  return CarDoorState.DOORS_OPEN;
110  else
111  return CarDoorState.DOORS_CLOSED;
112 
113  break;
114 
115  case "Van_01_Door_2_2":
116  if ( GetAnimationPhase("DoorsCargo1") > 0.5 )
117  return CarDoorState.DOORS_OPEN;
118  else
119  return CarDoorState.DOORS_CLOSED;
120 
121  break;
122 
123  case "Van_01_Trunk_1":
124  if ( GetAnimationPhase("DoorsCargo3") > 0.5 )
125  return CarDoorState.DOORS_OPEN;
126  else
127  return CarDoorState.DOORS_CLOSED;
128  break;
129 
130  case "Van_01_Trunk_2":
131  if ( GetAnimationPhase("DoorsCargo2") > 0.5 )
132  return CarDoorState.DOORS_OPEN;
133  else
134  return CarDoorState.DOORS_CLOSED;
135 
136  break;
137  }
138 
139  return CarDoorState.DOORS_MISSING;
140  }
141 
142  //-----------------------------------------------------------
143  override bool CrewCanGetThrough( int posIdx )
144  {
145  switch( posIdx )
146  {
147  case 0:
148  if ( GetCarDoorsState( "Van_01_Door_1_1" ) == CarDoorState.DOORS_CLOSED )
149  return false;
150 
151  return true;
152  break;
153 
154  case 1:
155  if ( GetCarDoorsState( "Van_01_Door_2_1" ) == CarDoorState.DOORS_CLOSED )
156  return false;
157 
158  return true;
159  break;
160 
161  case 2:
162  if ( GetCarDoorsState( "Van_01_Door_2_2" ) == CarDoorState.DOORS_CLOSED )
163  return false;
164 
165  return true;
166  break;
167 
168  case 3:
169  if ( GetCarDoorsState( "Van_01_Door_2_2" ) == CarDoorState.DOORS_CLOSED )
170  return false;
171 
172  case 4:
173  if ( GetCarDoorsState( "Van_01_Door_2_2" ) == CarDoorState.DOORS_CLOSED )
174  return false;
175 
176  return true;
177  break;
178  }
179 
180  return false;
181  }
182 
183  //-----------------------------------------------------------
184  override float OnSound( CarSoundCtrl ctrl, float oldValue )
185  {
186  switch ( ctrl )
187  {
188  case CarSoundCtrl.DOORS:
189  float newValue = 0;
190 
191  //-----
192  if ( GetCarDoorsState( "Van_01_Door_1_1" ) == CarDoorState.DOORS_CLOSED )
193  newValue += 0.25;
194 
195  //-----
196  if ( GetCarDoorsState( "Van_01_Door_2_1" ) == CarDoorState.DOORS_CLOSED )
197  newValue += 0.25;
198 
199  //-----
200  if ( GetCarDoorsState( "Van_01_Door_2_2" ) == CarDoorState.DOORS_CLOSED )
201  newValue += 0.25;
202 
203  //-----
204  if ( GetCarDoorsState( "Van_01_Trunk_1" ) == CarDoorState.DOORS_CLOSED )
205  newValue += 0.125;
206 
207  //-----
208  if ( GetCarDoorsState( "Van_01_Trunk_2" ) == CarDoorState.DOORS_CLOSED )
209  newValue += 0.125;
210 
211  if ( newValue > 1 )
212  newValue = 1;
213 
214  return newValue;
215  break;
216  }
217 
218  return oldValue;
219  }
220 
221  //-----------------------------------------------------------
222  override string GetAnimSourceFromSelection( string selection )
223  {
224  switch( selection )
225  {
226  case "doors_driver":
227  return "DoorsDriver";
228  case "doors_codriver":
229  return "DoorsCoDriver";
230  case "doors_cargo1":
231  return "DoorsCargo1";
232  case "doors_cargo2":
233  return "DoorsCargo2";
234  case "doors_cargo3":
235  return "DoorsCargo3";
236  case "doors_hood":
237  return "DoorsHood";
238  }
239 
240  return "";
241  }
242 
243  //-----------------------------------------------------------
244  override string GetDoorConditionPointFromSelection( string selection )
245  {
246  switch( selection )
247  {
248  case "seat_driver":
249  return "seat_con_1_1";
250  break;
251  case "seat_codriver":
252  return "seat_con_2_1";
253  break;
254  case "seat_cargo1":
255  case "seat_cargo2":
256  case "seat_cargo3":
257  return "seat_con_1_2";
258  break;
259  }
260 
261  return "";
262  };
263 
264  //-----------------------------------------------------------
265  override bool IsVitalTruckBattery()
266  {
267  return false;
268  }
269 
270  //-----------------------------------------------------------
271  override bool IsVitalGlowPlug()
272  {
273  return false;
274  }
275 
276  //-----------------------------------------------------------
277  override bool CanReachSeatFromSeat( int currentSeat, int nextSeat )
278  {
279  switch( currentSeat )
280  {
281  case 0:
282  if ( nextSeat == 1 )
283  return true;
284  break;
285  case 1:
286  if ( nextSeat == 0 )
287  return true;
288  break;
289  case 2:
290  if ( nextSeat == 3 )
291  return true;
292  break;
293  case 3:
294  if ( nextSeat == 2 )
295  return true;
296  break;
297  }
298 
299  return false;
300  }
301 
302  //-----------------------------------------------------------
303  override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
304  {
305  switch( pCurrentSeat )
306  {
307  case 0:
308  if (pDoorsSelection == "DoorsDriver")
309  {
310  return true;
311  }
312  break;
313  case 1:
314  if (pDoorsSelection == "DoorsCoDriver")
315  {
316  return true;
317  }
318  break;
319  case 2:
320  if (pDoorsSelection == "DoorsCargo1")
321  {
322  return true;
323  }
324  break;
325  case 3:
326  if (pDoorsSelection == "DoorsCargo2")
327  {
328  return true;
329  }
330  break;
331  }
332 
333  return false;
334  }
335 }
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
GetDoorConditionPointFromSelection
string GetDoorConditionPointFromSelection(string selection)
Definition: carscript.c:2204
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
UniversalTemperatureSource
original Timer deletes m_params which is unwanted
Definition: universaltemperaturesource.c:25
GetCarDoorsState
int GetCarDoorsState(string slotType)
Definition: carscript.c:2331
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
UniversalTemperatureSourceSettings
Definition: universaltemperaturesource.c:1
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
CarDoorState
CarDoorState
Definition: carscript.c:1
IsVitalTruckBattery
bool IsVitalTruckBattery()
Definition: carscript.c:2269
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
OnEngineStop
override void OnEngineStop()
Gets called everytime the engine stops.
Definition: carscript.c:1628