Skip to main content

StructureConfig

Struct StructureConfig 

Source
pub struct StructureConfig {
    pub description: Option<String>,
    pub starting_level: Option<usize>,
    pub production: Option<Vec<ProductionConfig>>,
    pub production_multiplier: Option<f64>,
    pub storage: Option<Vec<StorageConfig>>,
    pub storage_multiplier: Option<f64>,
    pub cost: Vec<HashMap<String, usize>>,
    pub cost_multiplier: Option<f64>,
}

Fields§

§description: Option<String>

Description of the structure.

§starting_level: Option<usize>

Starting level for this type of structure If not provided it is 0

§production: Option<Vec<ProductionConfig>>

Used to specify how many of each resource is produced

The number of ticks needed to produce the resource at a level

§production_multiplier: Option<f64>

Used as a multiplier for the production.

The highest given production value will be multiplied by this value.

§storage: Option<Vec<StorageConfig>>

The amount of storage available at the starting level.

§storage_multiplier: Option<f64>

Used as a multiplier for the storage.

§cost: Vec<HashMap<String, usize>>

Cost for each level They are the costs to level up from the current level to the next level The first element is the cost to level up from 0 to 1

§cost_multiplier: Option<f64>

Used as a multiplier for the cost.

The highest given cost value will be multiplied by this value.

Implementations§

Source§

impl StructureConfig

Source

pub fn get_cost(&self, level: usize) -> Cost

Get the cost to build this structure at a given level

Source

pub fn get_production(&self, level: usize) -> ProductionConfig

Get the production for this structure at a given level.

Source

pub fn get_storage(&self, level: usize) -> StorageConfig

Get the storage for this structure at a given level.

Trait Implementations§

Source§

impl Debug for StructureConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StructureConfig

Source§

fn default() -> StructureConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for StructureConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V