4 [
Attribute(
"{C0E2E7DC28B71E2C}Particles/Enviroment/Campfire_medium_normal.ptc", UIWidgets.ResourceNamePicker,
"Prefab of fire particle used for a fire action.",
"ptc")]
5 protected ResourceName m_sParticle;
7 [
Attribute(
"0 0.2 0", UIWidgets.EditBox,
"Particle offset in local space from the origin of the entity")]
8 protected vector m_vParticleOffset;
12 ResourceName GetParticle()
19 vector GetParticleOffset()
21 return m_vParticleOffset;
25 class SCR_FireplaceComponent : SCR_BaseInteractiveLightComponent
33 protected static const float FLICKER_STEP = 0.05;
34 protected static const float FLICKER_THRESHOLD = 0.35;
35 protected static const float FLICKER_FREQUENCY = 1 / 30;
38 override void ToggleLight(
bool turnOn,
bool skipTransition =
false,
bool playSound =
true)
43 super.ToggleLight(turnOn, skipTransition, playSound);
46 if (System.IsConsoleApp())
66 ParticleEffectEntitySpawnParams spawnParams =
new ParticleEffectEntitySpawnParams();
67 spawnParams.TargetWorld =
GetOwner().GetWorld();
69 Math3D.MatrixIdentity4(spawnParams.Transform);
70 spawnParams.Transform[3] = componentData.GetParticleOffset();
72 m_pFireParticle = ParticleEffectEntity.SpawnParticleEffect(componentData.GetParticle(), spawnParams);
86 SetEventMask(
GetOwner(), EntityEvent.VISIBLE);
103 ClearEventMask(
GetOwner(), EntityEvent.VISIBLE);
109 BaseSlotComponent decalComponent = BaseSlotComponent.Cast(
GetOwner().FindComponent(BaseSlotComponent));
120 super.OnPostInit(owner);
126 super.EOnVisible(owner, frameNumber);
131 float timeSlice =
GetOwner().GetWorld().GetTimeSlice();
142 if (canFlickerBrighter && canFlickerDimmer)
144 if (Math.RandomIntInclusive(0, 1) == 0)
149 else if (canFlickerBrighter)
154 array<ref SCR_BaseLightData> lightData =
m_ComponentData.GetLightData();
155 for (
int i = Math.Min(
m_aLights.Count(), lightData.Count()) -1; i >= 0; i--)
157 auto ld = lightData[i];
168 reader.ReadBool(isOn);
176 super.OnDelete(owner);