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

Entity which has the particle instance as an ObjectComponent. More...

Inheritance diagram for ParticleSource:
Particle

Protected Member Functions

void ParticleInit ()
 Empty - Only needed for Particle.
 
proto native void SetParticleAutoDestroyFlags (ParticleAutoDestroyFlags flags)
 Enables the particle to automatically clean up itself when ending or stopping.
 
void DisableAutoDestroy ()
 Disables the particle automatically cleaning up itself when ending or stopping.
 
proto native int GetParticleAutoDestroyFlags ()
 Gets the currently set ParticleAutoDestroyFlags flags set on this ParticleSource.
 
Events

ParticleBase events For ParticleSource, these are handed on C++ side For more information, read ParticleEvents

void OnParticleParented (IEntity parent)
 Event when the particle receives a parent.
 
void OnParticleUnParented (IEntity parent)
 Event when the particle is orphaned.
 
void OnParticleStop ()
 Event when the particle stops.
 
Misc backwards compatibility helpers

Helpers for misc backwards compatibility functionality

override void AddAsChild (Object parent, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_rotation_to_world=false)
 Attaches this particle onto some object. If null value is provided then the particle will be detached from the current parent.
 
Parameter API

Helpful methods for getting or setting parameters

override void SetParticleParam (int parameter_id, float value)
 Set the value of a parameter of all emitors in the particle.
 
override void SetParameter (int emitter, int parameter, float value)
 Set the value of a parameter of an emitor in the particle.
 
override void GetParameter (int emitter, int parameter, out float value)
 Get the value of a parameter of an emitor in the particle.
 
override float GetParameterEx (int emitter, int parameter)
 Get the value of a parameter of an emitor in the particle.
 
override void ScaleParticleParamFromOriginal (int parameter_id, float coef)
 Scales the given parameter on all emitors relatively to their ORIGINAL value.
 
override void ScaleParticleParam (int parameter_id, float coef)
 Scales the given parameter on all emitors relatively to their CURRENT value.
 
override void IncrementParticleParamFromOriginal (int parameter_id, float value)
 Increments the value of the given parameter relatively from the ORIGINAL value.
 
override void IncrementParticleParam (int parameter_id, float value)
 Increments the value of the given parameter relatively from the CURRENT value.
 

Static Protected Member Functions

Create a particle (static)

Helper static methods to create/attach/play a ParticleSource on one line

static ParticleSource CreateParticle (int id, vector pos, bool playOnCreation=false, Object parent=null, vector ori=vector.Zero, bool forceWorldRotation=false, Class owner=null)
 Create function.
 
static ParticleSource CreateParticleEx (int id, vector pos, int flags=ParticlePropertiesFlags.NONE, Object parent=null, vector ori=vector.Zero, Class owner=null)
 Master create function.
 
static override 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 override 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 override 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 override ParticleSource 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 override 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 override 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 override Particle PlayInWorld (int particle_id, vector global_pos)
 Creates a particle emitter on the given position and activates it.
 
static override Particle Play (int particle_id, vector global_pos)
 Legacy function for backwards compatibility with 1.01 and below.
 

Wiggle API

Settings to make the Particle wiggle

override void SetWiggle (float random_angle, float random_interval)
 Makes the particle change direction by random_angle every random_interval seconds.
 
override void StopWiggle ()
 Stops randomized wiggle.
 

Misc Particle specific helpers

Functionality specific for Particle, so we empty them here

void EOnFrame (IEntity other, float timeSlice)
 Empty.
 

Detailed Description

Entity which has the particle instance as an ObjectComponent.

Note
Unfortunately the native methods are private and have a script wrapper This is because of backwards compatibility with the old Particle and to avoid confusion As we should continue to use Particle for consistency, as it is too deeply rooted in script Which means switching is no longer possible due to it being harmful for already existing mods Even though using the ParticleSource directly would be preferred
Some variables from Particle are invalid on this level, those marked DEPRECATED by Particle are still DEPRECATED here m_ParticleID; //!< INVALID - Use GetParticleID() instead m_Lifetime; //!< INVALID - No EOnFrame, so no use for it m_IsPlaying; //!< VALID - Set through events - IsParticlePlaying() is still better m_IsRepeat; //!< INVALID - Use IsRepeat() instead m_MarkedForDeletion; //!< INVALID - No EOnFrame, so no use for it Wiggle API variables are still used for Wiggle API m_ParentObject; //!< VALID - Set through events - Or use GetParticleParent() or GetParent() m_ParticleEffect; //!< VALID - Not in the same usage as Particle, as it will always be 'this', never null

Definition at line 123 of file particlesource.c.

Member Function Documentation

◆ AddAsChild()

override void ParticleSource::AddAsChild ( Object parent,
vector local_pos = "0 0 0",
vector local_ori = "0 0 0",
bool force_rotation_to_world = false )
protected

Attaches this particle onto some object. If null value is provided then the particle will be detached from the current parent.

Note
Unlike Particle, you are free to use AddChild/RemoveChild instead of this one if you know what you are doing
Parameters
parentObject Parent onto 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_rotation_to_worldbool Force rotation to be in WS (Optional)

Definition at line 783 of file particlesource.c.

◆ Create() [1/2]

static override Particle ParticleSource::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 249 of file particlesource.c.

◆ Create() [2/2]

static override ParticleSource ParticleSource::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 270 of file particlesource.c.

◆ CreateInWorld()

static override Particle ParticleSource::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 Has absolutely no effect here as there is no parent
Returns
Particle Created particle instance

Definition at line 262 of file particlesource.c.

◆ CreateOnObject()

static override Particle 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 )
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, 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 236 of file particlesource.c.

◆ CreateParticle()

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

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 178 of file particlesource.c.

◆ CreateParticleEx()

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

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 205 of file particlesource.c.

◆ DisableAutoDestroy()

void ParticleSource::DisableAutoDestroy ( )
protected

Disables the particle automatically cleaning up itself when ending or stopping.

Definition at line 151 of file particlesource.c.

◆ EOnFrame()

void ParticleSource::EOnFrame ( IEntity other,
float timeSlice )
protected

Empty.

Definition at line 1022 of file particlesource.c.

◆ GetParameter()

override void ParticleSource::GetParameter ( int emitter,
int parameter,
out float value )
protected

Get the value of a parameter of an emitor in the particle.

Parameters
emitterint The emitor to get the value from
parameterint The parameter to get the value from (enum EmitorParam)
valuefloat The value

Definition at line 830 of file particlesource.c.

◆ GetParameterEx()

override float ParticleSource::GetParameterEx ( int emitter,
int parameter )
protected

Get the value of a parameter of an emitor in the particle.

Parameters
emitterint The emitor to get the value from
parameterint The parameter to get the value from (enum EmitorParam)
Returns
float The value

Definition at line 841 of file particlesource.c.

◆ GetParticleAutoDestroyFlags()

proto native int ParticleSource::GetParticleAutoDestroyFlags ( )
protected

Gets the currently set ParticleAutoDestroyFlags flags set on this ParticleSource.

Returns
int Currently set ParticleAutoDestroyFlags flags set on this ParticleSource

◆ IncrementParticleParam()

override void ParticleSource::IncrementParticleParam ( int parameter_id,
float value )
protected

Increments the value of the given parameter relatively from the CURRENT value.

Note
It's a simple sum, so negative value decrements
Parameters
parameter_idint The parameter to adjust (enum EmitorParam)
valuefloat The value to sum

Definition at line 903 of file particlesource.c.

◆ IncrementParticleParamFromOriginal()

override void ParticleSource::IncrementParticleParamFromOriginal ( int parameter_id,
float value )
protected

Increments the value of the given parameter relatively from the ORIGINAL value.

Note
It's a simple sum, so negative value decrements
Parameters
parameter_idint The parameter to adjust (enum EmitorParam)
valuefloat The value to sum

Definition at line 886 of file particlesource.c.

◆ OnParticleParented()

void ParticleSource::OnParticleParented ( IEntity parent)
protected

Event when the particle receives a parent.

Definition at line 722 of file particlesource.c.

◆ OnParticleStop()

void ParticleSource::OnParticleStop ( )
protected

Event when the particle stops.

Definition at line 755 of file particlesource.c.

◆ OnParticleUnParented()

void ParticleSource::OnParticleUnParented ( IEntity parent)
protected

Event when the particle is orphaned.

Definition at line 732 of file particlesource.c.

◆ ParticleInit()

void ParticleSource::ParticleInit ( )
protected

Empty - Only needed for Particle.

Definition at line 137 of file particlesource.c.

◆ Play() [1/2]

static override Particle ParticleSource::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 301 of file particlesource.c.

◆ Play() [2/2]

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

Legacy function for backwards compatibility with 1.01 and below.

Definition at line 320 of file particlesource.c.

◆ PlayInWorld()

static override Particle ParticleSource::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 312 of file particlesource.c.

◆ PlayOnObject()

static override Particle 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 )
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 293 of file particlesource.c.

◆ ScaleParticleParam()

override void ParticleSource::ScaleParticleParam ( int parameter_id,
float coef )
protected

Scales the given parameter on all emitors relatively to their CURRENT value.

Parameters
parameter_idint The parameter to adjust (enum EmitorParam)
coeffloat The multiplier to apply

Definition at line 869 of file particlesource.c.

◆ ScaleParticleParamFromOriginal()

override void ParticleSource::ScaleParticleParamFromOriginal ( int parameter_id,
float coef )
protected

Scales the given parameter on all emitors relatively to their ORIGINAL value.

Parameters
parameter_idint The parameter to adjust (enum EmitorParam)
coeffloat The multiplier to apply

Definition at line 853 of file particlesource.c.

◆ SetParameter()

override void ParticleSource::SetParameter ( int emitter,
int parameter,
float value )
protected

Set the value of a parameter of an emitor in the particle.

Parameters
emitterint The emitter to apply the new value to, -1 for all emitter
parameterint The parameter to apply the new value to (enum EmitorParam)
valuefloat The value to apply

Definition at line 819 of file particlesource.c.

◆ SetParticleAutoDestroyFlags()

proto native void ParticleSource::SetParticleAutoDestroyFlags ( ParticleAutoDestroyFlags flags)
protected

Enables the particle to automatically clean up itself when ending or stopping.

Note
Is enabled by default (ALL)
Looping particles never end
ParticleSource belonging to a ParticleManager will ignore these
Parameters
flagsParticleAutoDestroyFlags Flags enabling when the particle should be auto destroyed

◆ SetParticleParam()

override void ParticleSource::SetParticleParam ( int parameter_id,
float value )
protected

Set the value of a parameter of all emitors in the particle.

Parameters
parameterint The parameter to apply the new value to (enum EmitorParam)
valuefloat The value to apply

Definition at line 808 of file particlesource.c.

◆ SetWiggle()

override void ParticleSource::SetWiggle ( float random_angle,
float random_interval )
protected

Makes the particle change direction by random_angle every random_interval seconds.

Note
This does not actually work on Particle with no parent, it should on ParticleSource
Parameters
random_anglefloat Will be the range [-random_angle, random_angle[ to wiggle between
random_intervalfloat Will be the time range [0, random_interval] to wiggle next time

Definition at line 929 of file particlesource.c.

◆ StopWiggle()

override void ParticleSource::StopWiggle ( )
protected

Stops randomized wiggle.

Definition at line 960 of file particlesource.c.


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