DIFF

class ParticleSourceSource

ParticleSource Particle ParticleBase Entity ObjectTyped Object IEntity Managed

All members, including inherited

Entity which has the particle instance as an ObjectComponent

NoteUnfortunately 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
NoteSome 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

Constructors 2

void ParticleSource()

ctor

void ~ParticleSource()

dtor

Methods 73

override protected 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

flags
ParticleAutoDestroyFlags Flags enabling when the particle should be auto destroyed
NoteIs enabled by default (ALL)
NoteLooping particles never end
NoteParticleSource belonging to a ParticleManager will ignore these
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

Returns: int Currently set ParticleAutoDestroyFlags flags set on this ParticleSource

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

id
int Particle ID registered in ParticleList
pos
vector Position of ParticleSource in LS (WS when no parent)
playOnCreation
bool Whether to play immediately after creation (Optional)
parent
Object Parent Object which will child the ParticleSource (Optional)
ori
vector Orientation of ParticleSource in LS (WS when no parent) (Pitch, Yaw, Roll in degrees) (Optional)
forceWorldRotation
bool Forces orientation to rotate relative to the world and not with the parent (Optional)
owner
Class The owning instance for this particle (Optional)

Returns: ParticleSource Created particle instance when successful

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

Master create function

id
int Particle ID registered in ParticleList
pos
vector Position of ParticleSource in LS (WS when no parent)
flags
int See ParticlePropertiesFlags (Optional)
parent
Object Parent Object which will child the ParticleSource (Optional)
ori
vector Orientation of ParticleSource in LS (WS when no parent) (Pitch, Yaw, Roll in degrees) (Optional)
owner
Class The owning instance for this particle (Optional)

Returns: ParticleSource Created particle instance when successful

Referenced by CreateParticle()
override 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

particle_id
int Particle ID registered in ParticleList
parent_obj
Object Instance on which this particle will be attached
local_pos
vector Attachment position local to the parent (Optional)
local_ori
vector Orientation local to the parent (Pitch, Yaw, Roll in degrees) (Optional)
force_world_rotation
bool Forces particle's orientation to rotate relative to the world and not with the object (Optional)

Returns: Particle Created particle instance

References CreateParticle()
Referenced by Create()
override 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

References CreateOnObject()
override 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

particle_id
int Particle ID registered in ParticleList
global_pos
Vector Position where the particel will be created
global_ori
vector Orientation (Pitch, Yawn, Roll in degrees) (Optional)
force_world_rotation
bool Has absolutely no effect here as there is no parent

Returns: Particle Created particle instance

References CreateParticle()
Referenced by Create()
override static ParticleSource Create(int particle_id, vector global_pos, vector global_ori = "0 0 0")

Legacy function for backwards compatibility with 1.01 and below

References CreateInWorld()
override 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

particle_id
int Particle ID registered in ParticleList
parent_obj
Object Instance on which this particle will be attached
local_pos
vector Attachment position local to the parent (Optional)
local_ori
vector Orientation local to the parent (Pitch, Yaw, Roll in degrees) (Optional)
force_world_rotation
bool Forces particle's orientation to rotate relative to the world and not with the object (Optional)

Returns: Particle Created particle instance

References CreateParticle()
Referenced by Play()
override 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

References PlayOnObject()
override static Particle PlayInWorld(int particle_id, vector global_pos)

Creates a particle emitter on the given position and activates it

particle_id
int Particle ID registered in ParticleList
global_pos
Vector Position where the particel will be created

Returns: Particle Created particle instance

References CreateParticle()
Referenced by Play()
override static Particle Play(int particle_id, vector global_pos)

Legacy function for backwards compatibility with 1.01 and below

References PlayInWorld()
private proto bool PlayParticleNative(int flags)

Method to tell the particle to start playing

Returns: bool Whether the particle successfully started

NoteWill call OnParticleStart when successful
Referenced by PlayParticleEx()
override bool PlayParticleEx(int particle_id = -1, int flags = 0)

Method to tell the particle to start playing

particle_id
int Particle ID registered in ParticleList to start playing

Returns: bool Whether the particle successfully started

private proto bool StopParticleNative(int flags)

Method to tell the particle to stop playing

flags
int Flags to pass to the stopping (StopParticleFlags)

Returns: bool Whether the particle successfully stopped

NoteThe particle is not immediately stopped by default, instead it will gradually fade If this is however desired, then pass in StopParticleFlags.IMMEDIATE
Referenced by StopParticle()
override bool StopParticle(int flags = 0)

Method to tell the particle to stop playing

flags
int Flags to pass to the stopping (StopParticleFlags)

Returns: bool Whether the particle successfully stopped

private proto native bool ResetParticleNative()

Method to tell the particle to reset

Returns: bool Whether the particle successfully reset

Referenced by ResetParticle()
override bool ResetParticle()

Method to tell the particle to reset

Returns: bool Whether the particle successfully reset

private proto native bool RestartParticleNative()

Method to tell the particle to restart (reset + play)

Returns: bool Whether the particle successfully restarted

Referenced by RestartParticle()
override bool RestartParticle()

Method to tell the particle to restart (reset + play)

Returns: bool Whether the particle successfully restarted

private proto bool IsParticlePlayingNative()

Ask if the particle is still playing

Returns: bool Whether the particle is playing

Referenced by IsParticlePlaying()
private proto native bool SetParticleNative(string path)

Assigns a particle to the ParticleSource

path
string Path of particle effect

Returns: bool Whether the creating and assigning of particle was successful

Referenced by SetParticle()
private bool SetParticle(string path)

Assigns a particle to the ParticleSource

path
string Path of particle effect

Returns: bool Whether the creating and assigning of particle was successful

NoteIntentionally private, as it is best to use 'SetParticleByID' instead from script, because ParticleList
bool SetParticleByID(int id)

Assigns a particle to the ParticleSource

id
int ID of particle registered in ParticleList

Returns: bool Whether the creating and assigning of particle was successful

Referenced by PlayParticleEx(), and SetSource()
override void SetSource(int particle_id)

Sets particle id

particle_id
int Particle ID registered in ParticleList to start playing
NotePurely here for backwards compatibility with Particle
private proto bool GetParticleNative(out string path, EGetParticleMode mode)

Gets the path to the currently assigned particle

path
string Path of particle effect
mode
EGetParticleMode What path to return

Returns: bool Whether the path is filled in or not

Referenced by GetParticle()
bool GetParticle(out string path, EGetParticleMode mode)

Gets the path to the currently assigned particle

path
string Path of particle effect
mode
EGetParticleMode What path to return

Returns: bool Whether the path is filled in or not

override int GetParticleID()

Gets the ParticleList ID of the currently assigned particle

Returns: int ID of particle registered in ParticleList

int GetParticleIDLegacy()

Gets the ParticleList ID of the currently assigned particle

Returns: int ID of particle registered in ParticleList

NoteThis is because the new GetParticleID will only work when every particle file name has a unique name In case this is not the case, then this method is what one will want to use
private proto native bool ApplyPropertiesNative(ParticleProperties properties)

Applies the properties given to the ParticleSource

properties
ParticleProperties The properties to apply

Returns: bool Whether the properties were successfully applied

NoteAlready handles proper reparenting
Referenced by ApplyProperties()
bool ApplyProperties(ParticleProperties properties)

Applies the properties given to the ParticleSource

properties
ParticleProperties The properties to apply

Returns: bool Whether the properties were successfully applied

override Object GetDirectParticleEffect()

Returns direct particle effect entity

Returns: Object The Object with the particle component (this)

NoteBackwards compatibility with Particle, here it is the Object itself
override Object GetParticleParent()

Returns the parent of this Particle if there is one

Returns: Object The parent or null if there is none

private proto bool HasActiveParticleNative()

Returns if there is any particle active

Returns: bool Whether there is any particle active

Referenced by HasActiveParticle()
override bool HasActiveParticle()

Returns if there is any particle active

Returns: bool Whether there is any particle active

private proto int GetParticleCountNative()

Returns the total count of active particles in all emitors

Returns: int Total count of active particles

NoteInternally does a sum, HasActiveParticle is better for a quick check
Referenced by GetParticleCount()
override int GetParticleCount()

Returns the total count of active particles in all emitors

Returns: int Total count of active particles

NoteInternally does a sum, HasActiveParticle is better for a quick check
private proto bool IsRepeatNative()

Returns whether there is a repeating particle

Returns: bool whether there is a repeating particle

Referenced by IsRepeat()
override bool IsRepeat()

Returns whether there is a repeating particle

Returns: bool whether there is a repeating particle

References IsRepeatNative()
private proto float GetMaxLifetimeNative()

Returns the approx. max lifetime

Returns: float The largest lifetime sum among the emitors

Referenced by GetMaxLifetime()
override float GetMaxLifetime()

Returns the approx. max lifetime

Returns: float The largest lifetime sum among the emitors

proto native Class GetOwner()

Get the owner of this ParticleSource

Returns: Class The owner or null

proto native void SetOwner(Class owner)

Set the owner of this ParticleSource

Class The owner or null
proto native void Orphan()

null the owner of this ParticleSource

proto native ParticleManager GetParticleManager()

Get the ParticleManager the ParticleSource belongs to if any

Returns: ParticleManager The ParticleManager which created the ParticleSource or null

proto native int GetIndex()

Get the index of this ParticleSource in the owning ParticleManager

Returns: int The index in the pool in the owning ParticleManager, -1 if no owner

proto int GetCountID()

Gets the ID for the ParticleSource

Returns: int ID for the ParticleSource

NoteDifferent every restart, as it is the nth instance created since the start of the program
proto native static int GetStaticCount()

Gets the amount of ParticleSource that have been created since the start of the program

Returns: int Amount of ParticleSource that have been created since the start of the program

proto native static int GetStaticActiveCount()

Gets the amount of ParticleSource that are currently existing

Returns: int Amount of ParticleSource that are currently existing

override protected void OnParticleParented(IEntity parent)

Event when the particle receives a parent

override protected void OnParticleStop()

Event when the particle stops

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.

parent
Object Parent onto which this particle will be attached
local_pos
vector Attachment position local to the parent (optional)
local_ori
vector Orientation local to the parent (Pitch, Yawn, Roll in degrees) (Optional)
force_rotation_to_world
bool Force rotation to be in WS (Optional)
NoteUnlike Particle, you are free to use AddChild/RemoveChild instead of this one if you know what you are doing
override void SetParticleParam(int parameter_id, float value)

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

parameter
int The parameter to apply the new value to (enum EmitorParam)
value
float The value to apply
override void SetParameter(int emitter, int parameter, float value)

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

emitter
int The emitter to apply the new value to, -1 for all emitter
parameter
int The parameter to apply the new value to (enum EmitorParam)
value
float The value to apply
override void GetParameter(int emitter, int parameter, out float value)

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

emitter
int The emitor to get the value from
parameter
int The parameter to get the value from (enum EmitorParam)
value
float The value
override float GetParameterEx(int emitter, int parameter)

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

emitter
int The emitor to get the value from
parameter
int The parameter to get the value from (enum EmitorParam)

Returns: float The value

override void ScaleParticleParamFromOriginal(int parameter_id, float coef)

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

parameter_id
int The parameter to adjust (enum EmitorParam)
coef
float The multiplier to apply
override void ScaleParticleParam(int parameter_id, float coef)

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

parameter_id
int The parameter to adjust (enum EmitorParam)
coef
float The multiplier to apply
override void IncrementParticleParamFromOriginal(int parameter_id, float value)

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

parameter_id
int The parameter to adjust (enum EmitorParam)
value
float The value to sum
NoteIt's a simple sum, so negative value decrements
override void IncrementParticleParam(int parameter_id, float value)

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

parameter_id
int The parameter to adjust (enum EmitorParam)
value
float The value to sum
NoteIt's a simple sum, so negative value decrements
override void SetWiggle(float random_angle, float random_interval)

Makes the particle change direction by random_angle every random_interval seconds.

random_angle
float Will be the range [-random_angle, random_angle[ to wiggle between
random_interval
float Will be the time range [0, random_interval] to wiggle next time
NoteThis does not actually work on Particle with no parent, it should on ParticleSource
override private void UpdateState()

Empty

References ErrorEx()
override private void DestroyParticleEffect()

Empty

References ErrorEx()
override private void CreateParticleEffect()

Empty

References ErrorEx()
override protected void EOnFrame(IEntity other, float timeSlice)

Empty

References ErrorEx()
override private void OnCheckAutoDelete()

Empty

References ErrorEx()
override private void OnToDelete()

Empty

References ErrorEx()