pub struct LoadoutBuilder(Loadout);
Expand description
Builder for character Loadouts, containing weapon and armour items belonging
to a character, along with some helper methods for loading Item
-s and
ItemConfig
use veloren_common::{comp::Item, LoadoutBuilder};
// Build a loadout with character starter defaults
// and a specific sword with default sword abilities
let sword = Item::new_from_asset_expect("common.items.weapons.sword.starter");
let loadout = LoadoutBuilder::empty()
.defaults()
.active_mainhand(Some(sword))
.build();
Tuple Fields§
§0: Loadout
Implementations§
§impl LoadoutBuilder
impl LoadoutBuilder
pub fn empty() -> LoadoutBuilder
pub fn from_asset_expect(
asset_specifier: &str,
rng: &mut impl Rng,
time: Option<&(TimeOfDay, Calendar)>,
) -> LoadoutBuilder
pub fn from_asset_expect( asset_specifier: &str, rng: &mut impl Rng, time: Option<&(TimeOfDay, Calendar)>, ) -> LoadoutBuilder
Construct new LoadoutBuilder
from asset_specifier
Will panic if asset is broken
pub fn from_asset(
asset_specifier: &str,
rng: &mut impl Rng,
time: Option<&(TimeOfDay, Calendar)>,
) -> Result<LoadoutBuilder, SpecError>
pub fn from_asset( asset_specifier: &str, rng: &mut impl Rng, time: Option<&(TimeOfDay, Calendar)>, ) -> Result<LoadoutBuilder, SpecError>
Construct new LoadoutBuilder
from asset_specifier
pub fn from_default(body: &Body) -> LoadoutBuilder
pub fn from_default(body: &Body) -> LoadoutBuilder
Construct new default LoadoutBuilder
for corresponding body
NOTE: make sure that you check what is default for this body Use it if you don’t care much about it, for example in “/spawn” command
pub fn from_loadout_spec(
loadout_spec: LoadoutSpec,
rng: &mut impl Rng,
time: Option<&(TimeOfDay, Calendar)>,
) -> Result<LoadoutBuilder, SpecError>
pub fn from_loadout_spec( loadout_spec: LoadoutSpec, rng: &mut impl Rng, time: Option<&(TimeOfDay, Calendar)>, ) -> Result<LoadoutBuilder, SpecError>
Construct new LoadoutBuilder
from asset_specifier
pub fn from_loadout_spec_expect(
loadout_spec: LoadoutSpec,
rng: &mut impl Rng,
time: Option<&(TimeOfDay, Calendar)>,
) -> LoadoutBuilder
pub fn from_loadout_spec_expect( loadout_spec: LoadoutSpec, rng: &mut impl Rng, time: Option<&(TimeOfDay, Calendar)>, ) -> LoadoutBuilder
Construct new LoadoutBuilder
from asset_specifier
Will panic if asset is broken
pub fn with_default_maintool(self, body: &Body) -> LoadoutBuilder
pub fn with_default_maintool(self, body: &Body) -> LoadoutBuilder
Set default active mainhand weapon based on body
pub fn with_default_equipment(self, body: &Body) -> LoadoutBuilder
pub fn with_default_equipment(self, body: &Body) -> LoadoutBuilder
Set default equipement based on body
pub fn with_preset(self, preset: Preset) -> LoadoutBuilder
pub fn with_creator( self, creator: fn(_: LoadoutBuilder, _: Option<&SiteInformation>, _: Option<&(TimeOfDay, Calendar)>) -> LoadoutBuilder, economy: Option<&SiteInformation>, time: Option<&(TimeOfDay, Calendar)>, ) -> LoadoutBuilder
pub fn with_asset( self, asset_specifier: &str, rng: &mut impl Rng, time: Option<&(TimeOfDay, Calendar)>, ) -> Result<LoadoutBuilder, SpecError>
pub fn with_asset_expect(
self,
asset_specifier: &str,
rng: &mut impl Rng,
time: Option<&(TimeOfDay, Calendar)>,
) -> LoadoutBuilder
pub fn with_asset_expect( self, asset_specifier: &str, rng: &mut impl Rng, time: Option<&(TimeOfDay, Calendar)>, ) -> LoadoutBuilder
pub fn defaults(self) -> LoadoutBuilder
pub fn defaults(self) -> LoadoutBuilder
Set default armor items for the loadout. This may vary with game updates, but should be safe defaults for a new character.
pub fn active_mainhand(self, item: Option<Item>) -> LoadoutBuilder
pub fn active_offhand(self, item: Option<Item>) -> LoadoutBuilder
pub fn inactive_mainhand(self, item: Option<Item>) -> LoadoutBuilder
pub fn inactive_offhand(self, item: Option<Item>) -> LoadoutBuilder
pub fn shoulder(self, item: Option<Item>) -> LoadoutBuilder
pub fn chest(self, item: Option<Item>) -> LoadoutBuilder
pub fn belt(self, item: Option<Item>) -> LoadoutBuilder
pub fn hands(self, item: Option<Item>) -> LoadoutBuilder
pub fn pants(self, item: Option<Item>) -> LoadoutBuilder
pub fn feet(self, item: Option<Item>) -> LoadoutBuilder
pub fn back(self, item: Option<Item>) -> LoadoutBuilder
pub fn ring1(self, item: Option<Item>) -> LoadoutBuilder
pub fn ring2(self, item: Option<Item>) -> LoadoutBuilder
pub fn neck(self, item: Option<Item>) -> LoadoutBuilder
pub fn lantern(self, item: Option<Item>) -> LoadoutBuilder
pub fn glider(self, item: Option<Item>) -> LoadoutBuilder
pub fn head(self, item: Option<Item>) -> LoadoutBuilder
pub fn tabard(self, item: Option<Item>) -> LoadoutBuilder
pub fn bag(self, which: ArmorSlot, item: Option<Item>) -> LoadoutBuilder
pub fn build(self) -> Loadout
Trait Implementations§
§impl Clone for LoadoutBuilder
impl Clone for LoadoutBuilder
§fn clone(&self) -> LoadoutBuilder
fn clone(&self) -> LoadoutBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for LoadoutBuilder
impl RefUnwindSafe for LoadoutBuilder
impl Send for LoadoutBuilder
impl Sync for LoadoutBuilder
impl Unpin for LoadoutBuilder
impl UnwindSafe for LoadoutBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more