[][src]Struct sulis_state::script::targeter::TargeterData

pub struct TargeterData {
    pub kind: Kind,
    pub parent: usize,
    pub selectable: Vec<Option<usize>>,
    pub effectable: Vec<Option<usize>>,
    pub max_effectable: Option<usize>,
    pub shape: Shape,
    pub show_mouseover: bool,
    pub free_select: Option<f32>,
    pub free_select_must_be_passable: Option<String>,
    pub selection_area: SelectionArea,
    pub allow_affected_points_impass: bool,
    pub impass_blocks_affected_points: bool,
    pub invis_blocks_affected_points: bool,
    pub allow_affected_points_invis: bool,
    pub on_target_select_func: String,
    pub on_target_select_custom_target: Option<usize>,
}

Created by calling create_targeter on a ScriptEntity. A targeter allows the player (or ai script) to select a specific target from a list of available targets, or choose a location for an area of effect.

The targeter is configured, and then finally activated with activate()

activate()

Once configuration of this targeter is complete, activate it. The player (or ai script) will then be able to interact with it.

set_callback_fn(func: String)

Sets the callback function that is called when the target is selected. By default, this is on_target_select(parent, ability/item, targets). However, if more than one targeter is used in a given script then this method can be used to make those targeters use different functions.

set_callback_custom_target(target: ScriptEntity)

Causes the specified target to always be added to the list of targets returned by the targeter. This is occasionally useful for targeters that select a location rather than an entity.

add_all_selectable(selectable: ScriptEntitySet)

Adds all entities in selectable as possible selections for this targeter. They must still meet all other constraints added in order to be valid selections.

add_selectable(selectable: ScriptEntity)

Adds a single entity selectable as a possible selection for this targeter. It must still meet all other constraints in order to be a valid selection.

set_show_mouseover(show: Bool)

Sets whether to show the entity mouseover for this targeter. By default, it is shown. For some abilities, it may be a better user experience to not show it.

set_free_select(range: Float)

Sets free select mode, allowing any point within the specified range of the parent entity to be selected. By default, the targeter is in entity select mode.

set_free_select_must_be_passable(size_id: String)

Only applies when the targeter is in free select mode. Requires any point that is selected in free select to be passable for the size specified by size_id

impass_blocks_affected_points(blocks: bool)

Sets whether or not an impassable tile blocks further affected points in a line extending from the targeter center outwards. Defaults to false

invis_blocks_affected_points(blocks: bool)

Sets whether a visibility blocking tile blocks further affected points in a line extending from the targeter center outwards. Defaults to false

allow_affected_points_impass(allow: bool)

Sets whether or not to allow affected points to be terrain impassable. defaults to true

allow_affected_points_invis(allow: bool)

Sets whether or not to allow affected points to prevent visibility. defaults to false

add_all_effectable(targets: ScriptEntitySet)

Adds all entities in the set as targets that can potentially be affected by this targeter. Only affectable entities within the area of effect of the chosen shape will end up as targets.

add_effectable(target: ScriptEntity)

Adds the specified entity as a target to potentially be affected by this targeter. See add_all_effectable

set_max_effectable(max: Int)

Sets the maximum number of targets that this targeter may affect and return.

set_shape_circle(radius: Float, min_radius: Float (Optional))

Sets the shape of this targeter to a circle with the specified radius, in tiles. If min_radius is specified, instead creates a ring shape with the specified minimum and maximum radii.

set_shape_line(size: String, x: Int, y: Int, length: Int)

Sets the shape of this targeter to a line that extends from x, y as its origin for the specified length. The width of the line is determined by the size. Effectively, only the angle that the line is pointing in is determined by the user.

set_shape_line_segment(size: String, x: Int, y: Int)

Sets the shape of this targeter to a line segment from x, y to the user selected point. The width of the segment is based on size.

set_shape_object_size(size: String)

Sets this targeter to affect a set of points with the shape specified by the specified size.

set_shape_cone(x: Float, y: Float, min_radius: Float, radius: Float, angle: Float)

Sets this targeter to a cone shape, with center / origin x, y, a specified radius, and subtending the specified angle. The angle is in radians. min_radius specifies a minimum distance points must be from the origin to be included. This should be zero for a true cone.

set_selection_radius(r: Float)

Sets the radius of the selection area to the specified value. The selection area is drawn to provide feedback to the user but does not impact selection for the targeter.

set_selection_visible()

Sets the selection area to visible targets. See set_selection_radius.

set_selection_touchable()

Sets the selection area to touch-reachable targets (without a weapon). See set_selection_radius.

set_selection_attackable()

Sets the selection area to attackable targets. See set_selection_radius.

Fields

kind: Kindparent: usizeselectable: Vec<Option<usize>>effectable: Vec<Option<usize>>max_effectable: Option<usize>shape: Shapeshow_mouseover: boolfree_select: Option<f32>free_select_must_be_passable: Option<String>selection_area: SelectionAreaallow_affected_points_impass: boolimpass_blocks_affected_points: boolinvis_blocks_affected_points: boolallow_affected_points_invis: boolon_target_select_func: Stringon_target_select_custom_target: Option<usize>

Implementations

impl TargeterData[src]

pub fn new_item(parent: usize, kind: ScriptItemKind) -> TargeterData[src]

pub fn new_ability(parent: usize, ability_id: &str) -> TargeterData[src]

Trait Implementations

impl Clone for TargeterData[src]

impl UserData for TargeterData[src]

Auto Trait Implementations

impl RefUnwindSafe for TargeterData

impl Send for TargeterData

impl Sync for TargeterData

impl Unpin for TargeterData

impl UnwindSafe for TargeterData

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]