Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CinematicParticleSourceEntity.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/Misc", description: "")]
2class SCR_CinematicParticleSourceEntityClass : GenericEntityClass
3{
4}
5
6class SCR_CinematicParticleSourceEntity : GenericEntity
7{
8 [Attribute(defvalue: "", desc: "Particle to spawn", uiwidget: UIWidgets.ResourcePickerThumbnail, params: "ptc")]
9 protected ResourceName m_sParticle;
10
11 [Attribute(defvalue: "1", desc: "Time after which the particle effect freezes", params: "0 inf")]
12 protected float m_fPauseTime;
13
14#ifdef WORKBENCH
15
16 protected bool m_bInitialised;
17 protected float m_fDuration;
18
20
21 protected static ref set<ParticleEffectEntity> s_PlayingParticles = new set<ParticleEffectEntity>(); // int counting is not enough
22
23 //------------------------------------------------------------------------------------------------
24 protected void Init()
25 {
26 m_bInitialised = true;
27 if (!m_sParticle)
28 return;
29
31 {
32 s_PlayingParticles.RemoveItem(m_ParticleEffectEntity);
34 }
35
36 EntitySpawnParams entitySpawnParams = new EntitySpawnParams();
37 entitySpawnParams.Parent = this;
38
41 return;
42
43 m_ParticleEffectEntity.SetEffectPath(m_sParticle);
45
46 m_fDuration = m_fPauseTime;
47 s_PlayingParticles.Insert(m_ParticleEffectEntity);
48 }
49
50 //------------------------------------------------------------------------------------------------
51 protected void PauseParticle()
52 {
54 return;
55
57 s_PlayingParticles.RemoveItem(m_ParticleEffectEntity);
58 s_PlayingParticles.RemoveItem(null); // this is the magic
59
60 if (s_PlayingParticles.IsEmpty())
61 Print("[SCR_CinematicParticleSourceEntity] Particle scene is ready (all particles are paused)", LogLevel.NORMAL);
62 }
63
64 //------------------------------------------------------------------------------------------------
65 protected void ResetParticle()
66 {
68 return;
69
72
73 m_fDuration = m_fPauseTime;
74 }
75
76 //------------------------------------------------------------------------------------------------
77 override protected void EOnFrame(IEntity owner, float timeSlice)
78 {
79 if (!m_bInitialised)
80 Init();
81
82 m_fDuration -= timeSlice;
83 if (m_fDuration <= 0 || !m_ParticleEffectEntity)
84 {
85 PauseParticle();
87 }
88 }
89
90 //------------------------------------------------------------------------------------------------
91 override event void _WB_SetTransform(inout vector mat[4], IEntitySource src)
92 {
94 return;
95
98 ResetParticle(); // unfortunately, particles do not follow the emitter
99 }
100
101 //------------------------------------------------------------------------------------------------
102 override event void _WB_OnInit(inout vector mat[4], IEntitySource src)
103 {
104 if (!m_bInitialised)
105 Init();
106 }
107
108 //------------------------------------------------------------------------------------------------
109 override event void _WB_AfterWorldUpdate(float timeSlice)
110 {
111 if (!m_bInitialised)
112 Init();
113
114 if (m_fDuration <= 0 || !m_ParticleEffectEntity) // required as _WB_GetAfterWorldUpdateSpecs is not called every time before this method
115 return;
116
117 m_fDuration -= timeSlice;
118 if (m_fDuration <= 0)
119 PauseParticle();
120 }
121
122 //------------------------------------------------------------------------------------------------
123 override event int _WB_GetAfterWorldUpdateSpecs(IEntitySource src)
124 {
125 return EEntityFrameUpdateSpecs.CALL_ALWAYS;
126 }
127
128 //------------------------------------------------------------------------------------------------
129 // constructor
130 void SCR_CinematicParticleSourceEntity(IEntitySource src, IEntity parent)
131 {
133 }
134
135 //------------------------------------------------------------------------------------------------
136 // destructor
137 void ~SCR_CinematicParticleSourceEntity()
138 {
140 {
141 s_PlayingParticles.RemoveItem(m_ParticleEffectEntity);
143 }
144 }
145
146 #endif // WORKBENCH
147}
override void Init()
ArmaReforgerScripted GetGame()
Definition game.c:1398
IEntity SpawnEntity(ResourceName entityResourceName, notnull IEntity slotOwner)
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void ParticleEffectEntity(IEntitySource src, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ParticleEffectEntity m_ParticleEffectEntity
enum EVehicleType IEntity
event void _WB_AfterWorldUpdate(float timeSlice)
Called after updating world in Workbench. The entity must be visible in frustum, selected or named....
event int _WB_GetAfterWorldUpdateSpecs(IEntitySource src)
Called after _WB_OnInit or also later when editor needs to know whether _WB_AfterWorldUpdate needs to...
event void _WB_OnInit(inout vector mat[4], IEntitySource src)
Called always after entity creation. It's purpose is to prepare entity for editing....
event void _WB_SetTransform(inout vector mat[4], IEntitySource src)
Editor changed transformation matrix source. This is the place to apply it on entity....
proto external EntityEvent SetEventMask(EntityEvent e)
proto external vector GetAngles()
Same as GetYawPitchRoll(), but returns rotation vector around X, Y and Z axis.
proto external vector GetOrigin()
void EOnFrame(IEntity owner, float timeSlice)
proto external EntityEvent ClearEventMask(EntityEvent e)
proto external BaseWorld GetWorld()
void EntitySpawnParams()
Definition gameLib.c:130
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
Definition EntityEvent.c:14