Effect
Associated namespace: sm.effect
A userdata object representing an effect.
Values:-
id
[ int ]Get
: The id of the effect.
Operation | Description |
---|---|
Effect == Effect | Checks if two instances of Effect refer to the same Effect . |
Functions
bindEventCallback
effect:bindEventCallback( methodName, params, reference )
Client-Only
Bind a Lua callback to be triggered by the effect.
The callback receives:
self
[ table ]: The class instance.eventName
[ string ]: The name of the event.params
[ any ]: Parameter object passed to the callback.
effect
[ Effect ]: The effect.methodName
[ string ]: The name of the callback function.params
[ any ]: Parameter object passed to the callback (Optional).reference
[ table ]: Table to receive the callback (Optional).
clearEventCallbacks
effect:clearEventCallbacks()
Client-Only
Clears all Lua effect callbacks.
Arguments:effect
[ Effect ]: The effect.
destroy
effect:destroy()
Stops and destroys the effect.
Arguments:effect
[ Effect ]: The effect.
getCameraFov
effect:getCameraFov()
Client-Only
Get the desired camera FOV.
Will return nil if the effect is not playing.
Arguments:effect
[ Effect ]: The effect.
- [ number ]: The FOV.
getCameraPosition
effect:getCameraPosition()
Client-Only
Get the desired camera position.
Will return nil if the effect is not playing.
Arguments:effect
[ Effect ]: The effect.
- [ Vec3 ]: The position.
getCameraRotation
effect:getCameraRotation()
Client-Only
Get the desired camera rotation.
Will return nil if the effect is not playing.
Arguments:effect
[ Effect ]: The effect.
- [ Quat ]: The rotation.
getId
effect:getId()
Returns the id of the effect.
Arguments:effect
[ Effect ]: The effect.
- [ int ]: The id.
hasActiveCamera
effect:hasActiveCamera()
Client-Only
Returns whether the effect has an active camera effect.
Arguments:effect
[ Effect ]: The effect.
- [ bool ]: Whether the effect has an active camera effect or not.
isDone
effect:isDone()
Client-Only
Returns whether the effect is done, meaning that all effect instances have finished.
Arguments:effect
[ Effect ]: The effect.
- [ bool ]: Whether the effect is done or not.
isPlaying
effect:isPlaying()
Client-Only
Returns whether the effect is currently playing.
Arguments:effect
[ Effect ]: The effect.
- [ bool ]: Whether the effect is playing or not.
setAutoPlay
effect:setAutoPlay( enabled )
Client-Only
Sets the effect to start playing and repeating automatically.
Arguments:effect
[ Effect ]: The effect.enabled
[ bool ]: Whether the effect repeats automatically or not.
setOffsetPosition
effect:setOffsetPosition( position )
Client-Only
Offsets the position of the effect relative to the host interactable.
This does not work if the effect was created without a host interactable.
setOffsetRotation
effect:setOffsetRotation( rotation )
Client-Only
Offsets the rotation of the effect relative to the host interactable.
This does not work if the effect was created without a host interactable.
setParameter
effect:setParameter( name, value )
Client-Only
Sets a named parameter value on the effect.
Arguments:effect
[ Effect ]: The effect.name
[ string ]: The parameter name.value
[ any ]: The parameter value.
The list below contains some of the possible parameter names.
Note that some of these may only work for specific effects.
Velocity_max_50
minColor
maxColor
minColor2
maxColor2
valid
progress
char
Material
velocity_tree
craftbot
size
impact
load
rpm
gas
pitch
health
fire_intensity
visualization
amb_day_night
music
setPosition
effect:setPosition( position )
Client-Only
Sets the position of the effect.
This does not work if the effect was created with a host interactable.
setRotation
effect:setRotation( rotation )
Client-Only
Sets the rotation of the effect.
This does not work if the effect was created with a host interactable.
setScale
effect:setScale( scale )
Client-Only
Sets the scale of the effect.
Only applies to effect renderables.
setTimeOfDay
effect:setTimeOfDay( enabled, startTime, endTime, inversed )
Client-Only
Sets the effect to be active during specific period of the day / night cycle.
Arguments:effect
[ Effect ]: The effect.enabled
[ bool ]: Whether this feature is enabled or not.startTime
[ number ]: The normalized start time.endTime
[ number ]: The normalized end time.inversed
[ bool ]: If true, period between start/end becomes inactive time.
setVelocity
effect:setVelocity( velocity )
Client-Only
Sets the velocity of the effect.
The effect will move along at the set velocity until it receives a new position.
This does not work if the effect was created with a host interactable.
setWorld
effect:setWorld( world )
Client-Only
Sets the effect's world.
Arguments:start
effect:start()
Client-Only
Starts playing the effect.
Arguments:effect
[ Effect ]: The effect.
stop
effect:stop()
Client-Only
Stops playing the effect.
Arguments:effect
[ Effect ]: The effect.
stopBreakSustain
effect:stopBreakSustain()
Client-Only
Stops playing the effect, letting sound finish before destroying the effect.
Arguments:effect
[ Effect ]: The effect.
stopImmediate
effect:stopImmediate()
Client-Only
Immediately stops playing the effect. Any playing sound effects will stop immediately.
Arguments:effect
[ Effect ]: The effect.