Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
Particle Class Reference

Legacy way of using particles in the game. More...

Inheritance diagram for Particle:
ParticleSource

Protected Member Functions

Playback

Methods regarding playing/stopping of particle

override void PlayParticle (int particle_id=-1)
 Method to tell the particle to start playing.
 
override bool PlayParticleEx (int particle_id=-1, int flags=0)
 Method to tell the particle to start playing.
 
void Play (int particle_id=-1)
 Legacy function for backwards compatibility with 1.01 and below.
 
override bool StopParticle (int flags=0)
 Method to tell the particle to stop playing.
 
void Stop ()
 Legacy function for backwards compatibility with 1.14 and below.
 
Properties and state

Obtain information or set properties regarding the state of the Particle

void SetSource (int particle_id)
 Sets particle id.
 
int GetParticleID ()
 Gets particle id.
 
Object GetDirectParticleEffect ()
 Returns direct particle effect entity which is usually handled by this class 'Particle' if there is one.
 
Object GetParticleParent ()
 Returns the parent of this Particle if there is one.
 
bool HasActiveParticle ()
 Returns if there is any particle active.
 
int GetParticleCount ()
 Returns the total count of active particles in all emitors.
 
bool IsRepeat ()
 Returns whether there is a repeating particle.
 
float GetMaxLifetime ()
 Returns the approx. max lifetime.
 

Static Protected Member Functions

Create a particle (static)

You can create a particle either at some position, or create it as a child on some object.

static Particle 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.
 
static Particle Create (int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0")
 Legacy function for backwards compatibility.
 
static Particle 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.
 
static Particle Create (int particle_id, vector global_pos, vector global_ori="0 0 0")
 Legacy function for backwards compatibility with 1.01 and below.
 
Static play on creation

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

static Particle 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.
 
static Particle 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.
 
static Particle PlayInWorld (int particle_id, vector global_pos)
 Creates a particle emitter on the given position and activates it.
 
static Particle Play (int particle_id, vector global_pos)
 Legacy function for backwards compatibility with 1.01 and below.
 

Generic data

Generic data for the Particle

int m_ParticleID
 ID from ParticleList if assigned.
 
float m_Lifetime
 Approx. remaining lifetime of particle.
 
bool m_IsRepeat
 Whether this particle repeats.
 

Wiggle API

Settings to make the Particle wiggle

Object m_ParentObject
 Parent Object the Particle is child of.
 
Object m_ParticleEffect
 The child object which contains the actual particle.
 
int m_PreviousFrame
 DEPRECATED.
 
void ParticleInit ()
 Purely here so that it can be emptied in ParticleSource.
 
vector RandWiggleVector ()
 Helper to get a randomized wiggle vector.
 
float RandWiggleFloat ()
 Helper to get a randomized wiggle float value.
 

Misc Particle specific helpers

Functionality specific for Particle

void UpdateState ()
 Creates/Destroys ParticleEffect child according to current state.
 

Detailed Description

Legacy way of using particles in the game.

Note
They work okay when just needing to play a particle once every once in a while But are extremely wasteful when it comes to playing multiple Particles at the same time

Definition at line 6 of file particle.c.

Member Function Documentation

◆ Create() [1/2]

static Particle Particle::Create ( int particle_id,
Object parent_obj,
vector local_pos = "0 0 0",
vector local_ori = "0 0 0" )
staticprotected

Legacy function for backwards compatibility.

Definition at line 104 of file particle.c.

◆ Create() [2/2]

static Particle Particle::Create ( int particle_id,
vector global_pos,
vector global_ori = "0 0 0" )
staticprotected

Legacy function for backwards compatibility with 1.01 and below.

Definition at line 129 of file particle.c.

◆ CreateInWorld()

static Particle Particle::CreateInWorld ( int particle_id,
vector global_pos,
vector global_ori = "0 0 0",
bool force_world_rotation = false )
staticprotected

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 Forces particle's orientation to rotate relative to the world and not with the object (Optional)
Returns
Particle Created particle instance

Definition at line 117 of file particle.c.

◆ CreateOnObject()

static Particle Particle::CreateOnObject ( int particle_id,
Object parent_obj,
vector local_pos = "0 0 0",
vector local_ori = "0 0 0",
bool force_world_rotation = false )
staticprotected

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, Yawn, Roll in degrees) (Optional)
force_world_rotationbool Forces particle's orientation to rotate relative to the world and not with the object (Optional)
Returns
Particle Created particle instance

Definition at line 88 of file particle.c.

◆ GetDirectParticleEffect()

Object Particle::GetDirectParticleEffect ( )
protected

Returns direct particle effect entity which is usually handled by this class 'Particle' if there is one.

Note
Is a child of this Particle
Returns
Object The Object with the particle component or null

Definition at line 307 of file particle.c.

◆ GetMaxLifetime()

float Particle::GetMaxLifetime ( )
protected

Returns the approx. max lifetime.

Returns
float The largest lifetime sum among the emitors

Definition at line 380 of file particle.c.

◆ GetParticleCount()

int Particle::GetParticleCount ( )
protected

Returns the total count of active particles in all emitors.

Note
Internally does a sum, HasActiveParticle is better for a quick check
Returns
int Total count of active particles

Definition at line 340 of file particle.c.

◆ GetParticleID()

int Particle::GetParticleID ( )
protected

Gets particle id.

Note
This is not necessarily the CURRENT particle As one can use SetSource while the Particle is still playing But that will not change the particle before Particle is played again
Returns
int The last set Particle ID registered in ParticleList

Definition at line 297 of file particle.c.

◆ GetParticleParent()

Object Particle::GetParticleParent ( )
protected

Returns the parent of this Particle if there is one.

Returns
Object The registered parent or null

Definition at line 316 of file particle.c.

◆ HasActiveParticle()

bool Particle::HasActiveParticle ( )
protected

Returns if there is any particle active.

Returns
bool Whether there is any particle active

Definition at line 325 of file particle.c.

◆ IsRepeat()

bool Particle::IsRepeat ( )
protected

Returns whether there is a repeating particle.

Returns
bool whether there is a repeating particle

Definition at line 354 of file particle.c.

◆ ParticleInit()

void Particle::ParticleInit ( )
protected

Purely here so that it can be emptied in ParticleSource.

Definition at line 67 of file particle.c.

◆ Play() [1/3]

static Particle Particle::Play ( int particle_id,
Object parent_obj,
vector local_pos = "0 0 0",
vector local_ori = "0 0 0" )
staticprotected

Legacy function for backwards compatibility with 1.01 and below.

Definition at line 163 of file particle.c.

◆ Play() [2/3]

static Particle Particle::Play ( int particle_id,
vector global_pos )
staticprotected

Legacy function for backwards compatibility with 1.01 and below.

Definition at line 185 of file particle.c.

◆ Play() [3/3]

void Particle::Play ( int particle_id = -1)
protected

Legacy function for backwards compatibility with 1.01 and below.

Parameters
particle_idint Particle ID registered in ParticleList to start playing

Definition at line 233 of file particle.c.

◆ PlayInWorld()

static Particle Particle::PlayInWorld ( int particle_id,
vector global_pos )
staticprotected

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
Particle Created particle instance

Definition at line 174 of file particle.c.

◆ PlayOnObject()

static Particle Particle::PlayOnObject ( int particle_id,
Object parent_obj,
vector local_pos = "0 0 0",
vector local_ori = "0 0 0",
bool force_world_rotation = false )
staticprotected

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
Particle Created particle instance

Definition at line 152 of file particle.c.

◆ PlayParticle()

override void Particle::PlayParticle ( int particle_id = -1)
protected

Method to tell the particle to start playing.

Parameters
particle_idint Particle ID registered in ParticleList to start playing

Definition at line 203 of file particle.c.

◆ PlayParticleEx()

override bool Particle::PlayParticleEx ( int particle_id = -1,
int flags = 0 )
protected

Method to tell the particle to start playing.

Note
The parameter to set the ID will only work when the particle is not already playing
Parameters
particle_idint Particle ID registered in ParticleList to start playing
flagsint Flags to pass to the playing (None on this level)
Returns
bool Whether the particle successfully started

Definition at line 215 of file particle.c.

◆ RandWiggleFloat()

float Particle::RandWiggleFloat ( )
protected

Helper to get a randomized wiggle float value.

Definition at line 841 of file particle.c.

◆ RandWiggleVector()

vector Particle::RandWiggleVector ( )
protected

Helper to get a randomized wiggle vector.

Definition at line 833 of file particle.c.

◆ SetSource()

void Particle::SetSource ( int particle_id)
protected

Sets particle id.

Note
Does not work at runtime, particle object needs to be destroyed and then Particle needs to play again
Parameters
particle_idint Particle ID registered in ParticleList to start playing

Definition at line 285 of file particle.c.

◆ Stop()

void Particle::Stop ( )
protected

Legacy function for backwards compatibility with 1.14 and below.

Definition at line 266 of file particle.c.

◆ StopParticle()

override bool Particle::StopParticle ( int flags = 0)
protected

Method to tell the particle to stop playing.

Note
No flags available for Particle
Emitors are automatically removed later when its particle count is 0
Parameters
flagsint Flags to pass to the stopping (None on this level)
Returns
bool Whether the particle successfully stopped

Definition at line 245 of file particle.c.

◆ UpdateState()

void Particle::UpdateState ( )
protected

Creates/Destroys ParticleEffect child according to current state.

Note
Is called from Play/Stop methods

Definition at line 425 of file particle.c.

Member Data Documentation

◆ m_IsRepeat

bool Particle::m_IsRepeat
protected

Whether this particle repeats.

Definition at line 17 of file particle.c.

◆ m_Lifetime

float Particle::m_Lifetime
protected

Approx. remaining lifetime of particle.

Definition at line 15 of file particle.c.

◆ m_ParentObject

Object Particle::m_ParentObject
protected

Parent Object the Particle is child of.

Definition at line 48 of file particle.c.

◆ m_ParticleEffect

Object Particle::m_ParticleEffect
protected

The child object which contains the actual particle.

Definition at line 50 of file particle.c.

◆ m_ParticleID

int Particle::m_ParticleID
protected

ID from ParticleList if assigned.

Definition at line 13 of file particle.c.

◆ m_PreviousFrame

int Particle::m_PreviousFrame
protected

DEPRECATED.

Definition at line 53 of file particle.c.


The documentation for this class was generated from the following file: