DayZ 1.24
Loading...
Searching...
No Matches
Broom.c File Reference

Go to the source code of this file.

Classes

class  BroomBase
 

Functions

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 ()
 

Function Documentation

◆ ApplyResultModifications()

override void GetBurningMaterial::ApplyResultModifications ( ItemBase result)

Definition at line 163 of file Broom.c.

◆ CalculateQuantity()

override void GetBurningMaterial::CalculateQuantity ( )

Definition at line 186 of file Broom.c.

187{
188 override void Init()
189 {
190 super.Init();
191 m_DecraftResult = "LongWoodenStick";
192 m_ParticleLocalPos = Vector(0, 1.2, 0);
193 }
194
195 override void SetActions()
196 {
197 super.SetActions();
198
201 }
202
203 override bool CanReceiveUpgrade()
204 {
205 return false;
206 }
207
208 override void OnWorkStart()
209 {
210 super.OnWorkStart();
212 }
213
215 {
216 result.SetHealth(result.GetHealthLevelValue(2, ""));
217 result.SetQuantity(1);
218 }
219
220 override bool CanTransformIntoStick()
221 {
222 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
223 return true;
224 else
225 return false;
226 }
227
228
230 {
232
233 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
234 }
235
236
237 override void CalculateQuantity()
238 {
239 if (GetGame().IsServer())
240 {
241 float currentHealth01 = GetHealth01();
242 float currentEnergy01 = GetCompEM().GetEnergy0To1();
243
244 //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)
245 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
246 //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
247 GetCompEM().SetEnergy0To1(GetHealth01());
248 }
249 }
250
251 override void UpdateParticle()
252 {
254
255 if (!m_FireParticle)
256 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
257 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
258 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
259 if (m_FireParticle)
260 {
261 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
262
263 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
264 }
265 }
266
267 // DEBUG BELLOW
268 void DebugSetHealthAndEnergy(float time)
269 {
270 float max_energy = GetCompEM().GetEnergyMaxPristine();
272 SetHealth01("", "", health01);
273 GetCompEM().SetEnergy(time);
274 }
275
277 {
278 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
279 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
280 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
281 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
282 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
283
284 super.GetDebugActions(outputList);
285 }
286
287 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
288 {
289 if (super.OnAction(action_id, player, ctx))
290 return true;
291 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
292 {
293 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
294 {
297 }
298 else if (action_id == EActions.BROOM_BURN_SHORT)
299 {
302 }
303 else if (action_id == EActions.BROOM_BURN_MEDIUM)
304 {
307 }
308 else if (action_id == EActions.BROOM_BURN_LONG)
309 {
310 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
312 }
313 }
314 return false;
315 }
316
317}
318
319class Broom: BroomBase
320{
321 override string GetBurningMaterial()
322 {
323 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
324 }
325
326 override string GetBurntMaterial()
327 {
328 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
329 }
330}
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition EntityAI.c:97
void AddAction(typename actionName)
override void UpdateParticle()
Definition Broom.c:200
override void CalculateQuantity()
Definition Broom.c:186
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition Broom.c:225
override bool CanReceiveUpgrade()
Definition Broom.c:152
override void SetActions()
Definition Broom.c:144
override void OnWorkStart()
Definition Broom.c:157
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition Broom.c:236
override string GetBurntMaterial()
Definition Broom.c:141
override bool CanTransformIntoStick()
Definition Broom.c:169
override void Init()
Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside o...
Definition Broom.c:137
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Definition Broom.c:178
BroomBase FlammableBase GetBurningMaterial()
Definition Broom.c:136
void DebugSetHealthAndEnergy(float time)
Definition Broom.c:217
override void ApplyResultModifications(ItemBase result)
Definition Broom.c:163
EActions
Definition EActions.c:2
override void OnIgnitedThis(EntityAI fire_source)
Executed on Server when some item ignited this one.
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override float GetQuantity()
Definition ItemBase.c:7995
float GetEnergy()
Definition ItemBase.c:8140
override int GetQuantityMax()
Definition ItemBase.c:7941
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition EnMath.c:7
static const int BROOM_TORCH_T1
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
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 Min(float x, float y)
Returns smaller 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,...
EmitorParam
Definition EnVisual.c:114
const int SAT_DEBUG_ACTION
Definition constants.c:424

◆ CanReceiveUpgrade()

override bool GetBurningMaterial::CanReceiveUpgrade ( )

Definition at line 152 of file Broom.c.

153{
154 override void Init()
155 {
156 super.Init();
157 m_DecraftResult = "LongWoodenStick";
158 m_ParticleLocalPos = Vector(0, 1.2, 0);
159 }
160
161 override void SetActions()
162 {
163 super.SetActions();
164
167 }
168
169 override bool CanReceiveUpgrade()
170 {
171 return false;
172 }
173
174 override void OnWorkStart()
175 {
176 super.OnWorkStart();
178 }
179
181 {
182 result.SetHealth(result.GetHealthLevelValue(2, ""));
183 result.SetQuantity(1);
184 }
185
186 override bool CanTransformIntoStick()
187 {
188 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
189 return true;
190 else
191 return false;
192 }
193
194
196 {
198
199 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
200 }
201
202
203 override void CalculateQuantity()
204 {
205 if (GetGame().IsServer())
206 {
207 float currentHealth01 = GetHealth01();
208 float currentEnergy01 = GetCompEM().GetEnergy0To1();
209
210 //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)
211 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
212 //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
213 GetCompEM().SetEnergy0To1(GetHealth01());
214 }
215 }
216
217 override void UpdateParticle()
218 {
220
221 if (!m_FireParticle)
222 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
223 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
224 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
225 if (m_FireParticle)
226 {
227 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
228
229 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
230 }
231 }
232
233 // DEBUG BELLOW
234 void DebugSetHealthAndEnergy(float time)
235 {
236 float max_energy = GetCompEM().GetEnergyMaxPristine();
238 SetHealth01("", "", health01);
239 GetCompEM().SetEnergy(time);
240 }
241
243 {
244 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
245 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
246 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
247 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
248 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
249
250 super.GetDebugActions(outputList);
251 }
252
253 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
254 {
255 if (super.OnAction(action_id, player, ctx))
256 return true;
257 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
258 {
259 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
260 {
263 }
264 else if (action_id == EActions.BROOM_BURN_SHORT)
265 {
268 }
269 else if (action_id == EActions.BROOM_BURN_MEDIUM)
270 {
273 }
274 else if (action_id == EActions.BROOM_BURN_LONG)
275 {
276 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
278 }
279 }
280 return false;
281 }
282
283}
284
285class Broom: BroomBase
286{
287 override string GetBurningMaterial()
288 {
289 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
290 }
291
292 override string GetBurntMaterial()
293 {
294 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
295 }
296}

◆ CanTransformIntoStick()

override bool GetBurningMaterial::CanTransformIntoStick ( )

Definition at line 169 of file Broom.c.

170{
171 override void Init()
172 {
173 super.Init();
174 m_DecraftResult = "LongWoodenStick";
175 m_ParticleLocalPos = Vector(0, 1.2, 0);
176 }
177
178 override void SetActions()
179 {
180 super.SetActions();
181
184 }
185
186 override bool CanReceiveUpgrade()
187 {
188 return false;
189 }
190
191 override void OnWorkStart()
192 {
193 super.OnWorkStart();
195 }
196
198 {
199 result.SetHealth(result.GetHealthLevelValue(2, ""));
200 result.SetQuantity(1);
201 }
202
203 override bool CanTransformIntoStick()
204 {
205 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
206 return true;
207 else
208 return false;
209 }
210
211
213 {
215
216 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
217 }
218
219
220 override void CalculateQuantity()
221 {
222 if (GetGame().IsServer())
223 {
224 float currentHealth01 = GetHealth01();
225 float currentEnergy01 = GetCompEM().GetEnergy0To1();
226
227 //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)
228 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
229 //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
230 GetCompEM().SetEnergy0To1(GetHealth01());
231 }
232 }
233
234 override void UpdateParticle()
235 {
237
238 if (!m_FireParticle)
239 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
240 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
241 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
242 if (m_FireParticle)
243 {
244 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
245
246 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
247 }
248 }
249
250 // DEBUG BELLOW
251 void DebugSetHealthAndEnergy(float time)
252 {
253 float max_energy = GetCompEM().GetEnergyMaxPristine();
255 SetHealth01("", "", health01);
256 GetCompEM().SetEnergy(time);
257 }
258
260 {
261 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
262 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
263 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
264 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
265 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
266
267 super.GetDebugActions(outputList);
268 }
269
270 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
271 {
272 if (super.OnAction(action_id, player, ctx))
273 return true;
274 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
275 {
276 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
277 {
280 }
281 else if (action_id == EActions.BROOM_BURN_SHORT)
282 {
285 }
286 else if (action_id == EActions.BROOM_BURN_MEDIUM)
287 {
290 }
291 else if (action_id == EActions.BROOM_BURN_LONG)
292 {
293 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
295 }
296 }
297 return false;
298 }
299
300}
301
302class Broom: BroomBase
303{
304 override string GetBurningMaterial()
305 {
306 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
307 }
308
309 override string GetBurntMaterial()
310 {
311 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
312 }
313}

◆ DebugSetHealthAndEnergy()

void GetBurningMaterial::DebugSetHealthAndEnergy ( float time)

Definition at line 217 of file Broom.c.

218{
219 override void Init()
220 {
221 super.Init();
222 m_DecraftResult = "LongWoodenStick";
223 m_ParticleLocalPos = Vector(0, 1.2, 0);
224 }
225
226 override void SetActions()
227 {
228 super.SetActions();
229
232 }
233
234 override bool CanReceiveUpgrade()
235 {
236 return false;
237 }
238
239 override void OnWorkStart()
240 {
241 super.OnWorkStart();
243 }
244
246 {
247 result.SetHealth(result.GetHealthLevelValue(2, ""));
248 result.SetQuantity(1);
249 }
250
251 override bool CanTransformIntoStick()
252 {
253 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
254 return true;
255 else
256 return false;
257 }
258
259
261 {
263
264 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
265 }
266
267
268 override void CalculateQuantity()
269 {
270 if (GetGame().IsServer())
271 {
272 float currentHealth01 = GetHealth01();
273 float currentEnergy01 = GetCompEM().GetEnergy0To1();
274
275 //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)
276 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
277 //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
278 GetCompEM().SetEnergy0To1(GetHealth01());
279 }
280 }
281
282 override void UpdateParticle()
283 {
285
286 if (!m_FireParticle)
287 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
288 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
289 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
290 if (m_FireParticle)
291 {
292 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
293
294 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
295 }
296 }
297
298 // DEBUG BELLOW
299 void DebugSetHealthAndEnergy(float time)
300 {
301 float max_energy = GetCompEM().GetEnergyMaxPristine();
303 SetHealth01("", "", health01);
304 GetCompEM().SetEnergy(time);
305 }
306
308 {
309 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
310 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
311 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
312 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
313 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
314
315 super.GetDebugActions(outputList);
316 }
317
318 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
319 {
320 if (super.OnAction(action_id, player, ctx))
321 return true;
322 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
323 {
324 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
325 {
328 }
329 else if (action_id == EActions.BROOM_BURN_SHORT)
330 {
333 }
334 else if (action_id == EActions.BROOM_BURN_MEDIUM)
335 {
338 }
339 else if (action_id == EActions.BROOM_BURN_LONG)
340 {
341 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
343 }
344 }
345 return false;
346 }
347
348}
349
350class Broom: BroomBase
351{
352 override string GetBurningMaterial()
353 {
354 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
355 }
356
357 override string GetBurntMaterial()
358 {
359 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
360 }
361}

◆ EEHitBy()

override void GetBurningMaterial::EEHitBy ( TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo,
vector modelPos,
float speedCoef )

Definition at line 178 of file Broom.c.

179{
180 override void Init()
181 {
182 super.Init();
183 m_DecraftResult = "LongWoodenStick";
184 m_ParticleLocalPos = Vector(0, 1.2, 0);
185 }
186
187 override void SetActions()
188 {
189 super.SetActions();
190
193 }
194
195 override bool CanReceiveUpgrade()
196 {
197 return false;
198 }
199
200 override void OnWorkStart()
201 {
202 super.OnWorkStart();
204 }
205
207 {
208 result.SetHealth(result.GetHealthLevelValue(2, ""));
209 result.SetQuantity(1);
210 }
211
212 override bool CanTransformIntoStick()
213 {
214 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
215 return true;
216 else
217 return false;
218 }
219
220
222 {
224
225 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
226 }
227
228
229 override void CalculateQuantity()
230 {
231 if (GetGame().IsServer())
232 {
233 float currentHealth01 = GetHealth01();
234 float currentEnergy01 = GetCompEM().GetEnergy0To1();
235
236 //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)
237 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
238 //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
239 GetCompEM().SetEnergy0To1(GetHealth01());
240 }
241 }
242
243 override void UpdateParticle()
244 {
246
247 if (!m_FireParticle)
248 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
249 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
250 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
251 if (m_FireParticle)
252 {
253 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
254
255 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
256 }
257 }
258
259 // DEBUG BELLOW
260 void DebugSetHealthAndEnergy(float time)
261 {
262 float max_energy = GetCompEM().GetEnergyMaxPristine();
264 SetHealth01("", "", health01);
265 GetCompEM().SetEnergy(time);
266 }
267
269 {
270 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
271 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
272 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
273 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
274 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
275
276 super.GetDebugActions(outputList);
277 }
278
279 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
280 {
281 if (super.OnAction(action_id, player, ctx))
282 return true;
283 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
284 {
285 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
286 {
289 }
290 else if (action_id == EActions.BROOM_BURN_SHORT)
291 {
294 }
295 else if (action_id == EActions.BROOM_BURN_MEDIUM)
296 {
299 }
300 else if (action_id == EActions.BROOM_BURN_LONG)
301 {
302 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
304 }
305 }
306 return false;
307 }
308
309}
310
311class Broom: BroomBase
312{
313 override string GetBurningMaterial()
314 {
315 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
316 }
317
318 override string GetBurntMaterial()
319 {
320 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
321 }
322}

◆ GetBurningMaterial()

BroomBase FlammableBase GetBurningMaterial ( )

Definition at line 1 of file Broom.c.

137 {
138 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
139 }

◆ GetBurntMaterial()

override string GetBurntMaterial ( )

Definition at line 141 of file Broom.c.

142 {
143 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
144 }

◆ GetDebugActions()

override void GetBurningMaterial::GetDebugActions ( out TSelectableActionInfoArrayEx outputList)

Definition at line 225 of file Broom.c.

226{
227 override void Init()
228 {
229 super.Init();
230 m_DecraftResult = "LongWoodenStick";
231 m_ParticleLocalPos = Vector(0, 1.2, 0);
232 }
233
234 override void SetActions()
235 {
236 super.SetActions();
237
240 }
241
242 override bool CanReceiveUpgrade()
243 {
244 return false;
245 }
246
247 override void OnWorkStart()
248 {
249 super.OnWorkStart();
251 }
252
254 {
255 result.SetHealth(result.GetHealthLevelValue(2, ""));
256 result.SetQuantity(1);
257 }
258
259 override bool CanTransformIntoStick()
260 {
261 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
262 return true;
263 else
264 return false;
265 }
266
267
269 {
271
272 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
273 }
274
275
276 override void CalculateQuantity()
277 {
278 if (GetGame().IsServer())
279 {
280 float currentHealth01 = GetHealth01();
281 float currentEnergy01 = GetCompEM().GetEnergy0To1();
282
283 //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)
284 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
285 //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
286 GetCompEM().SetEnergy0To1(GetHealth01());
287 }
288 }
289
290 override void UpdateParticle()
291 {
293
294 if (!m_FireParticle)
295 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
296 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
297 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
298 if (m_FireParticle)
299 {
300 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
301
302 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
303 }
304 }
305
306 // DEBUG BELLOW
307 void DebugSetHealthAndEnergy(float time)
308 {
309 float max_energy = GetCompEM().GetEnergyMaxPristine();
311 SetHealth01("", "", health01);
312 GetCompEM().SetEnergy(time);
313 }
314
316 {
317 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
318 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
319 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
320 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
321 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
322
323 super.GetDebugActions(outputList);
324 }
325
326 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
327 {
328 if (super.OnAction(action_id, player, ctx))
329 return true;
330 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
331 {
332 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
333 {
336 }
337 else if (action_id == EActions.BROOM_BURN_SHORT)
338 {
341 }
342 else if (action_id == EActions.BROOM_BURN_MEDIUM)
343 {
346 }
347 else if (action_id == EActions.BROOM_BURN_LONG)
348 {
349 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
351 }
352 }
353 return false;
354 }
355
356}
357
358class Broom: BroomBase
359{
360 override string GetBurningMaterial()
361 {
362 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
363 }
364
365 override string GetBurntMaterial()
366 {
367 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
368 }
369}

◆ Init()

override void GetBurningMaterial::Init ( )

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

pre-init arrays

Definition at line 137 of file Broom.c.

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

◆ OnAction()

override bool GetBurningMaterial::OnAction ( int action_id,
Man player,
ParamsReadContext ctx )

Definition at line 236 of file Broom.c.

237{
238 override void Init()
239 {
240 super.Init();
241 m_DecraftResult = "LongWoodenStick";
242 m_ParticleLocalPos = Vector(0, 1.2, 0);
243 }
244
245 override void SetActions()
246 {
247 super.SetActions();
248
251 }
252
253 override bool CanReceiveUpgrade()
254 {
255 return false;
256 }
257
258 override void OnWorkStart()
259 {
260 super.OnWorkStart();
262 }
263
265 {
266 result.SetHealth(result.GetHealthLevelValue(2, ""));
267 result.SetQuantity(1);
268 }
269
270 override bool CanTransformIntoStick()
271 {
272 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
273 return true;
274 else
275 return false;
276 }
277
278
280 {
282
283 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
284 }
285
286
287 override void CalculateQuantity()
288 {
289 if (GetGame().IsServer())
290 {
291 float currentHealth01 = GetHealth01();
292 float currentEnergy01 = GetCompEM().GetEnergy0To1();
293
294 //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)
295 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
296 //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
297 GetCompEM().SetEnergy0To1(GetHealth01());
298 }
299 }
300
301 override void UpdateParticle()
302 {
304
305 if (!m_FireParticle)
306 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
307 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
308 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
309 if (m_FireParticle)
310 {
311 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
312
313 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
314 }
315 }
316
317 // DEBUG BELLOW
318 void DebugSetHealthAndEnergy(float time)
319 {
320 float max_energy = GetCompEM().GetEnergyMaxPristine();
322 SetHealth01("", "", health01);
323 GetCompEM().SetEnergy(time);
324 }
325
327 {
328 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
329 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
330 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
331 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
332 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
333
334 super.GetDebugActions(outputList);
335 }
336
337 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
338 {
339 if (super.OnAction(action_id, player, ctx))
340 return true;
341 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
342 {
343 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
344 {
347 }
348 else if (action_id == EActions.BROOM_BURN_SHORT)
349 {
352 }
353 else if (action_id == EActions.BROOM_BURN_MEDIUM)
354 {
357 }
358 else if (action_id == EActions.BROOM_BURN_LONG)
359 {
360 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
362 }
363 }
364 return false;
365 }
366
367}
368
369class Broom: BroomBase
370{
371 override string GetBurningMaterial()
372 {
373 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
374 }
375
376 override string GetBurntMaterial()
377 {
378 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
379 }
380}

◆ OnWorkStart()

override void GetBurningMaterial::OnWorkStart ( )

Definition at line 157 of file Broom.c.

158{
159 override void Init()
160 {
161 super.Init();
162 m_DecraftResult = "LongWoodenStick";
163 m_ParticleLocalPos = Vector(0, 1.2, 0);
164 }
165
166 override void SetActions()
167 {
168 super.SetActions();
169
172 }
173
174 override bool CanReceiveUpgrade()
175 {
176 return false;
177 }
178
179 override void OnWorkStart()
180 {
181 super.OnWorkStart();
183 }
184
186 {
187 result.SetHealth(result.GetHealthLevelValue(2, ""));
188 result.SetQuantity(1);
189 }
190
191 override bool CanTransformIntoStick()
192 {
193 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
194 return true;
195 else
196 return false;
197 }
198
199
201 {
203
204 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
205 }
206
207
208 override void CalculateQuantity()
209 {
210 if (GetGame().IsServer())
211 {
212 float currentHealth01 = GetHealth01();
213 float currentEnergy01 = GetCompEM().GetEnergy0To1();
214
215 //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)
216 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
217 //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
218 GetCompEM().SetEnergy0To1(GetHealth01());
219 }
220 }
221
222 override void UpdateParticle()
223 {
225
226 if (!m_FireParticle)
227 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
228 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
229 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
230 if (m_FireParticle)
231 {
232 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
233
234 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
235 }
236 }
237
238 // DEBUG BELLOW
239 void DebugSetHealthAndEnergy(float time)
240 {
241 float max_energy = GetCompEM().GetEnergyMaxPristine();
243 SetHealth01("", "", health01);
244 GetCompEM().SetEnergy(time);
245 }
246
248 {
249 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
250 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
251 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
252 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
253 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
254
255 super.GetDebugActions(outputList);
256 }
257
258 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
259 {
260 if (super.OnAction(action_id, player, ctx))
261 return true;
262 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
263 {
264 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
265 {
268 }
269 else if (action_id == EActions.BROOM_BURN_SHORT)
270 {
273 }
274 else if (action_id == EActions.BROOM_BURN_MEDIUM)
275 {
278 }
279 else if (action_id == EActions.BROOM_BURN_LONG)
280 {
281 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
283 }
284 }
285 return false;
286 }
287
288}
289
290class Broom: BroomBase
291{
292 override string GetBurningMaterial()
293 {
294 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
295 }
296
297 override string GetBurntMaterial()
298 {
299 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
300 }
301}

◆ SetActions()

override void GetBurningMaterial::SetActions ( )

Definition at line 144 of file Broom.c.

◆ UpdateParticle()

override void GetBurningMaterial::UpdateParticle ( )

Definition at line 200 of file Broom.c.

201{
202 override void Init()
203 {
204 super.Init();
205 m_DecraftResult = "LongWoodenStick";
206 m_ParticleLocalPos = Vector(0, 1.2, 0);
207 }
208
209 override void SetActions()
210 {
211 super.SetActions();
212
215 }
216
217 override bool CanReceiveUpgrade()
218 {
219 return false;
220 }
221
222 override void OnWorkStart()
223 {
224 super.OnWorkStart();
226 }
227
229 {
230 result.SetHealth(result.GetHealthLevelValue(2, ""));
231 result.SetQuantity(1);
232 }
233
234 override bool CanTransformIntoStick()
235 {
236 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
237 return true;
238 else
239 return false;
240 }
241
242
244 {
246
247 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
248 }
249
250
251 override void CalculateQuantity()
252 {
253 if (GetGame().IsServer())
254 {
255 float currentHealth01 = GetHealth01();
256 float currentEnergy01 = GetCompEM().GetEnergy0To1();
257
258 //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)
259 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
260 //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
261 GetCompEM().SetEnergy0To1(GetHealth01());
262 }
263 }
264
265 override void UpdateParticle()
266 {
268
269 if (!m_FireParticle)
270 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
271 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
272 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
273 if (m_FireParticle)
274 {
275 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
276
277 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
278 }
279 }
280
281 // DEBUG BELLOW
282 void DebugSetHealthAndEnergy(float time)
283 {
284 float max_energy = GetCompEM().GetEnergyMaxPristine();
286 SetHealth01("", "", health01);
287 GetCompEM().SetEnergy(time);
288 }
289
291 {
292 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
293 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
294 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
295 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
296 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
297
298 super.GetDebugActions(outputList);
299 }
300
301 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
302 {
303 if (super.OnAction(action_id, player, ctx))
304 return true;
305 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
306 {
307 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
308 {
311 }
312 else if (action_id == EActions.BROOM_BURN_SHORT)
313 {
316 }
317 else if (action_id == EActions.BROOM_BURN_MEDIUM)
318 {
321 }
322 else if (action_id == EActions.BROOM_BURN_LONG)
323 {
324 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
326 }
327 }
328 return false;
329 }
330
331}
332
333class Broom: BroomBase
334{
335 override string GetBurningMaterial()
336 {
337 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
338 }
339
340 override string GetBurntMaterial()
341 {
342 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
343 }
344}