Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
particlemanager.c File Reference

Go to the source code of this file.

Data Structures

class  ParticleManagerConstants
 Class simply to have easily modded constants. More...
 
class  ParticleManagerEvents
 Invokers for ParticleManager events. More...
 

Enumerations

enum  ParticleManagerSettingsFlags {
  NONE, FIXED_INDEX, BLOCKING, DISABLE_VIRTUAL,
  REUSE_OWNED
}
 Flags for ParticleManagerSettings. More...
 

Functions

class ParticleManagerConstants ParticleManagerSettings (int poolSize, int flags=ParticleManagerSettingsFlags.NONE)
 Settings given to ParticleManager on creation (in ctor) More...
 
void ~ParticleManagerSettings ()
 dtor More...
 
void ParticleManager (ParticleManagerSettings settings)
 Constructor (ctor) More...
 
void ~ParticleManager ()
 dtor More...
 
API for compatibility with Particle/ParticleSource create/play

Mimics the static Create and Play methods from Particle/ParticleSource

ParticleSource CreateParticle (int id, vector pos, bool playOnCreation=false, Object parent=null, vector ori=vector.Zero, bool forceWorldRotation=false, Class owner=null)
 Create function. More...
 
ParticleSource CreateParticleEx (int id, vector pos, int flags=ParticlePropertiesFlags.NONE, Object parent=null, vector ori=vector.Zero, Class owner=null)
 Master create function. More...
 
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. More...
 
ParticleSource Create (int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0")
 Legacy function for backwards compatibility. More...
 
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. More...
 
ParticleSource Create (int particle_id, vector global_pos, vector global_ori="0 0 0")
 Legacy function for backwards compatibility with 1.01 and below. More...
 
Static play on creation

You can use the following Play(...) functions to create and activate a particle in 1 line of your script.

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. More...
 
ParticleSource Play (int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0")
 Legacy function for backwards compatibility with 1.01 and below. More...
 
ParticleSource PlayInWorld (int particle_id, vector global_pos)
 Creates a particle emitter on the given position and activates it. More...
 
ParticleSource PlayInWorldEx (int particle_id, Object parent_obj, vector global_pos, vector global_ori="0 0 0", bool force_world_rotation=false)
 
ParticleSource Play (int particle_id, vector global_pos)
 Legacy function for backwards compatibility with 1.01 and below. More...
 
Get Particles

API for creating, playing or obtaining particles from the pool

proto native int CreateParticles (array< ParticleSource > particles, string path, notnull ParticlePropertiesArray properties, int count=1)
 Creates an amount of particles with the properties given. More...
 
ParticleSource CreateParticleByPath (string path, notnull ParticleProperties properties)
 Create a particle. More...
 
int CreateParticlesById (int id, notnull ParticlePropertiesArray properties, int count)
 QoL function using script ParticleList, strongly recommend to read comments for CreateParticles as well. More...
 
array< ParticleSourceCreateParticlesByIdArr (int id, notnull ParticlePropertiesArray properties, int count)
 QoL function using script ParticleList, strongly recommend to read comments for CreateParticles as well. More...
 
ParticleSource CreateParticleById (int id, ParticleProperties properties)
 QoL function for when only one particle is needed using script ParticleList, strongly recommend to read comments for CreateParticles as well. More...
 
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. More...
 
array< ParticleSourcePlayParticlesById (int id, array< vector > positions, int count)
 QoL function using script ParticleList, strongly recommend to read comments for PlayParticles as well. More...
 
ParticleSource PlayParticleById (int id, array< vector > position)
 QoL function for when only one particle is needed using script ParticleList, strongly recommend to read comments for PlayParticles as well. More...
 
proto native ParticleSource GetParticle (int index)
 Manually get the particle at index. More...
 
proto native int GetParticles (out array< ParticleSource > outArray, int startIndex, int count)
 Manually get a portion of the particles in the pool. More...
 
array< ParticleSourceGetParticlesEx (int startIndex, int count)
 Manually get a portion of the particles in the pool. More...
 
Identification

Identification functionality

proto native void SetName (string name)
 Set a name for the ParticleManager to identify it more easily. More...
 
proto string GetName ()
 Gets the name which is set for the ParticleManager, default is "ParticleSourceManager". More...
 
proto string GetDebugNameNative ()
 Gets the debug name for the ParticleManager. More...
 
override string GetDebugName ()
 Gets the debug name for the ParticleManager. More...
 
proto int GetCountID ()
 Gets the ID for the ParticleManager. More...
 
Properties and state

Obtain information about the state of the ParticleManager

proto native int GetPoolSize ()
 Gets the fixed maximum size of the pool. More...
 
proto native int GetAllocatedCount ()
 Gets the amount of particles currently allocated. More...
 
proto native int GetVirtualCount ()
 Gets the amount of virtual particles. More...
 
proto native int GetPlayingCount ()
 Gets the amount of playing particles. More...
 
proto native bool IsFinishedAllocating ()
 Checks if the ParticleManager has allocated all slots in the pool. More...
 
Script Events API

Setting and getting of ScriptEvents

private proto void SetScriptEvents (Managed events)
 Set the events. More...
 
private proto Managed GetScriptEvents ()
 Get the events. More...
 
ParticleManagerEvents GetEvents ()
 Get the events. More...
 
Events

Events called from C++

void OnAllocation (array< ParticleSource > allocatedParticles)
 
void OnAllocationEnd ()
 

Variables

class ParticleManagerEvents g_ParticleManager
 Has a fixed pool of precreated and reserved particles. More...
 
Global ParticleManager settings

Settings applied to the global ParticleManager

Enumeration Type Documentation

◆ ParticleManagerSettingsFlags

Flags for ParticleManagerSettings.

Enumerator
NONE 
FIXED_INDEX 

Particles will be locked to the index and not reused.

BLOCKING 

Allocation blocks the game until it is done.

DISABLE_VIRTUAL 

Disable the creation of virtual particles when the pool is still allocating.

REUSE_OWNED 

Reuse stopped particles even if they are owned by something.

Definition at line 2 of file particlemanager.c.

Function Documentation

◆ Create() [1/2]

ParticleSource Create ( int  particle_id,
Object  parent_obj,
vector  local_pos = "0 0 0",
vector  local_ori = "0 0 0" 
)

Legacy function for backwards compatibility.

Definition at line 174 of file particlemanager.c.

◆ Create() [2/2]

ParticleSource Create ( int  particle_id,
vector  global_pos,
vector  global_ori = "0 0 0" 
)

Legacy function for backwards compatibility with 1.01 and below.

Definition at line 195 of file particlemanager.c.

◆ CreateInWorld()

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.

Parameters
particle_idint Particle ID registered in ParticleList
global_posVector Position where the particel will be created
global_orivector Orientation (Pitch, Yawn, Roll in degrees) (Optional)
force_world_rotationbool Has absolutely no effect here as there is no parent
Returns
ParticleSource Created particle instance

Definition at line 187 of file particlemanager.c.

◆ CreateOnObject()

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.

Parameters
particle_idint Particle ID registered in ParticleList
parent_objObject Instance on which this particle will be attached
local_posvector Attachment position local to the parent (Optional)
local_orivector Orientation local to the parent (Pitch, Yaw, Roll in degrees) (Optional)
force_world_rotationbool Forces particle's orientation to rotate relative to the world and not with the object (Optional)
Returns
ParticleSource Created particle instance

Definition at line 161 of file particlemanager.c.

◆ CreateParticle()

ParticleSource CreateParticle ( int  id,
vector  pos,
bool  playOnCreation = false,
Object  parent = null,
vector  ori = vector.Zero,
bool  forceWorldRotation = false,
Class  owner = null 
)

Create function.

Parameters
idint Particle ID registered in ParticleList
posvector Position of ParticleSource in LS (WS when no parent)
playOnCreationbool Whether to play immediately after creation (Optional)
parentObject Parent Object which will child the ParticleSource (Optional)
orivector Orientation of ParticleSource in LS (WS when no parent) (Pitch, Yaw, Roll in degrees) (Optional)
forceWorldRotationbool Forces orientation to rotate relative to the world and not with the parent (Optional)
ownerClass The owning instance for this particle (Optional)
Returns
ParticleSource Created particle instance when successful

Definition at line 111 of file particlemanager.c.

◆ CreateParticleById()

ParticleSource CreateParticleById ( int  id,
ParticleProperties  properties 
)

QoL function for when only one particle is needed using script ParticleList, strongly recommend to read comments for CreateParticles as well.

Parameters
idint ID of particle registered in ParticleList
propertiesParticleProperties Properties of the particles created
Returns
ParticleSource The resulting particle

Definition at line 324 of file particlemanager.c.

◆ CreateParticleByPath()

ParticleSource CreateParticleByPath ( string  path,
notnull ParticleProperties  properties 
)

Create a particle.

Parameters
pathstring Path of particle effect
propertiesParticleProperties Properties of the particles created
Returns
ParticleSource The resulting particle

Definition at line 281 of file particlemanager.c.

◆ CreateParticleEx()

ParticleSource CreateParticleEx ( int  id,
vector  pos,
int  flags = ParticlePropertiesFlags.NONE,
Object  parent = null,
vector  ori = vector.Zero,
Class  owner = null 
)

Master create function.

Parameters
idint Particle ID registered in ParticleList
posvector Position of ParticleSource in LS (WS when no parent)
flagsint See ParticlePropertiesFlags (Optional)
parentObject Parent Object which will child the ParticleSource (Optional)
orivector Orientation of ParticleSource in LS (WS when no parent) (Pitch, Yaw, Roll in degrees) (Optional)
ownerClass The owning instance for this particle (Optional)
Returns
ParticleSource Created particle instance when successful

Definition at line 138 of file particlemanager.c.

◆ CreateParticles()

proto native int CreateParticles ( array< ParticleSource particles,
string  path,
notnull ParticlePropertiesArray  properties,
int  count = 1 
)

Creates an amount of particles with the properties given.

Parameters
particlesarray<ParticleSource> The resulting particles if an array is given
pathstring Path of particle effect
propertiesParticleProperties Properties of the particles created
countint Amount of particles to create with these properties
Returns
int Amount of particles created in this frame, if the ParticleManager is still allocating while this is called and virtual particles are enabled, the overflow particles will be virtual instead and not given in the out array

◆ CreateParticlesById()

int CreateParticlesById ( int  id,
notnull ParticlePropertiesArray  properties,
int  count 
)

QoL function using script ParticleList, strongly recommend to read comments for CreateParticles as well.

Parameters
idint ID of particle registered in ParticleList
propertiesParticleProperties Properties of the particles created
countint Amount of particles to create with these properties
Returns
int Amount of particles created in this frame, if the ParticleManager is still allocating while this is called and virtual particles are enabled, the overflow particles will be virtual instead

Definition at line 299 of file particlemanager.c.

◆ CreateParticlesByIdArr()

array<ParticleSource> CreateParticlesByIdArr ( int  id,
notnull ParticlePropertiesArray  properties,
int  count 
)

QoL function using script ParticleList, strongly recommend to read comments for CreateParticles as well.

Parameters
idint ID of particle registered in ParticleList
propertiesParticleProperties Properties of the particles created
countint Amount of particles to create with these properties
Returns
array<ParticleSource> The resulting particles - Read particles param of CreateParticles

Definition at line 311 of file particlemanager.c.

◆ GetAllocatedCount()

proto native int GetAllocatedCount ( )

Gets the amount of particles currently allocated.

Returns
int Amount of particles currently allocated

◆ GetCountID()

proto int GetCountID ( )

Gets the ID for the ParticleManager.

Returns
int ID for the ParticleManager (different every restart, as it is the nth instance created since the start of the program)

◆ GetDebugName()

override string GetDebugName ( )

Gets the debug name for the ParticleManager.

Returns
string "name:id"

Definition at line 436 of file particlemanager.c.

◆ GetDebugNameNative()

proto string GetDebugNameNative ( )

Gets the debug name for the ParticleManager.

Parameters
dbgNamestring "name:id"

◆ GetEvents()

ParticleManagerEvents GetEvents ( )

Get the events.

Returns
ParticleManagerEvents If there is any events set, this will return them so that additional functionality can be bound to them

Definition at line 523 of file particlemanager.c.

◆ GetParticle()

proto native ParticleSource GetParticle ( int  index)

Manually get the particle at index.

Parameters
indexint Index of particle
Returns
ParticleSource ParticleSource at given index

◆ GetParticles()

proto native int GetParticles ( out array< ParticleSource outArray,
int  startIndex,
int  count 
)

Manually get a portion of the particles in the pool.

Parameters
particlesarray<ParticleSource> The resulting particles
startIndexint Starting index
countint Amount of particles to get
Returns
int Amount of particles in outArray

◆ GetParticlesEx()

array<ParticleSource> GetParticlesEx ( int  startIndex,
int  count 
)

Manually get a portion of the particles in the pool.

Parameters
startIndexint Starting index
countint Amount of particles to get
Returns
array<ParticleSource> The resulting particles

Definition at line 398 of file particlemanager.c.

◆ GetPlayingCount()

proto native int GetPlayingCount ( )

Gets the amount of playing particles.

Returns
int Amount of currently playing particles

◆ GetPoolSize()

proto native int GetPoolSize ( )

Gets the fixed maximum size of the pool.

Returns
int The fixed maximum size of the pool

◆ GetScriptEvents()

private proto Managed GetScriptEvents ( )

Get the events.

Returns
Managed If there is any events set, this will return them

◆ GetVirtualCount()

proto native int GetVirtualCount ( )

Gets the amount of virtual particles.

Returns
int Amount of virtual particles currently waiting to be turned into real particles

◆ IsFinishedAllocating()

proto native bool IsFinishedAllocating ( )

Checks if the ParticleManager has allocated all slots in the pool.

Returns
bool True when the number of allocated particles is the same as the pool size

◆ OnAllocation()

void OnAllocation ( array< ParticleSource allocatedParticles)

Definition at line 537 of file particlemanager.c.

◆ OnAllocationEnd()

void OnAllocationEnd ( )

Definition at line 542 of file particlemanager.c.

◆ ParticleManager()

void ParticleManager ( ParticleManagerSettings  settings)

Constructor (ctor)

Parameters
settingsParticleManagerSettings Settings for the ParticleManager

Definition at line 84 of file particlemanager.c.

◆ ParticleManagerSettings()

class ParticleManagerConstants ParticleManagerSettings ( int  poolSize,
int  flags = ParticleManagerSettingsFlags.NONE 
)

Settings given to ParticleManager on creation (in ctor)

Constructor (ctor)

Parameters
poolSizeint Size of pool (amount of created and reserved particles)
flagsint ParticleManagerSettingsFlags

Definition at line 35 of file particlemanager.c.

◆ Play() [1/2]

ParticleSource Play ( int  particle_id,
Object  parent_obj,
vector  local_pos = "0 0 0",
vector  local_ori = "0 0 0" 
)

Legacy function for backwards compatibility with 1.01 and below.

Definition at line 226 of file particlemanager.c.

◆ Play() [2/2]

ParticleSource Play ( int  particle_id,
vector  global_pos 
)

Legacy function for backwards compatibility with 1.01 and below.

Definition at line 251 of file particlemanager.c.

◆ PlayInWorld()

ParticleSource PlayInWorld ( int  particle_id,
vector  global_pos 
)

Creates a particle emitter on the given position and activates it.

Parameters
particle_idint Particle ID registered in ParticleList
global_posVector Position where the particel will be created
Returns
ParticleSource Created particle instance

Definition at line 237 of file particlemanager.c.

◆ PlayInWorldEx()

ParticleSource PlayInWorldEx ( int  particle_id,
Object  parent_obj,
vector  global_pos,
vector  global_ori = "0 0 0",
bool  force_world_rotation = false 
)

Definition at line 242 of file particlemanager.c.

◆ PlayOnObject()

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.

Parameters
particle_idint Particle ID registered in ParticleList
parent_objObject Instance on which this particle will be attached
local_posvector Attachment position local to the parent (Optional)
local_orivector Orientation local to the parent (Pitch, Yaw, Roll in degrees) (Optional)
force_world_rotationbool Forces particle's orientation to rotate relative to the world and not with the object (Optional)
Returns
ParticleSource Created particle instance

Definition at line 218 of file particlemanager.c.

◆ PlayParticleById()

ParticleSource PlayParticleById ( int  id,
array< vector position 
)

QoL function for when only one particle is needed using script ParticleList, strongly recommend to read comments for PlayParticles as well.

Parameters
idint ID of particle registered in ParticleList
positionsarray<vector> Positions of particles
Returns
ParticleSource The resulting particle

Definition at line 365 of file particlemanager.c.

◆ PlayParticles()

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.

Parameters
particlesarray<ParticleSource> The resulting particles if an array is given
pathstring Path of particle effect
positionsarray<vector> Positions of particles
countint Amount of particles to create at this position
Returns
int Amount of particles created in this frame, if the ParticleManager is still allocating while this is called and virtual particles are enabled, the overflow particles will be virtual instead and not given in the out array

◆ PlayParticlesById()

array<ParticleSource> PlayParticlesById ( int  id,
array< vector positions,
int  count 
)

QoL function using script ParticleList, strongly recommend to read comments for PlayParticles as well.

Parameters
idint ID of particle registered in ParticleList
positionsarray<vector> Positions of particles
countint Amount of particles to create at this position
Returns
array<ParticleSource> The resulting particles - Read particles param of PlayParticles

Definition at line 352 of file particlemanager.c.

◆ SetName()

proto native void SetName ( string  name)

Set a name for the ParticleManager to identify it more easily.

Parameters
namestring Name for ParticleManager

◆ SetScriptEvents()

private proto void SetScriptEvents ( Managed  events)

Set the events.

Parameters
eventsManaged The events to set

◆ ~ParticleManager()

void ~ParticleManager ( )

dtor

Definition at line 89 of file particlemanager.c.

◆ ~ParticleManagerSettings()

dtor

Definition at line 40 of file particlemanager.c.

Variable Documentation

◆ g_ParticleManager

class ParticleManagerEvents g_ParticleManager

Has a fixed pool of precreated and reserved particles.

Static ParticleManager