DayZ 1.24
Loading...
Searching...
No Matches
Truck_02.c
Go to the documentation of this file.
1class 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 m_UTSource.SetDefferedActive(true, 20.0);
38 }
39
40 override void OnEngineStop()
41 {
42 super.OnEngineStop();
43
44 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
45 m_UTSource.SetDefferedActive(false, 10.0);
46 }
47
48 override void EOnPostSimulate(IEntity other, float timeSlice)
49 {
50 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
51 {
52 if (m_UTSource.IsActive())
54 }
55 }
56
57 override int GetAnimInstance()
58 {
59 return VehicleAnimInstances.MULTICAR;
60 }
61
62 override int GetSeatAnimationType(int posIdx)
63 {
64 switch (posIdx)
65 {
66 case 0:
67 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
68 case 1:
69 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
70 }
71
72 return 0;
73 }
74
75 override int GetCarDoorsState(string slotType)
76 {
78
79 switch (slotType)
80 {
81 case "Truck_02_Door_1_1":
82 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
83 if (carDoor)
84 {
85 if (GetAnimationPhase("DoorsDriver") > 0.5)
86 return CarDoorState.DOORS_OPEN;
87 else
88 return CarDoorState.DOORS_CLOSED;
89 }
90
91 return CarDoorState.DOORS_MISSING;
92 break;
93
94 case "Truck_02_Door_2_1":
95 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
96 if (carDoor)
97 {
98 if (GetAnimationPhase("DoorsCoDriver") > 0.5)
99 return CarDoorState.DOORS_OPEN;
100 else
101 return CarDoorState.DOORS_CLOSED;
102 }
103
104 return CarDoorState.DOORS_MISSING;
105 break;
106 }
107
108 return CarDoorState.DOORS_MISSING;
109 }
110
111 override bool CrewCanGetThrough(int posIdx)
112 {
114 switch (posIdx)
115 {
116 case 0:
117 if (GetCarDoorsState("Truck_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
118 return false;
119
120 return true;
121 break;
122
123 case 1:
124 if (GetCarDoorsState("Truck_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
125 return false;
126
127 return true;
128 break;
129 }
130
131 return false;
132 }
133
134 override float OnSound(CarSoundCtrl ctrl, float oldValue)
135 {
136 switch (ctrl)
137 {
138 case CarSoundCtrl.DOORS:
139 float newValue = 0;
140
141 //-----
142 if (GetCarDoorsState("Truck_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
143 newValue += 0.4;
144
145 if (GetCarDoorsState("Truck_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
146 newValue += 0.4;
147
148 if (newValue > 1)
149 newValue = 1;
150
151 return newValue;
152 break;
153 }
154
155 return oldValue;
156 }
157
158 override string GetAnimSourceFromSelection(string selection)
159 {
160 switch (selection)
161 {
162 case "doors_driver":
163 return "DoorsDriver";
164 case "doors_codriver":
165 return "DoorsCoDriver";
166 case "doors_hood":
167 return "DoorsHood";
168 case "doors_trunk":
169 return "DoorsTrunk";
170 case "wheelsideplate1":
171 return "WheelSidePlate1";
172 case "wheelsideplate2":
173 return "WheelSidePlate2";
174 }
175
176 return "";
177 }
178
179 override bool IsVitalCarBattery()
180 {
181 return false;
182 }
183
184 override bool IsVitalSparkPlug()
185 {
186 return false;
187 }
188
189 override bool IsVitalGlowPlug()
190 {
191 return false;
192 }
193
194 override bool IsVitalEngineBelt()
195 {
196 return false;
197 }
198
199 override bool IsVitalRadiator()
200 {
201 return false;
202 }
203
205 {
206 switch (currentSeat)
207 {
208 case 0:
209 if (nextSeat == 1)
210 return true;
211 break;
212
213 case 1:
214 if (nextSeat == 0)
215 return true;
216 break;
217 }
218
219 return false;
220 }
221
223 {
224 switch (pCurrentSeat)
225 {
226 case 0:
227 if (pDoorsSelection == "DoorsDriver")
228 return true;
229 break;
230
231 case 1:
232 if (pDoorsSelection == "DoorsCoDriver")
233 return true;
234 break;
235 }
236
237 return false;
238 }
239
241 {
242 switch (pDoorSelection)
243 {
244 case "DoorsDriver":
245 return 0;
246 break;
247 case "DoorsCoDriver":
248 return 1;
249 break;
250 }
251 return -1;
252 }
253
254 override void OnDebugSpawn()
255 {
257
258 if (Class.CastTo(entity, this))
259 {
260 entity.GetInventory().CreateInInventory("Truck_02_Wheel");
261 entity.GetInventory().CreateInInventory("Truck_02_Wheel");
262 entity.GetInventory().CreateInInventory("Truck_02_Wheel");
263 entity.GetInventory().CreateInInventory("Truck_02_Wheel");
264
265 entity.GetInventory().CreateInInventory("TruckBattery");
266 entity.GetInventory().CreateInInventory("SparkPlug");
267
268 entity.GetInventory().CreateInInventory("Truck_02_Door_1_1");
269 entity.GetInventory().CreateInInventory("Truck_02_Door_2_1");
270
271 entity.GetInventory().CreateInInventory("HeadlightH7");
272 entity.GetInventory().CreateInInventory("HeadlightH7");
273 }
274
275 Fill(CarFluid.FUEL, 50);
276 Fill(CarFluid.OIL, 4.0);
277 };
278}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition Car.c:4
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:18
CarDoorState
Definition CarScript.c:2
vector m_enginePtcPos
Definition CarScript.c:193
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
ref UniversalTemperatureSourceSettings m_UTSSettings
ref UniversalTemperatureSource m_UTSource
VehicleAnimInstances
override float OnSound(CarSoundCtrl ctrl, float oldValue)
Definition Truck_02.c:134
override bool IsVitalEngineBelt()
Definition Truck_02.c:194
override int GetAnimInstance()
Definition Truck_02.c:57
override void OnDebugSpawn()
Definition Truck_02.c:254
override int GetSeatIndexFromDoor(string pDoorSelection)
Definition Truck_02.c:240
void Truck_02()
Definition Truck_02.c:7
override bool IsVitalGlowPlug()
Definition Truck_02.c:189
override int GetCarDoorsState(string slotType)
Definition Truck_02.c:75
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
override string GetAnimSourceFromSelection(string selection)
Definition Truck_02.c:158
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Definition Truck_02.c:222
override void EOnPostSimulate(IEntity other, float timeSlice)
Definition Truck_02.c:48
override void OnEngineStart()
Definition Truck_02.c:32
override void EEInit()
Definition Truck_02.c:13
override bool IsVitalRadiator()
Definition Truck_02.c:199
override bool CrewCanGetThrough(int posIdx)
Definition Truck_02.c:111
override bool IsVitalCarBattery()
Definition Truck_02.c:179
ref UniversalTemperatureSource m_UTSource
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Definition Truck_02.c:204
override bool IsVitalSparkPlug()
Definition Truck_02.c:184
override void OnEngineStop()
Definition Truck_02.c:40
override int GetSeatAnimationType(int posIdx)
Definition Truck_02.c:62
ref UniversalTemperatureSourceSettings m_UTSSettings
Super root of all classes in Enforce script.
Definition EnScript.c:11
original Timer deletes m_params which is unwanted
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.