[][src]Struct sulis_state::script::ScriptParticleGenerator

pub struct ScriptParticleGenerator { /* fields omitted */ }

A flexible animation type, which can be used to create particle effects, simple frame based animations, or anything in between. Typically created by ScriptEntity:create_particle_generator

activate()

Activates and applies this animation.

`param(value: Float, dt: Float (Optional), d2t: Float (Optional),

d3t: Float (Optional))Creates a param which can then be passed to one of the various configuration methods accepting a param in this script generator. An initialvaluemust be specified - all other values are optional and default to zero. dtis the speed coefficient,d2tis the acceleration coefficient, andd3t` is the jerk coefficient.

`dist_param(value: Dist, dt: Dist (Optional), d2t: Dist (Optional),

d3t: Dist (Optional))Creates adist_param, which is a paramwhere each component is a distribution that is randomly selected from. Seeparam`.

zero_dist() -> Dist

Creates a new Dist with a fixed value of zero.

fixed_dist(value: Float) -> Dist

Creates a dist which always returns the specified fixed value

uniform_dist(min: Float, max: Float) -> Dist

Creates a dist which randomly generates a value between min and max in a uniform manner.

`angular_dist(min_angle: Float, max_angle: Float, min_magnitude: Float,

max_magnitude: Float)` Creates a dist which randomly generates a direction and magnitude for a vector. As this is a two component dist, may only be used when configuring the particle position distribution.

set_blocking(blocking: Bool)

Sets whether this animation is blocking. By default, animations with infinite time (or those attached to an effect) are not blocking, but effects that have a fixed duration are. This method allows you to change this as needed.

set_draw_below_entities()

Sets this animation to perform drawing below the entity layer in the main view

set_draw_above_entities()

Sets this animation to perform drawing above the entity layer in the main view.

set_initial_gen(value: Float)

Sets the number of particles that should immediately be generated by this animation, on its first frame. This "jump-starts" the animation.

set_gen_rate(value: Param)

Sets the number of particles generated each second.

set_moves_with_parent()

By default, animations stay in the position where they were created, subjected to their position. With this set, the animation will follow along with the parent's position, with the animation's position on top of this.

set_position(x: Param, y: Param)

Sets the x and y coordinates of this animation's overall position. Each time a particle is generated, the particle's position is added to the generator position.

set_rotation(angle: Param)

Sets an angle rotation (in radians) for all particles in this animation. The rotation is currently being done in software for convenience, so this is not suitable for animations with many particles.

set_rotation_centroid(x: Param, y: Param)

Sets the point that the rotation, if any, is done about. By default, this is the center point of the particle image.

set_color(r: Param, g: Param, b: Param, a: Param (Optional))

Sets the color which all particles in this animation are drawn using. The a alpha component is optional and defaults to a fixed value of 1.0. Each component Param should yield values between 0.0 and 1.0

set_alpha(a: Param)

Sets the alpha color component for all particles in this animation. The value should be between 0.0 and 1.0

set_completion_callback(callback: CallbackData)

Sets the specified callback to be called when this animation completes.

add_callback(callback: CallbackData, time: Float)

Sets the specified callback to be called after the specified time has elapsed, in seconds.

set_particle_position_dist(x: DistParam, y: DistParam (Optional))

Sets the position distribution of particles generated by this animation. If both x and y are passed, then seperate DistParams are used for each component. If only x is passed, then the same component is used for both. In the case of angular_dist and potentially others in the future, this gives 2D control over particle position.

set_particle_duration_dist(duration: Dist)

Sets the length of time that particles exist for after being created, in seconds

set_particle_size_dist(width: Dist, height: Dist)

Sets the size (where 1.0 equals 1 tile) of particles created by this animation.

#set_particle_frame_time_offset_dist(value: Dist) Sets a frame offset time for each particle created by this animation. This is only useful for particles that are using a TimerImage. When value is a random distribution, all particles generated by this animation will cease to be synced, and instead all start, loop, and/or stop at random times with respect to one another.

Implementations

impl ScriptParticleGenerator[src]

pub fn new(
    parent: usize,
    image: String,
    duration_millis: ExtInt
) -> ScriptParticleGenerator
[src]

pub fn new_anim(
    parent: usize,
    image: String,
    duration_millis: ExtInt
) -> ScriptParticleGenerator
[src]

pub fn owned_model(&self) -> GeneratorModel[src]

Trait Implementations

impl Clone for ScriptParticleGenerator[src]

impl UserData for ScriptParticleGenerator[src]

Auto Trait Implementations

impl RefUnwindSafe for ScriptParticleGenerator

impl Send for ScriptParticleGenerator

impl Sync for ScriptParticleGenerator

impl Unpin for ScriptParticleGenerator

impl UnwindSafe for ScriptParticleGenerator

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<'lua, T> FromLua<'lua> for T where
    T: 'static + UserData + Clone
[src]

impl<'lua, T> FromLuaMulti<'lua> for T where
    T: FromLua<'lua>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'lua, T> ToLua<'lua> for T where
    T: 'static + UserData + Send
[src]

impl<'lua, T> ToLuaMulti<'lua> for T where
    T: ToLua<'lua>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]