[−][src]Struct sulis_state::script::targeter::TargeterData
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: Kind
parent: usize
selectable: Vec<Option<usize>>
effectable: Vec<Option<usize>>
max_effectable: Option<usize>
shape: Shape
show_mouseover: bool
free_select: Option<f32>
free_select_must_be_passable: Option<String>
selection_area: SelectionArea
allow_affected_points_impass: bool
impass_blocks_affected_points: bool
invis_blocks_affected_points: bool
allow_affected_points_invis: bool
on_target_select_func: String
on_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]
fn clone(&self) -> TargeterData
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl UserData for TargeterData
[src]
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M)
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<'lua, T> FromLua<'lua> for T where
T: 'static + UserData + Clone,
[src]
T: 'static + UserData + Clone,
impl<'lua, T> FromLuaMulti<'lua> for T where
T: FromLua<'lua>,
[src]
T: FromLua<'lua>,
pub fn from_lua_multi(
values: MultiValue<'lua>,
lua: Context<'lua>
) -> Result<T, Error>
[src]
values: MultiValue<'lua>,
lua: Context<'lua>
) -> Result<T, Error>
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'lua, T> ToLua<'lua> for T where
T: 'static + UserData + Send,
[src]
T: 'static + UserData + Send,
impl<'lua, T> ToLuaMulti<'lua> for T where
T: ToLua<'lua>,
[src]
T: ToLua<'lua>,
pub fn to_lua_multi(self, lua: Context<'lua>) -> Result<MultiValue<'lua>, Error>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,