DayZ 1.24
Loading...
Searching...
No Matches
ParticleManager.c
Go to the documentation of this file.
38
41 {
42 }
43}
44
51
54{
57
60 {
61 if (!g_ParticleManager && !GetGame().IsDedicatedServer())
62 {
67 g_ParticleManager.SetName("GlobalParticleManager");
68 }
69
70 return g_ParticleManager;
71 }
72
74 static void CleanupInstance()
75 {
77 delete g_ParticleManager;
78 }
79
87
90 {
91 }
92
93
98
111 {
112 int flags = ParticlePropertiesFlags.NONE;
113
114 if (playOnCreation)
115 flags = flags | ParticlePropertiesFlags.PLAY_ON_CREATION;
116
118 flags = flags | ParticlePropertiesFlags.FORCE_WORLD_ROT;
119
120 return CreateParticleEx(id, pos, flags, parent, ori, owner);
121 }
122
134 {
136 if (particlePath == "") // There is already an error inside of ParticleList signaling this
137 {
138 ErrorEx(string.Format("Could not create ParticleSource as particle id %1 is invalid.", id));
139 return null;
140 }
141
142 ParticleProperties props = new ParticleProperties(pos, flags, parent, ori, owner);
144 return p;
145 }
146
165
173
186
194
196
197
202
216
224
235
241
249
251
252
257
267
275 {
278
279 if (tempArr.Count() > 0)
280 return tempArr[0];
281 else
282 return null;
283 }
284
296
310
317 ParticleSource CreateParticleById(int id, ParticleProperties properties)
318 {
321
322 if (tempArr.Count() > 0)
323 return tempArr[0];
324 else
325 return null;
326 }
327
337
351
359 {
362
363 if (tempArr.Count() > 0)
364 return tempArr[0];
365 else
366 return null;
367 }
368
375
384
397
399
400
405
410 proto native void SetName(string name);
411
416 proto string GetName();
417
423
428 override string GetDebugName()
429 {
430 return GetDebugNameNative();
431 }
432
438
444
450
452
453
458
464
470
476
482
488
490
491
496
502
508
517
519
520
525
527 {
528 GetEvents().Event_OnAllocation.Invoke(this, allocatedParticles);
529 }
530
532 {
533 GetEvents().Event_OnAllocationEnd.Invoke(this);
534 }
535
537}
void CreateParticle()
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
static AnimSoundObjectBuilderBank GetInstance()
ParticleEvents GetEvents()
Get the events.
proto native int PlayParticles(out array< ParticleSource > particles, string path, notnull array< vector > positions, int count=1)
QoL function for when wanting to play a particle at a position right away.
proto native int GetVirtualCount()
Gets the amount of virtual particles.
proto native int GetPoolSize()
Gets the fixed maximum size of the pool.
class ParticleManagerConstants ParticleManagerSettings(int poolSize, int flags=ParticleManagerSettingsFlags.NONE)
Settings given to ParticleManager on creation (in ctor)
ParticleSource PlayInWorldEx(int particle_id, Object parent_obj, vector global_pos, vector global_ori="0 0 0", bool force_world_rotation=false)
proto native int GetPlayingCount()
Gets the amount of playing particles.
ParticleSource PlayParticleById(int id, array< vector > position)
QoL function for when only one particle is needed using script ParticleList, strongly recommend to re...
proto static native int GetStaticActiveCount()
Gets the amount of ParticleManager that are currently existing.
proto native int GetParticles(out array< ParticleSource > outArray, int startIndex, int count)
Manually get a portion of the particles in the pool.
ParticleSource CreateParticleEx(int id, vector pos, int flags=ParticlePropertiesFlags.NONE, Object parent=null, vector ori=vector.Zero, Class owner=null)
Master create function.
proto int GetCountID()
Gets the ID for the ParticleManager.
static void CleanupInstance()
To clean it up properly before game closes.
ParticleSource CreateInWorld(int particle_id, vector global_pos, vector global_ori="0 0 0", bool force_world_rotation=false)
Creates a particle emitter on the given position.
ParticleSource CreateOnObject(int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_world_rotation=false)
Creates a particle emitter and attaches it on the given object.
void OnAllocation(array< ParticleSource > allocatedParticles)
array< ParticleSource > CreateParticlesByIdArr(int id, notnull ParticlePropertiesArray properties, int count)
QoL function using script ParticleList, strongly recommend to read comments for CreateParticles as we...
proto string GetDebugNameNative()
Gets the debug name for the ParticleManager.
void OnAllocationEnd()
ParticleSource PlayInWorld(int particle_id, vector global_pos)
Creates a particle emitter on the given position and activates it.
proto native ParticleSource GetParticle(int index)
Manually get the particle at index.
void ~ParticleManager()
dtor
int CreateParticlesById(int id, notnull ParticlePropertiesArray properties, int count)
QoL function using script ParticleList, strongly recommend to read comments for CreateParticles as we...
proto native int GetAllocatedCount()
Gets the amount of particles currently allocated.
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
ParticleSource CreateParticleById(int id, ParticleProperties properties)
QoL function for when only one particle is needed using script ParticleList, strongly recommend to re...
ParticleSource PlayOnObject(int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_world_rotation=false)
Creates a particle emitter, attaches it on the given object and activates it.
ParticleManagerSettingsFlags
Flags for ParticleManagerSettings.
@ REUSE_OWNED
Reuse stopped particles even if they are owned by something.
@ DISABLE_VIRTUAL
Disable the creation of virtual particles when the pool is still allocating.
@ BLOCKING
Allocation blocks the game until it is done.
@ FIXED_INDEX
Particles will be locked to the index and not reused.
@ NONE
proto native bool IsFinishedAllocating()
Checks if the ParticleManager has allocated all slots in the pool.
array< ParticleSource > PlayParticlesById(int id, array< vector > positions, int count)
QoL function using script ParticleList, strongly recommend to read comments for PlayParticles as well...
array< ParticleSource > GetParticlesEx(int startIndex, int count)
Manually get a portion of the particles in the pool.
ParticleSource CreateParticleByPath(string path, notnull ParticleProperties properties)
Create a particle.
proto static native int GetStaticCount()
Gets the amount of ParticleManager that have been created since the start of the program.
class ParticleManagerEvents g_ParticleManager
Has a fixed pool of precreated and reserved particles.
proto Managed GetScriptEvents()
Get the events.
proto native int CreateParticles(array< ParticleSource > particles, string path, notnull ParticlePropertiesArray properties, int count=1)
Creates an amount of particles with the properties given.
proto void SetScriptEvents(Managed events)
Set the events.
void ~ParticleManagerSettings()
dtor
int particle_id
EAnimPlayState Play()
Super root of all classes in Enforce script.
Definition EnScript.c:11
TODO doc.
Definition EnScript.c:118
static string GetParticleFullPath(int particle_id)
Returns particle's full path (with .ptc suffix) based on its ID.
Class simply to have easily modded constants.
static const int POOL_SIZE
Invokers for ParticleManager events.
ref ScriptInvoker Event_OnAllocation
ref ScriptInvoker Event_OnAllocationEnd
Entity which has the particle instance as an ObjectComponent.
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
static const vector Zero
Definition EnConvert.c:110
override string GetDebugName()
proto native CGame GetGame()
static proto native Shape Create(ShapeType type, int color, ShapeFlags flags, vector p1, vector p2)
enum ShapeType ErrorEx
proto native void SetName(string name)
proto native owned string GetName()