13 protected static const float LIGHT_EMISSIVITY_START = 5;
29 [
Attribute(
"",
desc:
"Data for flame lighting that is visible when vehicle burns", UIWidgets.Object,
"",
category:
"Flammability")]
34 protected float m_fFireMultiplier;
36 [
Attribute(defvalue:
"0",
desc:
"Fire damage applied to occupants of a burning vehicle each second (hp)",
params:
"0 100 0.01",
category:
"Flammability")]
40 protected float m_fIncendiaryThreshold;
42 [
Attribute(defvalue:
"8",
desc:
"Fire damage applied to occupants of a burning vehicle each second\n[hp]",
params:
"0 100 0.01",
category:
"Flammability")]
43 protected float m_fFireDamageOccupants;
46 protected float m_fLightSmokeStopTime;
48 [
Attribute(defvalue:
"1800",
desc:
"Maximum time for heavy smoke to become light smoke\n[s]",
params:
"0 10000 0.1",
category:
"Flammability")]
49 protected float m_fHeavySmokeStopTime;
52 protected float m_fIgnitingSmokeStokeTime;
54 [
Attribute(defvalue:
"60",
desc:
"Minimum time for burning hitzone down\nDetermines maximum fire rate\n[s]",
params:
"0 10000 0.1",
category:
"Flammability")]
55 protected float m_fMinFireBurningTime;
57 [
Attribute(defvalue:
"240",
desc:
"Maximum time for burning hitzone down\nDetermines minimum fire rate\n[s]",
params:
"0 10000 0.1",
category:
"Flammability")]
58 protected float m_fMaxFireBurningTime;
61 protected float m_fBurningTime;
63 [
Attribute(defvalue:
"0.1", uiwidget: UIWidgets.Slider,
desc:
"Light smoke effect threshold\n[x * minimum fire rate]",
params:
"0 1 0.01",
category:
"Flammability")]
64 protected float m_fLightSmokeThreshold;
66 [
Attribute(defvalue:
"0.5", uiwidget: UIWidgets.Slider,
desc:
"Heavy smoke effect threshold\n[x * minimum fire rate]",
params:
"0 1 0.01",
category:
"Flammability")]
67 protected float m_fHeavySmokeThreshold;
69 [
Attribute(defvalue:
"0.8", uiwidget: UIWidgets.Slider,
desc:
"Igniting smoke effect threshold\n[x * minimum fire rate]",
params:
"0 1 0.01",
category:
"Flammability")]
70 protected float m_fIgnitingSmokeThreshold;
82 [
Attribute(
desc:
"Particle effect for fire on ground under object after the wreck stops moving",
params:
"ptc",
category:
"Effects")]
86 protected float m_fWaterDepthThreshold;
102 override void OnInit(IEntity pOwnerEntity, GenericComponent pManagerComponent)
104 super.OnInit(pOwnerEntity, pManagerComponent);
110 damageManager.RegisterFlammableHitZone(
this);
112 m_SignalsManager = SignalsManagerComponent.Cast(pOwnerEntity.FindComponent(SignalsManagerComponent));
126 super.OnMaxHealthChanged();
140 if (m_fFireMultiplier <= 0)
143 if (m_fMinFireBurningTime > 0)
146 if (m_fMaxFireBurningTime > 0)
149 if (m_fLightSmokeStopTime > 0)
152 if (m_fHeavySmokeStopTime > 0)
155 if (m_fIgnitingSmokeStokeTime > 0)
178 if (damageContext.damageType ==
EDamageType.INCENDIARY && !isDOT)
184 float damage = damageContext.damageValue;
186 damage *= m_fFireMultiplier;
189 hack.damageValue = damage;
191 return super.ComputeEffectiveDamage(hack, isDOT);
203 float incendiaryDamage = rawDamage * GetBaseDamageMultiplier();
208 if (incendiaryDamage > 0)
215 if (incendiaryDamage < m_fIncendiaryThreshold)
216 incendiaryDamage = 0;
259 super.OnDamageStateChanged();
266 else if (GetPreviousDamageState() ==
EDamageState.DESTROYED)
294 if (weight < 0 || weight > 1)
332 float fireRate = Math.Lerp(bottom, top, weight);
376 array<HitZone> hitZones = {};
377 SCR_DamageManagerComponent hitZoneContainer = SCR_DamageManagerComponent.Cast(GetHitZoneContainer());
379 if (!hitZoneContainer)
382 hitZoneContainer.GetAllHitZones(hitZones);
383 int hitZoneIndex = hitZones.Find(
this);
384 if (hitZoneIndex >= 0)
385 hitZoneContainer.Rpc(hitZoneContainer.RpcDo_SetFireState, hitZoneIndex,
m_eFireState);
420 if (fireRate > 0 &&
SCR_WorldTools.IsObjectUnderwater(
GetOwner(), m_vParticleOffset, -1, depth) && depth > m_fWaterDepthThreshold)
462 instigator =
Instigator.CreateInstigator(
null);
473 float damageOccupants = m_fFireDamageOccupants * deltaTime;
477 if (damageOccupants > 0)
490 BaseWorld world =
GetGame().GetWorld();
506 float currentTime = world.GetWorldTime();
570 SCR_DamageManagerComponent hitZoneContainer = SCR_DamageManagerComponent.Cast(GetHitZoneContainer());
572 if (!hitZoneContainer)
575 if (
IsProxy() && !hitZoneContainer.IsRplReady())
579 if (
SCR_WorldTools.IsObjectUnderwater(owner, m_vParticleOffset, -1, depth) && depth > m_fWaterDepthThreshold)
587 ScriptCallQueue queue =
GetGame().GetCallqueue();
601 if (
SCR_WorldTools.IsObjectUnderwater(owner, m_vParticleOffset, -1, depth) && depth > m_fWaterDepthThreshold)
613 Physics physics = owner.GetPhysics();
614 if (physics && physics.GetVelocity().LengthSq() > 0.01)
618 vector
position = owner.GetOrigin();
629 if (System.IsConsoleApp())
638 if (m_sDestructionParticle.IsEmpty())
641 ParticleEffectEntitySpawnParams spawnParams();
642 spawnParams.Transform[3] =
position;
643 spawnParams.UseFrameEvent =
true;
653 ScriptCallQueue queue =
GetGame().GetCallqueue();
666 if (System.IsConsoleApp())
680 ParticleEffectEntitySpawnParams spawnParams();
681 spawnParams.Transform[3] = m_vParticleOffset;
682 spawnParams.Parent = owner;
683 spawnParams.PlayOnSpawn =
false;
684 spawnParams.UseFrameEvent =
true;
741 vector ownerOrigin = owner.GetOrigin();
747 LightEntity lightEntity = LightEntity.CreateLight(lightdata.GetLightType(), lightdata.GetLightFlag(), lightdata.GetEffectRadius(), Color.FromVector(lightdata.GetLightColor()), LIGHT_EMISSIVITY_START, ownerOrigin);
748 owner.AddChild(lightEntity, -1, EAddChildFlags.AUTO_TRANSFORM);
751 lightEntity.SetOrigin(ownerOrigin + lightdata.GetLightOffset());
752 lightEntity.SetLensFlareType(LightLensFlareType.Disabled);
753 lightEntity.SetIntensityEVClip(lightdata.GetIntensityClipEV());