DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Van_01.c
См. документацию.
1class Van_01 extends CarScript
2{
3 protected ref UniversalTemperatureSource m_UTSource;
4 protected ref UniversalTemperatureSourceSettings m_UTSSettings;
6
7 void Van_01()
8 {
9 //m_dmgContactCoef = 0.070; //TODO::Set proper value
10 }
11
12 void ~Van_01()
13 {
14 m_UTSource = null;
15 m_UTSSettings = null;
16 m_UTSLEngine = null;
17 }
18
19 override void EEInit()
20 {
21 super.EEInit();
22
23 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
24 {
26 m_UTSSettings.m_ManualUpdate = true;
28 m_UTSSettings.m_TemperatureCap = 0;
29 m_UTSSettings.m_RangeFull = 0.5;
30 m_UTSSettings.m_RangeMax = 2;
31
34 }
35 }
36
37 override void OnEngineStart()
38 {
39 super.OnEngineStart();
40
41 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
42 {
43 if (m_UTSource)
44 m_UTSource.SetDefferedActive(true, 20.0);
45 }
46 }
47
48 override void OnEngineStop()
49 {
50 super.OnEngineStop();
51
52 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
53 {
54 if (m_UTSource)
55 m_UTSource.SetDefferedActive(false, 10.0);
56 }
57 }
58
59 override void EOnPostSimulate(IEntity other, float timeSlice)
60 {
61 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
62 {
63 if (m_UTSource && m_UTSource.IsActive())
64 {
66 }
67 }
68 }
69
70 //-----------------------------------------------------------
71 override int GetAnimInstance()
72 {
73 return VehicleAnimInstances.CIVVAN;
74 }
75
76 //-----------------------------------------------------------
77 override int GetSeatAnimationType( int posIdx )
78 {
79 switch( posIdx )
80 {
81 case 0:
82 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
83 case 1:
84 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
85 case 2:
86 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
87 case 3:
88 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
89 case 4:
90 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
91 }
92
93 return 0;
94 }
95
96 //-----------------------------------------------------------
97 override int GetCarDoorsState( string slotType )
98 {
99 CarDoor carDoor;
100
101 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
102 if ( !carDoor )
103 return CarDoorState.DOORS_MISSING;
104
105 switch( slotType )
106 {
107 case "Van_01_Door_1_1":
108 if ( GetAnimationPhase("DoorsDriver") > 0.5 )
109 return CarDoorState.DOORS_OPEN;
110 else
111 return CarDoorState.DOORS_CLOSED;
112
113 break;
114
115 case "Van_01_Door_2_1":
116 if ( GetAnimationPhase("DoorsCoDriver") > 0.5 )
117 return CarDoorState.DOORS_OPEN;
118 else
119 return CarDoorState.DOORS_CLOSED;
120
121 break;
122
123 case "Van_01_Door_2_2":
124 if ( GetAnimationPhase("DoorsCargo1") > 0.5 )
125 return CarDoorState.DOORS_OPEN;
126 else
127 return CarDoorState.DOORS_CLOSED;
128
129 break;
130
131 case "Van_01_Trunk_1":
132 if ( GetAnimationPhase("DoorsCargo3") > 0.5 )
133 return CarDoorState.DOORS_OPEN;
134 else
135 return CarDoorState.DOORS_CLOSED;
136 break;
137
138 case "Van_01_Trunk_2":
139 if ( GetAnimationPhase("DoorsCargo2") > 0.5 )
140 return CarDoorState.DOORS_OPEN;
141 else
142 return CarDoorState.DOORS_CLOSED;
143
144 break;
145 }
146
147 return CarDoorState.DOORS_MISSING;
148 }
149
150 //-----------------------------------------------------------
151 override bool CrewCanGetThrough( int posIdx )
152 {
153 switch( posIdx )
154 {
155 case 0:
156 if ( GetCarDoorsState( "Van_01_Door_1_1" ) == CarDoorState.DOORS_CLOSED )
157 return false;
158
159 return true;
160 break;
161
162 case 1:
163 if ( GetCarDoorsState( "Van_01_Door_2_1" ) == CarDoorState.DOORS_CLOSED )
164 return false;
165
166 return true;
167 break;
168
169 case 2:
170 if ( GetCarDoorsState( "Van_01_Door_2_2" ) == CarDoorState.DOORS_CLOSED )
171 return false;
172
173 return true;
174 break;
175
176 case 3:
177 if ( GetCarDoorsState( "Van_01_Door_2_2" ) == CarDoorState.DOORS_CLOSED )
178 return false;
179
180 case 4:
181 if ( GetCarDoorsState( "Van_01_Door_2_2" ) == CarDoorState.DOORS_CLOSED )
182 return false;
183
184 return true;
185 break;
186 }
187
188 return false;
189 }
190
191 //-----------------------------------------------------------
192 override float OnSound( CarSoundCtrl ctrl, float oldValue )
193 {
194 switch ( ctrl )
195 {
196 case CarSoundCtrl.DOORS:
197 float newValue = 0;
198
199 //-----
200 if ( GetCarDoorsState( "Van_01_Door_1_1" ) == CarDoorState.DOORS_CLOSED )
201 newValue += 0.25;
202
203 //-----
204 if ( GetCarDoorsState( "Van_01_Door_2_1" ) == CarDoorState.DOORS_CLOSED )
205 newValue += 0.25;
206
207 //-----
208 if ( GetCarDoorsState( "Van_01_Door_2_2" ) == CarDoorState.DOORS_CLOSED )
209 newValue += 0.25;
210
211 //-----
212 if ( GetCarDoorsState( "Van_01_Trunk_1" ) == CarDoorState.DOORS_CLOSED )
213 newValue += 0.125;
214
215 //-----
216 if ( GetCarDoorsState( "Van_01_Trunk_2" ) == CarDoorState.DOORS_CLOSED )
217 newValue += 0.125;
218
219 if ( newValue > 1 )
220 newValue = 1;
221
222 return newValue;
223 break;
224 }
225
226 return oldValue;
227 }
228
229 //-----------------------------------------------------------
230 override string GetAnimSourceFromSelection( string selection )
231 {
232 switch( selection )
233 {
234 case "doors_driver":
235 return "DoorsDriver";
236 case "doors_codriver":
237 return "DoorsCoDriver";
238 case "doors_cargo1":
239 return "DoorsCargo1";
240 case "doors_cargo2":
241 return "DoorsCargo2";
242 case "doors_cargo3":
243 return "DoorsCargo3";
244 case "doors_hood":
245 return "DoorsHood";
246 }
247
248 return "";
249 }
250
251 //-----------------------------------------------------------
252 override string GetDoorConditionPointFromSelection( string selection )
253 {
254 switch( selection )
255 {
256 case "seat_driver":
257 return "seat_con_1_1";
258 break;
259 case "seat_codriver":
260 return "seat_con_2_1";
261 break;
262 case "seat_cargo1":
263 case "seat_cargo2":
264 case "seat_cargo3":
265 return "seat_con_1_2";
266 break;
267 }
268
269 return "";
270 };
271
272 //-----------------------------------------------------------
273 override bool IsVitalTruckBattery()
274 {
275 return false;
276 }
277
278 //-----------------------------------------------------------
279 override bool IsVitalGlowPlug()
280 {
281 return false;
282 }
283
284 //-----------------------------------------------------------
285 override bool CanReachSeatFromSeat( int currentSeat, int nextSeat )
286 {
287 switch( currentSeat )
288 {
289 case 0:
290 if ( nextSeat == 1 )
291 return true;
292 break;
293 case 1:
294 if ( nextSeat == 0 )
295 return true;
296 break;
297 case 2:
298 if ( nextSeat == 3 )
299 return true;
300 break;
301 case 3:
302 if ( nextSeat == 2 )
303 return true;
304 break;
305 }
306
307 return false;
308 }
309
310 //-----------------------------------------------------------
311 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
312 {
313 switch( pCurrentSeat )
314 {
315 case 0:
316 if (pDoorsSelection == "DoorsDriver")
317 {
318 return true;
319 }
320 break;
321 case 1:
322 if (pDoorsSelection == "DoorsCoDriver")
323 {
324 return true;
325 }
326 break;
327 case 2:
328 if (pDoorsSelection == "DoorsCargo1")
329 {
330 return true;
331 }
332 break;
333 case 3:
334 if (pDoorsSelection == "DoorsCargo2")
335 {
336 return true;
337 }
338 break;
339 }
340
341 return false;
342 }
343}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Определения Car.c:4
CarDoorState
Определения CarScript.c:2
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
Определения CivilianSedan.c:443
DayZGame g_Game
Определения DayZGame.c:3942
ref UniversalTemperatureSourceSettings m_UTSSettings
Определения FireplaceBase.c:221
ref UniversalTemperatureSource m_UTSource
Определения FireplaceBase.c:220
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase UniversalTemperatureSourceLambdaEngine()
VehicleAnimInstances
Определения VehicleAnimInstances.c:2
override float OnSound(CarSoundCtrl ctrl, float oldValue)
Определения Van_01.c:192
override int GetAnimInstance()
Определения Van_01.c:71
override string GetDoorConditionPointFromSelection(string selection)
Определения Van_01.c:252
override bool IsVitalGlowPlug()
Определения Van_01.c:279
override int GetCarDoorsState(string slotType)
Определения Van_01.c:97
override bool IsVitalTruckBattery()
Определения Van_01.c:273
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
Определения CivilianSedan.c:5
void ~Van_01()
Определения Van_01.c:12
override string GetAnimSourceFromSelection(string selection)
Определения Van_01.c:230
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Определения Van_01.c:311
override void EOnPostSimulate(IEntity other, float timeSlice)
Определения Van_01.c:59
override void OnEngineStart()
Определения Van_01.c:37
override void EEInit()
Определения Van_01.c:19
override bool CrewCanGetThrough(int posIdx)
Определения Van_01.c:151
ref UniversalTemperatureSource m_UTSource
Определения CivilianSedan.c:3
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Определения Van_01.c:285
override void OnEngineStop()
Определения Van_01.c:48
override int GetSeatAnimationType(int posIdx)
Определения Van_01.c:77
ref UniversalTemperatureSourceSettings m_UTSSettings
Определения CivilianSedan.c:4
void Van_01()
Определения Van_01.c:7
Определения CivilianSedan.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения EnEntity.c:165
original Timer deletes m_params which is unwanted
Определения UniversalTemperatureSource.c:39
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:811