[−][src]Struct sulis_state::script::ScriptInventory
The inventory of a particular creature, including equipped items and quickslots.
set_locked(locked: Bool)
Sets whether this inventory is locked. The player will be unable to equip or unequip any items in a locked inventory.
is_locked() -> Bool
Returns whether or not this inventory is locked. See set_locked
has_equipped(slot: String) -> Bool
Returns true if the owning entity has an item equipped in the given
slot, false otherwise. Valid slots are cloak
, head
, torso
,
hands
, held_main
, held_off
, legs
, feet
, waist
, neck
,
fingerMain
, fingerOff
equipped_stats(slot: String) -> Table
Returns a table describing the stats of the item in the given slot, or
errors if there is no item or the slot is invalid. See has_equipped
for valid slots. The table stats
includes stats.name
, stats.value
,
stats.weight
, stats.kind
, and stats.armor_kind
for armor or
stats.weapon_kind
for weapons.
equip_item(item: ScriptStashItem)
Equips the given item
from the stash into the appropriate inventory
slot of the parent.
unequip_item(slot: String) -> ScriptStashItem
Unequips the item in the specified inventory slot
of the parent.
Slot must be one of cloak, head, torso, hands, held_main, held_off,
legs, feet, waist, neck, finger_main, finger_off. Returns the
ScriptStashItem representing the unequipped item in the stash, or
the invalid item if no item was in the slot
has_equipped_weapon() -> Bool
Returns true if the parent entity currently has a weapon equipped, false otherwise.
has_equipped_shield() -> Bool
Returns true if the parent entity currently has a shield equipped, false otherwise.
has_alt_weapons() -> Bool
Returns true if the parent entity has an item in at least one of its alt weapon slots, meaning it can switch to an alt weapon set.
alt_weapon_style() -> String
Returns the weapon style of the alt weapons that are in the quick slots
of the parent creature. Valid values are Ranged
, TwoHanded
, Single
,
Shielded
, and DualWielding
weapon_style() -> String
Returns the weapon style of the currently equipped weapons
of the parent creature. Valid values are Ranged
, TwoHanded
, Single
,
Shielded
, and DualWielding
usable_items() -> Table
Returns a table of all items currently in Use QuickSlots for the parent
entity. Each item is represented by a ScriptUsableItem
in the table.
Implementations
impl ScriptInventory
[src]
pub fn new(parent: ScriptEntity) -> ScriptInventory
[src]
Trait Implementations
impl Clone for ScriptInventory
[src]
fn clone(&self) -> ScriptInventory
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl UserData for ScriptInventory
[src]
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M)
[src]
Auto Trait Implementations
impl RefUnwindSafe for ScriptInventory
impl Send for ScriptInventory
impl Sync for ScriptInventory
impl Unpin for ScriptInventory
impl UnwindSafe for ScriptInventory
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>,