Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_LampComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted", color: "0 0 255 255")]
3{
4 [Attribute("{40318DDE45FF4CC3}Particles/Enviroment/Lamp_fire_normal.ptc", UIWidgets.ResourceNamePicker, "Prefab of fire particle used for a fire action.", "ptc")]
6
7 [Attribute("0 0.1 0", UIWidgets.EditBox, "Particle offset in local space from the origin of the entity")]
9
10 //------------------------------------------------------------------------------------------------
13 {
14 return m_sParticle;
15 }
16
17 //------------------------------------------------------------------------------------------------
23}
24
25class SCR_LampComponent : SCR_BaseInteractiveLightComponent
26{
29
30 //------------------------------------------------------------------------------------------------
31 override void ToggleLight(bool turnOn, bool skipTransition = false, bool playSound = true)
32 {
33 if (m_bIsOn == turnOn)
34 return;
35
36 super.ToggleLight(turnOn, skipTransition, playSound);
37
38 // don't continue if DS server is running in console (particles, decals)
39 if (System.IsConsoleApp())
40 return;
41
42 if (turnOn)
43 {
44 TurnOn();
45 }
46 else
47 {
48 TurnOff();
49 }
50 }
51
52 //------------------------------------------------------------------------------------------------
54 void TurnOn()
55 {
57 if (!m_pFireParticle && componentData)
58 {
60 spawnParams.TargetWorld = GetOwner().GetWorld();
61 spawnParams.Parent = GetOwner();
62 Math3D.MatrixIdentity4(spawnParams.Transform);
63 spawnParams.Transform[3] = componentData.GetParticleOffset();
64
65 m_pFireParticle = ParticleEffectEntity.SpawnParticleEffect(componentData.GetParticle(), spawnParams);
66 }
67 else if (m_pFireParticle)
68 {
69 m_pFireParticle.Play();
70 }
71 }
72
73 //------------------------------------------------------------------------------------------------
75 void TurnOff()
76 {
77 //Reset fire particles
79 {
80 m_pFireParticle.Stop();
81 }
82 }
83
84 //------------------------------------------------------------------------------------------------
85 override bool RplLoad(ScriptBitReader reader)
86 {
87 // Can't relay on RplLoad method of base class as with the lamp we have to execute ToggleLight method in both on / off state.
88 bool isOn = false;
89 reader.ReadBool(isOn);
90 ToggleLight(isOn, true);
91
92 return true;
93 }
94
95 //------------------------------------------------------------------------------------------------
96 override void OnDelete(IEntity owner)
97 {
98 super.OnDelete(owner);
99
100 RemoveLights();
101 }
102}
override bool RplLoad(ScriptBitReader reader)
SCR_CharacterSoundComponentClass GetComponentData()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void TurnOn()
override void ToggleLight(bool turnOn, bool skipTransition=false, bool playSound=true)
SCR_FireplaceComponentClass m_pFireParticle
SCR_FuelConsumptionComponentClass m_ComponentData
void ParticleEffectEntity(IEntitySource src, IEntity parent)
proto external BaseWorld GetWorld()
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_FieldOfViewSettings Attribute
void TurnOff()
Remove every particle associed with this effect.