DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл Broom.c

См. исходные тексты.

Структуры данных

class  BroomBase
 

Функции

BroomBase FlammableBase GetBurningMaterial ()
 
override void Init ()
 Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)
 
override void SetActions ()
 
override bool CanReceiveUpgrade ()
 
override void OnWorkStart ()
 
override void ApplyResultModifications (ItemBase result)
 
override bool CanTransformIntoStick ()
 
override void EEHitBy (TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
 
override void CalculateQuantity ()
 
override void UpdateParticle ()
 
void DebugSetHealthAndEnergy (float time)
 
override void GetDebugActions (out TSelectableActionInfoArrayEx outputList)
 
override bool OnAction (int action_id, Man player, ParamsReadContext ctx)
 
override string GetBurntMaterial ()
 

Функции

◆ ApplyResultModifications()

override void ApplyResultModifications ( ItemBase result)

◆ CalculateQuantity()

override void CalculateQuantity ( )
189{
190 override void Init()
191 {
192 super.Init();
193 m_DecraftResult = "LongWoodenStick";
194 m_ParticleLocalPos = Vector(0, 1.2, 0);
195 }
196
197 override void SetActions()
198 {
199 super.SetActions();
200
203 }
204
205 override bool CanReceiveUpgrade()
206 {
207 return false;
208 }
209
210 override void OnWorkStart()
211 {
212 super.OnWorkStart();
214 }
215
217 {
218 result.SetHealth(result.GetHealthLevelValue(2,""));
219 result.SetQuantity(1);
220 }
221
222 override bool CanTransformIntoStick()
223 {
224 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
225 return true;
226 else
227 return false;
228 }
229
230
232 {
234
235 GetCompEM().SetEnergy0To1(GetHealth01("",""));
236 }
237
238
239 override void CalculateQuantity()
240 {
241 if (GetGame().IsServer())
242 {
243 float currentHealth01 = GetHealth01();
244 float currentEnergy01 = GetCompEM().GetEnergy0To1();
245
246 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
247 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
248 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
249 GetCompEM().SetEnergy0To1(GetHealth01());
250 }
251 }
252
253 override void UpdateParticle()
254 {
256
257 if (!m_FireParticle)
258 {
259 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
260 }
261 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
262 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
263 if (m_FireParticle)
264 {
265 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
266
267 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
268 }
269 }
270
271 // DEBUG BELLOW
272 void DebugSetHealthAndEnergy(float time)
273 {
274 float max_energy = GetCompEM().GetEnergyMaxPristine();
276 SetHealth01("","", health01);
277 GetCompEM().SetEnergy( time );
278 }
279
281 {
282 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
283 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
284 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
285 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
286 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
287
288 super.GetDebugActions(outputList);
289 }
290
291 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
292 {
293 if (super.OnAction(action_id, player, ctx))
294 return true;
295 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
296 {
297 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
298 {
301 }
302 else if (action_id == EActions.BROOM_BURN_SHORT)
303 {
306 }
307 else if (action_id == EActions.BROOM_BURN_MEDIUM)
308 {
311 }
312 else if (action_id == EActions.BROOM_BURN_LONG)
313 {
314 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
316 }
317 }
318 return false;
319 }
320
321}
322
323class Broom: BroomBase
324{
325 override string GetBurningMaterial()
326 {
327 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
328 }
329
330 override string GetBurntMaterial()
331 {
332 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
333 }
334}
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition EntityAI.c:97
void AddAction(typename actionName)
Definition AdvancedCommunication.c:220
override bool CanTransformIntoStick()
Definition Broom.c:171
void DebugSetHealthAndEnergy(float time)
Definition Broom.c:221
override void ApplyResultModifications(ItemBase result)
Definition Broom.c:165
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition Broom.c:240
override string GetBurntMaterial()
Definition Broom.c:143
override void Init()
Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside o...
Definition Broom.c:139
override bool CanReceiveUpgrade()
Definition Broom.c:154
BroomBase FlammableBase GetBurningMaterial()
Definition Broom.c:138
override void UpdateParticle()
Definition Broom.c:202
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Definition Broom.c:180
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition Broom.c:229
override void OnWorkStart()
Definition Broom.c:159
override void CalculateQuantity()
Definition Broom.c:188
override void SetActions()
Definition Broom.c:146
EActions
Definition EActions.c:2
override void OnIgnitedThis(EntityAI fire_source)
Executed on Server when some item ignited this one.
Definition FireworksBase.c:96
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
float GetEnergy()
Definition ItemBase.c:8253
override float GetQuantity()
Definition ItemBase.c:8129
override int GetQuantityMax()
Definition ItemBase.c:8081
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition ParticleManager.c:84
Definition ActionBreakLongWoodenStick.c:13
Definition ActionClapBearTrapWithThisItem.c:2
Definition Broom.c:2
Definition Building.c:6
Definition Torch.c:2
Definition InventoryItem.c:731
Definition EnMath.c:7
Definition EntityAI.c:95
Definition ParticleList.c:12
static const int BROOM_TORCH_T1
Definition ParticleList.c:78
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
Definition DamageSystem.c:2
Definition EnConvert.c:106
proto native CGame GetGame()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float Min(float x, float y)
Returns smaller of two given values.
EmitorParam
Definition EnVisual.c:114
const int SAT_DEBUG_ACTION
Definition constants.c:431

◆ CanReceiveUpgrade()

override bool CanReceiveUpgrade ( )
155{
156 override void Init()
157 {
158 super.Init();
159 m_DecraftResult = "LongWoodenStick";
160 m_ParticleLocalPos = Vector(0, 1.2, 0);
161 }
162
163 override void SetActions()
164 {
165 super.SetActions();
166
169 }
170
171 override bool CanReceiveUpgrade()
172 {
173 return false;
174 }
175
176 override void OnWorkStart()
177 {
178 super.OnWorkStart();
180 }
181
183 {
184 result.SetHealth(result.GetHealthLevelValue(2,""));
185 result.SetQuantity(1);
186 }
187
188 override bool CanTransformIntoStick()
189 {
190 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
191 return true;
192 else
193 return false;
194 }
195
196
198 {
200
201 GetCompEM().SetEnergy0To1(GetHealth01("",""));
202 }
203
204
205 override void CalculateQuantity()
206 {
207 if (GetGame().IsServer())
208 {
209 float currentHealth01 = GetHealth01();
210 float currentEnergy01 = GetCompEM().GetEnergy0To1();
211
212 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
213 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
214 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
215 GetCompEM().SetEnergy0To1(GetHealth01());
216 }
217 }
218
219 override void UpdateParticle()
220 {
222
223 if (!m_FireParticle)
224 {
225 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
226 }
227 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
228 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
229 if (m_FireParticle)
230 {
231 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
232
233 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
234 }
235 }
236
237 // DEBUG BELLOW
238 void DebugSetHealthAndEnergy(float time)
239 {
240 float max_energy = GetCompEM().GetEnergyMaxPristine();
242 SetHealth01("","", health01);
243 GetCompEM().SetEnergy( time );
244 }
245
247 {
248 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
249 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
250 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
251 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
252 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
253
254 super.GetDebugActions(outputList);
255 }
256
257 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
258 {
259 if (super.OnAction(action_id, player, ctx))
260 return true;
261 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
262 {
263 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
264 {
267 }
268 else if (action_id == EActions.BROOM_BURN_SHORT)
269 {
272 }
273 else if (action_id == EActions.BROOM_BURN_MEDIUM)
274 {
277 }
278 else if (action_id == EActions.BROOM_BURN_LONG)
279 {
280 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
282 }
283 }
284 return false;
285 }
286
287}
288
289class Broom: BroomBase
290{
291 override string GetBurningMaterial()
292 {
293 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
294 }
295
296 override string GetBurntMaterial()
297 {
298 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
299 }
300}

◆ CanTransformIntoStick()

override bool CanTransformIntoStick ( )
172{
173 override void Init()
174 {
175 super.Init();
176 m_DecraftResult = "LongWoodenStick";
177 m_ParticleLocalPos = Vector(0, 1.2, 0);
178 }
179
180 override void SetActions()
181 {
182 super.SetActions();
183
186 }
187
188 override bool CanReceiveUpgrade()
189 {
190 return false;
191 }
192
193 override void OnWorkStart()
194 {
195 super.OnWorkStart();
197 }
198
200 {
201 result.SetHealth(result.GetHealthLevelValue(2,""));
202 result.SetQuantity(1);
203 }
204
205 override bool CanTransformIntoStick()
206 {
207 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
208 return true;
209 else
210 return false;
211 }
212
213
215 {
217
218 GetCompEM().SetEnergy0To1(GetHealth01("",""));
219 }
220
221
222 override void CalculateQuantity()
223 {
224 if (GetGame().IsServer())
225 {
226 float currentHealth01 = GetHealth01();
227 float currentEnergy01 = GetCompEM().GetEnergy0To1();
228
229 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
230 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
231 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
232 GetCompEM().SetEnergy0To1(GetHealth01());
233 }
234 }
235
236 override void UpdateParticle()
237 {
239
240 if (!m_FireParticle)
241 {
242 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
243 }
244 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
245 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
246 if (m_FireParticle)
247 {
248 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
249
250 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
251 }
252 }
253
254 // DEBUG BELLOW
255 void DebugSetHealthAndEnergy(float time)
256 {
257 float max_energy = GetCompEM().GetEnergyMaxPristine();
259 SetHealth01("","", health01);
260 GetCompEM().SetEnergy( time );
261 }
262
264 {
265 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
266 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
267 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
268 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
269 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
270
271 super.GetDebugActions(outputList);
272 }
273
274 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
275 {
276 if (super.OnAction(action_id, player, ctx))
277 return true;
278 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
279 {
280 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
281 {
284 }
285 else if (action_id == EActions.BROOM_BURN_SHORT)
286 {
289 }
290 else if (action_id == EActions.BROOM_BURN_MEDIUM)
291 {
294 }
295 else if (action_id == EActions.BROOM_BURN_LONG)
296 {
297 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
299 }
300 }
301 return false;
302 }
303
304}
305
306class Broom: BroomBase
307{
308 override string GetBurningMaterial()
309 {
310 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
311 }
312
313 override string GetBurntMaterial()
314 {
315 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
316 }
317}

◆ DebugSetHealthAndEnergy()

void DebugSetHealthAndEnergy ( float time)
222{
223 override void Init()
224 {
225 super.Init();
226 m_DecraftResult = "LongWoodenStick";
227 m_ParticleLocalPos = Vector(0, 1.2, 0);
228 }
229
230 override void SetActions()
231 {
232 super.SetActions();
233
236 }
237
238 override bool CanReceiveUpgrade()
239 {
240 return false;
241 }
242
243 override void OnWorkStart()
244 {
245 super.OnWorkStart();
247 }
248
250 {
251 result.SetHealth(result.GetHealthLevelValue(2,""));
252 result.SetQuantity(1);
253 }
254
255 override bool CanTransformIntoStick()
256 {
257 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
258 return true;
259 else
260 return false;
261 }
262
263
265 {
267
268 GetCompEM().SetEnergy0To1(GetHealth01("",""));
269 }
270
271
272 override void CalculateQuantity()
273 {
274 if (GetGame().IsServer())
275 {
276 float currentHealth01 = GetHealth01();
277 float currentEnergy01 = GetCompEM().GetEnergy0To1();
278
279 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
280 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
281 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
282 GetCompEM().SetEnergy0To1(GetHealth01());
283 }
284 }
285
286 override void UpdateParticle()
287 {
289
290 if (!m_FireParticle)
291 {
292 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
293 }
294 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
295 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
296 if (m_FireParticle)
297 {
298 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
299
300 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
301 }
302 }
303
304 // DEBUG BELLOW
305 void DebugSetHealthAndEnergy(float time)
306 {
307 float max_energy = GetCompEM().GetEnergyMaxPristine();
309 SetHealth01("","", health01);
310 GetCompEM().SetEnergy( time );
311 }
312
314 {
315 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
316 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
317 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
318 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
319 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
320
321 super.GetDebugActions(outputList);
322 }
323
324 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
325 {
326 if (super.OnAction(action_id, player, ctx))
327 return true;
328 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
329 {
330 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
331 {
334 }
335 else if (action_id == EActions.BROOM_BURN_SHORT)
336 {
339 }
340 else if (action_id == EActions.BROOM_BURN_MEDIUM)
341 {
344 }
345 else if (action_id == EActions.BROOM_BURN_LONG)
346 {
347 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
349 }
350 }
351 return false;
352 }
353
354}
355
356class Broom: BroomBase
357{
358 override string GetBurningMaterial()
359 {
360 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
361 }
362
363 override string GetBurntMaterial()
364 {
365 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
366 }
367}

◆ EEHitBy()

override void EEHitBy ( TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo,
vector modelPos,
float speedCoef )
181{
182 override void Init()
183 {
184 super.Init();
185 m_DecraftResult = "LongWoodenStick";
186 m_ParticleLocalPos = Vector(0, 1.2, 0);
187 }
188
189 override void SetActions()
190 {
191 super.SetActions();
192
195 }
196
197 override bool CanReceiveUpgrade()
198 {
199 return false;
200 }
201
202 override void OnWorkStart()
203 {
204 super.OnWorkStart();
206 }
207
209 {
210 result.SetHealth(result.GetHealthLevelValue(2,""));
211 result.SetQuantity(1);
212 }
213
214 override bool CanTransformIntoStick()
215 {
216 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
217 return true;
218 else
219 return false;
220 }
221
222
224 {
226
227 GetCompEM().SetEnergy0To1(GetHealth01("",""));
228 }
229
230
231 override void CalculateQuantity()
232 {
233 if (GetGame().IsServer())
234 {
235 float currentHealth01 = GetHealth01();
236 float currentEnergy01 = GetCompEM().GetEnergy0To1();
237
238 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
239 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
240 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
241 GetCompEM().SetEnergy0To1(GetHealth01());
242 }
243 }
244
245 override void UpdateParticle()
246 {
248
249 if (!m_FireParticle)
250 {
251 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
252 }
253 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
254 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
255 if (m_FireParticle)
256 {
257 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
258
259 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
260 }
261 }
262
263 // DEBUG BELLOW
264 void DebugSetHealthAndEnergy(float time)
265 {
266 float max_energy = GetCompEM().GetEnergyMaxPristine();
268 SetHealth01("","", health01);
269 GetCompEM().SetEnergy( time );
270 }
271
273 {
274 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
275 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
276 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
277 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
278 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
279
280 super.GetDebugActions(outputList);
281 }
282
283 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
284 {
285 if (super.OnAction(action_id, player, ctx))
286 return true;
287 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
288 {
289 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
290 {
293 }
294 else if (action_id == EActions.BROOM_BURN_SHORT)
295 {
298 }
299 else if (action_id == EActions.BROOM_BURN_MEDIUM)
300 {
303 }
304 else if (action_id == EActions.BROOM_BURN_LONG)
305 {
306 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
308 }
309 }
310 return false;
311 }
312
313}
314
315class Broom: BroomBase
316{
317 override string GetBurningMaterial()
318 {
319 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
320 }
321
322 override string GetBurntMaterial()
323 {
324 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
325 }
326}

◆ GetBurningMaterial()

BroomBase FlammableBase GetBurningMaterial ( )
139 {
140 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
141 }

◆ GetBurntMaterial()

override string GetBurntMaterial ( )
144 {
145 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
146 }

◆ GetDebugActions()

override void GetDebugActions ( out TSelectableActionInfoArrayEx outputList)
230{
231 override void Init()
232 {
233 super.Init();
234 m_DecraftResult = "LongWoodenStick";
235 m_ParticleLocalPos = Vector(0, 1.2, 0);
236 }
237
238 override void SetActions()
239 {
240 super.SetActions();
241
244 }
245
246 override bool CanReceiveUpgrade()
247 {
248 return false;
249 }
250
251 override void OnWorkStart()
252 {
253 super.OnWorkStart();
255 }
256
258 {
259 result.SetHealth(result.GetHealthLevelValue(2,""));
260 result.SetQuantity(1);
261 }
262
263 override bool CanTransformIntoStick()
264 {
265 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
266 return true;
267 else
268 return false;
269 }
270
271
273 {
275
276 GetCompEM().SetEnergy0To1(GetHealth01("",""));
277 }
278
279
280 override void CalculateQuantity()
281 {
282 if (GetGame().IsServer())
283 {
284 float currentHealth01 = GetHealth01();
285 float currentEnergy01 = GetCompEM().GetEnergy0To1();
286
287 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
288 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
289 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
290 GetCompEM().SetEnergy0To1(GetHealth01());
291 }
292 }
293
294 override void UpdateParticle()
295 {
297
298 if (!m_FireParticle)
299 {
300 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
301 }
302 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
303 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
304 if (m_FireParticle)
305 {
306 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
307
308 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
309 }
310 }
311
312 // DEBUG BELLOW
313 void DebugSetHealthAndEnergy(float time)
314 {
315 float max_energy = GetCompEM().GetEnergyMaxPristine();
317 SetHealth01("","", health01);
318 GetCompEM().SetEnergy( time );
319 }
320
322 {
323 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
324 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
325 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
326 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
327 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
328
329 super.GetDebugActions(outputList);
330 }
331
332 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
333 {
334 if (super.OnAction(action_id, player, ctx))
335 return true;
336 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
337 {
338 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
339 {
342 }
343 else if (action_id == EActions.BROOM_BURN_SHORT)
344 {
347 }
348 else if (action_id == EActions.BROOM_BURN_MEDIUM)
349 {
352 }
353 else if (action_id == EActions.BROOM_BURN_LONG)
354 {
355 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
357 }
358 }
359 return false;
360 }
361
362}
363
364class Broom: BroomBase
365{
366 override string GetBurningMaterial()
367 {
368 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
369 }
370
371 override string GetBurntMaterial()
372 {
373 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
374 }
375}

◆ Init()

override void Init ( )

Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)

pre-init arrays

139 {
140 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
141 }
142
143 override string GetBurntMaterial()
144 {

◆ OnAction()

override bool OnAction ( int action_id,
Man player,
ParamsReadContext ctx )
241{
242 override void Init()
243 {
244 super.Init();
245 m_DecraftResult = "LongWoodenStick";
246 m_ParticleLocalPos = Vector(0, 1.2, 0);
247 }
248
249 override void SetActions()
250 {
251 super.SetActions();
252
255 }
256
257 override bool CanReceiveUpgrade()
258 {
259 return false;
260 }
261
262 override void OnWorkStart()
263 {
264 super.OnWorkStart();
266 }
267
269 {
270 result.SetHealth(result.GetHealthLevelValue(2,""));
271 result.SetQuantity(1);
272 }
273
274 override bool CanTransformIntoStick()
275 {
276 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
277 return true;
278 else
279 return false;
280 }
281
282
284 {
286
287 GetCompEM().SetEnergy0To1(GetHealth01("",""));
288 }
289
290
291 override void CalculateQuantity()
292 {
293 if (GetGame().IsServer())
294 {
295 float currentHealth01 = GetHealth01();
296 float currentEnergy01 = GetCompEM().GetEnergy0To1();
297
298 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
299 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
300 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
301 GetCompEM().SetEnergy0To1(GetHealth01());
302 }
303 }
304
305 override void UpdateParticle()
306 {
308
309 if (!m_FireParticle)
310 {
311 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
312 }
313 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
314 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
315 if (m_FireParticle)
316 {
317 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
318
319 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
320 }
321 }
322
323 // DEBUG BELLOW
324 void DebugSetHealthAndEnergy(float time)
325 {
326 float max_energy = GetCompEM().GetEnergyMaxPristine();
328 SetHealth01("","", health01);
329 GetCompEM().SetEnergy( time );
330 }
331
333 {
334 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
335 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
336 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
337 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
338 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
339
340 super.GetDebugActions(outputList);
341 }
342
343 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
344 {
345 if (super.OnAction(action_id, player, ctx))
346 return true;
347 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
348 {
349 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
350 {
353 }
354 else if (action_id == EActions.BROOM_BURN_SHORT)
355 {
358 }
359 else if (action_id == EActions.BROOM_BURN_MEDIUM)
360 {
363 }
364 else if (action_id == EActions.BROOM_BURN_LONG)
365 {
366 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
368 }
369 }
370 return false;
371 }
372
373}
374
375class Broom: BroomBase
376{
377 override string GetBurningMaterial()
378 {
379 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
380 }
381
382 override string GetBurntMaterial()
383 {
384 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
385 }
386}

◆ OnWorkStart()

override void OnWorkStart ( )
160{
161 override void Init()
162 {
163 super.Init();
164 m_DecraftResult = "LongWoodenStick";
165 m_ParticleLocalPos = Vector(0, 1.2, 0);
166 }
167
168 override void SetActions()
169 {
170 super.SetActions();
171
174 }
175
176 override bool CanReceiveUpgrade()
177 {
178 return false;
179 }
180
181 override void OnWorkStart()
182 {
183 super.OnWorkStart();
185 }
186
188 {
189 result.SetHealth(result.GetHealthLevelValue(2,""));
190 result.SetQuantity(1);
191 }
192
193 override bool CanTransformIntoStick()
194 {
195 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
196 return true;
197 else
198 return false;
199 }
200
201
203 {
205
206 GetCompEM().SetEnergy0To1(GetHealth01("",""));
207 }
208
209
210 override void CalculateQuantity()
211 {
212 if (GetGame().IsServer())
213 {
214 float currentHealth01 = GetHealth01();
215 float currentEnergy01 = GetCompEM().GetEnergy0To1();
216
217 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
218 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
219 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
220 GetCompEM().SetEnergy0To1(GetHealth01());
221 }
222 }
223
224 override void UpdateParticle()
225 {
227
228 if (!m_FireParticle)
229 {
230 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
231 }
232 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
233 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
234 if (m_FireParticle)
235 {
236 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
237
238 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
239 }
240 }
241
242 // DEBUG BELLOW
243 void DebugSetHealthAndEnergy(float time)
244 {
245 float max_energy = GetCompEM().GetEnergyMaxPristine();
247 SetHealth01("","", health01);
248 GetCompEM().SetEnergy( time );
249 }
250
252 {
253 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
254 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
255 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
256 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
257 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
258
259 super.GetDebugActions(outputList);
260 }
261
262 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
263 {
264 if (super.OnAction(action_id, player, ctx))
265 return true;
266 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
267 {
268 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
269 {
272 }
273 else if (action_id == EActions.BROOM_BURN_SHORT)
274 {
277 }
278 else if (action_id == EActions.BROOM_BURN_MEDIUM)
279 {
282 }
283 else if (action_id == EActions.BROOM_BURN_LONG)
284 {
285 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
287 }
288 }
289 return false;
290 }
291
292}
293
294class Broom: BroomBase
295{
296 override string GetBurningMaterial()
297 {
298 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
299 }
300
301 override string GetBurntMaterial()
302 {
303 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
304 }
305}

◆ SetActions()

override void SetActions ( )

◆ UpdateParticle()

override void UpdateParticle ( )
203{
204 override void Init()
205 {
206 super.Init();
207 m_DecraftResult = "LongWoodenStick";
208 m_ParticleLocalPos = Vector(0, 1.2, 0);
209 }
210
211 override void SetActions()
212 {
213 super.SetActions();
214
217 }
218
219 override bool CanReceiveUpgrade()
220 {
221 return false;
222 }
223
224 override void OnWorkStart()
225 {
226 super.OnWorkStart();
228 }
229
231 {
232 result.SetHealth(result.GetHealthLevelValue(2,""));
233 result.SetQuantity(1);
234 }
235
236 override bool CanTransformIntoStick()
237 {
238 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
239 return true;
240 else
241 return false;
242 }
243
244
246 {
248
249 GetCompEM().SetEnergy0To1(GetHealth01("",""));
250 }
251
252
253 override void CalculateQuantity()
254 {
255 if (GetGame().IsServer())
256 {
257 float currentHealth01 = GetHealth01();
258 float currentEnergy01 = GetCompEM().GetEnergy0To1();
259
260 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
261 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
262 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
263 GetCompEM().SetEnergy0To1(GetHealth01());
264 }
265 }
266
267 override void UpdateParticle()
268 {
270
271 if (!m_FireParticle)
272 {
273 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
274 }
275 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
276 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
277 if (m_FireParticle)
278 {
279 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
280
281 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
282 }
283 }
284
285 // DEBUG BELLOW
286 void DebugSetHealthAndEnergy(float time)
287 {
288 float max_energy = GetCompEM().GetEnergyMaxPristine();
290 SetHealth01("","", health01);
291 GetCompEM().SetEnergy( time );
292 }
293
295 {
296 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
297 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
298 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
299 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
300 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
301
302 super.GetDebugActions(outputList);
303 }
304
305 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
306 {
307 if (super.OnAction(action_id, player, ctx))
308 return true;
309 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
310 {
311 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
312 {
315 }
316 else if (action_id == EActions.BROOM_BURN_SHORT)
317 {
320 }
321 else if (action_id == EActions.BROOM_BURN_MEDIUM)
322 {
325 }
326 else if (action_id == EActions.BROOM_BURN_LONG)
327 {
328 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
330 }
331 }
332 return false;
333 }
334
335}
336
337class Broom: BroomBase
338{
339 override string GetBurningMaterial()
340 {
341 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
342 }
343
344 override string GetBurntMaterial()
345 {
346 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
347 }
348}