Module spfx
Lua bindings to interact with spfx.
Functions
__gc (spfx) | Frees a spfx. |
__eq (s1, s2) | Compares two spfxs to see if they are the same. |
getAll () | Gets all the active spfx. |
new (ttl[, update[, render_bg[, render_mg[, render_fg[, pos[, vel[, sfx[, radius[, remove]]]]]]]]]) | Creates a new special effect. |
rm (s) | Removes a special effect. |
pos (s) | Gets the position of a spfx. |
vel (s) | Gets the velocity of a spfx. |
setPos (s, p) | Sets the position of a spfx. |
setVel (s, v) | Sets the velocity of a spfx. |
vel (s) | Gets the sound effect of a spfx. |
data (s) | Gets the data table of a spfx. |
debris (mass, radius, pos, vel) | Creates a cloud of debris. |
Fields
Delta | Updates the spfx. |
Functions
- __gc (spfx)
-
Frees a spfx.
Parameters:
- spfx Spfx Spfx to free.
- __eq (s1, s2)
-
Compares two spfxs to see if they are the same.
Parameters:
- s1 Spfx Spfx 1 to compare.
- s2 Spfx Spfx 2 to compare.
Returns:
-
boolean
true if both spfxs are the same.
- getAll ()
-
Gets all the active spfx.
Returns:
-
table
A table containing all the spfx.
- new (ttl[, update[, render_bg[, render_mg[, render_fg[, pos[, vel[, sfx[, radius[, remove]]]]]]]]])
-
Creates a new special effect.
Parameters:
- ttl Number Time to live of the effect.
- update Function or nil Update function to use if applicable. (optional)
- render_bg Function or nil Background render function to use if applicable (behind ships). (optional)
- render_mg Function or nil Middle render function to use if applicable (infront of NPC ships, behind player). (optional)
- render_fg Function or nil Foregroundrender function to use if applicable (infront of player). (optional)
- pos vec2 or boolean Position of the effect, or a boolean to indicate whether or not the effect is local. (optional)
- vel vec2 Velocity of the effect. (optional)
- sfx audio Sound effect associated with the spfx. (optional)
- radius number Radius to use to determine if should render. (optional)
- remove Function or nil Function to run when removing the outfit. (optional)
Returns:
-
spfx
New spfx corresponding to the data.
Usage:
spfx.new( 5, update, nil, nil, render, player.pos(), player.pilot():vel(), sfx ) -- Play effect with update and render functions at player position/velocity
spfx.new( 10, nil, nil, nil, nil, true, nil, sfx ) -- Play an effect locally (affected by time compression and autonav stuff)
spfx.new( 10, nil, nil, nil, nil, nil, nil, sfx ) -- Play a global effect (not affected by time stuff )
- rm (s)
-
Removes a special effect.
Parameters:
- s spfx Spfx to remove.
- pos (s)
-
Gets the position of a spfx. ( s )
Parameters:
- s spfx Spfx to get position of.
Returns:
-
vec2
Position of the spfx.
- vel (s)
-
Gets the velocity of a spfx.
Parameters:
- s spfx Spfx to get velocity of.
Returns:
-
vec2
Velocity of the spfx.
- setPos (s, p)
-
Sets the position of a spfx.
Parameters:
- s spfx Spfx to set the position of.
- p vec2 Position to set to.
- setVel (s, v)
-
Sets the velocity of a spfx.
Parameters:
- s spfx Spfx to set the velocity of.
- v vec2 Velocity to set to.
- vel (s)
-
Gets the sound effect of a spfx.
Parameters:
- s spfx Spfx to get sound effect of.
Returns:
-
audio
Sound effect of the spfx.
- data (s)
-
Gets the data table of a spfx.
This table is unique to each instance.
Parameters:
- s spfx Spfx to get data table of.
Returns:
-
table
Data table of the spfx.
- debris (mass, radius, pos, vel)
-
Creates a cloud of debris.
Parameters:
- mass number Mass of the cloud.
- radius number Radius of the cloud.
- pos Vec2 Position of the cloud.
- vel Vec2 Velocity of the cloud.