pub struct World { /* private fields */ }Implementations§
Source§impl World
impl World
pub fn simulate_battle( &self, attacker: &[Squad], defender: &[Squad], luck: Luck, wall: BuildingLevel, ) -> Result<BattleResult>
Source§impl World
impl World
pub fn push_chat_message( &mut self, author: PlayerId, message: &str, ) -> ChatMessageId
Source§impl World
impl World
pub fn cheat_get_academy_recruit_queue( &self, coord: Coord, ) -> Result<AcademyRecruitQueue>
pub fn cheat_get_academy_recruit_queues( &self, coords: &[Coord], filter_empty: bool, ) -> Result<Vec<(Coord, AcademyRecruitQueue)>>
pub fn cheat_get_all_academy_recruit_queues( &self, filter_empty: bool, ) -> Result<Vec<(Coord, AcademyRecruitQueue)>>
pub fn cheat_get_all_prefecture_build_queues( &self, filter_empty: bool, ) -> Result<Vec<(Coord, PrefectureBuildQueue)>>
pub fn cheat_get_all_stable_recruit_queues( &self, filter_empty: bool, ) -> Result<Vec<(Coord, StableRecruitQueue)>>
pub fn cheat_get_infrastructure(&self, coord: Coord) -> Result<Infrastructure>
pub fn cheat_get_prefecture_build_queue( &self, coord: Coord, ) -> Result<PrefectureBuildQueue>
pub fn cheat_get_prefecture_build_queues( &self, coords: &[Coord], filter_empty: bool, ) -> Result<Vec<(Coord, PrefectureBuildQueue)>>
pub fn cheat_get_stable_recruit_queue( &self, coord: Coord, ) -> Result<StableRecruitQueue>
pub fn cheat_get_stable_recruit_queues( &self, coords: &[Coord], filter_empty: bool, ) -> Result<Vec<(Coord, StableRecruitQueue)>>
pub fn cheat_get_storage_capacity( &self, ruler: Ruler, ) -> Result<OverallStorageCapacity>
pub fn cheat_set_max_infrastructure(&mut self, coord: Coord) -> Result<()>
pub fn cheat_set_building_level( &mut self, coord: Coord, id: BuildingId, level: BuildingLevel, ) -> Result<()>
Source§impl World
impl World
pub fn cheat_get_idle_armies_at(&self, coord: Coord) -> Result<Vec<Army>>
pub fn cheat_get_idle_personnel_at(&self, coord: Coord) -> Result<ArmyPersonnel>
pub fn cheat_spawn_personnel( &mut self, coord: Coord, personnel: ArmyPersonnel, ruler: Option<Ruler>, ) -> Result<()>
Source§impl World
impl World
pub fn cheat_get_ethics(&self, ruler: &Ruler) -> Result<Option<Ethics>>
pub fn cheat_set_bot_ethics(&mut self, id: &BotId, ethics: Ethics) -> Result<()>
pub fn cheat_spawn_bot( &mut self, name: &str, infrastructure: Infrastructure, ) -> Result<BotId>
Source§impl World
impl World
pub fn cheat_get_player(&self, id: &PlayerId) -> Result<Player>
pub fn cheat_get_players(&self) -> Result<Vec<Player>>
Source§impl World
impl World
pub fn cheat_get_resources(&self, ruler: &Ruler) -> Result<Resources>
pub fn cheat_set_resources( &mut self, ruler: &Ruler, resources: Resources, ) -> Result<()>
pub fn cheat_set_max_resources(&mut self, ruler: &Ruler) -> Result<()>
pub fn cheat_set_max_silo_resources(&mut self, ruler: &Ruler) -> Result<()>
pub fn cheat_set_max_warehouse_resources(&mut self, ruler: &Ruler) -> Result<()>
pub fn cheat_set_food(&mut self, ruler: &Ruler, food: Food) -> Result<()>
pub fn cheat_set_max_food(&mut self, ruler: &Ruler) -> Result<()>
pub fn cheat_set_iron(&mut self, ruler: &Ruler, iron: Iron) -> Result<()>
pub fn cheat_set_max_iron(&mut self, ruler: &Ruler) -> Result<()>
pub fn cheat_set_stone(&mut self, ruler: &Ruler, stone: Stone) -> Result<()>
pub fn cheat_set_max_stone(&mut self, ruler: &Ruler) -> Result<()>
pub fn cheat_set_wood(&mut self, ruler: &Ruler, wood: Wood) -> Result<()>
pub fn cheat_set_max_wood(&mut self, ruler: &Ruler) -> Result<()>
Source§impl World
impl World
pub fn count_cities<R>(&self, owner: R) -> u32
pub fn get_city_score(&self, key: impl ContinentKey) -> Result<Score>
pub fn rename_city(&mut self, key: impl ContinentKey, name: &str) -> Result<()>
Source§impl World
impl World
pub fn add_academy_recruit_order( &mut self, req: &AcademyRecruitOrderRequest, ) -> Result<()>
pub fn cancel_academy_recruit_order( &mut self, coord: Coord, id: AcademyRecruitOrderId, ) -> Result<()>
Source§impl World
impl World
pub fn add_prefecture_build_order( &mut self, req: &PrefectureBuildOrderRequest, ) -> Result<()>
pub fn cancel_prefecture_build_order(&mut self, coord: Coord) -> Result<()>
Source§impl World
impl World
pub fn add_stable_recruit_order( &mut self, req: &StableRecruitOrderRequest, ) -> Result<()>
pub fn cancel_stable_recruit_order( &mut self, coord: Coord, id: StableRecruitOrderId, ) -> Result<()>
Source§impl World
impl World
pub fn add_workshop_recruit_order( &mut self, req: &WorkshopRecruitOrderRequest, ) -> Result<()>
pub fn cancel_workshop_recruit_order( &mut self, coord: Coord, id: WorkshopRecruitOrderId, ) -> Result<()>
Source§impl World
impl World
pub fn get_storage_capacity<R>( &self, ruler: R, ) -> Result<OverallStorageCapacity>
pub fn get_storage_capacity_weight<K>(
&self,
key: K,
) -> Result<OverallStorageCapacityWeight>where
K: ContinentKey,
Source§impl World
impl World
pub fn toggle_building( &mut self, coord: Coord, id: BuildingId, enabled: bool, ) -> Result<()>
Source§impl World
impl World
pub fn request_maneuver( &mut self, request: ManeuverRequest, ) -> Result<ManeuverId>
pub fn collapse_armies(&mut self)
Source§impl World
impl World
pub fn get_player_maintenance(&self, player: &PlayerId) -> Result<Maintenance>
pub fn get_player_military(&self, player: &PlayerId) -> Result<Military>
pub fn get_player_reports(&self, player: &PlayerId) -> Vec<ReportId>
pub fn has_player(&self, id: &PlayerId) -> bool
pub fn set_player_status( &mut self, id: &PlayerId, status: PlayerStatus, ) -> Result<()>
pub fn spawn_player(&mut self, player: Player) -> Result<()>
Source§impl World
impl World
pub fn get_weighted_resources<K>(&self, key: K) -> Result<Resources>where
K: ContinentKey,
Source§impl World
impl World
pub fn start_round(&mut self) -> Result<()>
pub fn set_player_ready( &mut self, player: &PlayerId, is_ready: bool, ) -> Result<()>
Source§impl World
impl World
pub fn new(options: &WorldOptions) -> Result<Self>
pub fn with_savedata(savedata: Savedata) -> Self
pub fn load(bytes: &[u8]) -> Result<Self>
pub fn id(&self) -> WorldId
pub fn config(&self) -> &WorldConfig
pub fn stats(&self) -> WorldStats
pub fn continent(&self) -> &Continent
pub fn city(&self, coord: Coord) -> Result<&City>
pub fn infrastructure(&self, coord: Coord) -> Result<&Infrastructure>
pub fn round(&self) -> &Round
pub fn chat(&self) -> &Chat
pub fn ranking(&self) -> &Ranking
pub fn report(&self) -> &ReportManager
pub fn player_manager(&self) -> &PlayerManager
pub fn player(&self, id: &PlayerId) -> Result<&Player>
pub fn players(&self) -> impl Iterator<Item = &Player>
pub fn bot_manager(&self) -> &BotManager
pub fn bot(&self, id: &BotId) -> Result<&Bot>
pub fn bots(&self) -> impl Iterator<Item = &Bot>
pub fn precursor_manager(&self) -> &PrecursorManager
pub fn precursor(&self, id: PrecursorId) -> &dyn Precursor
pub fn precursors(&self) -> impl Iterator<Item = &dyn Precursor>
pub fn ruler(&self, ruler: &Ruler) -> Result<RulerRef<'_>>
pub fn rulers(&self) -> impl Iterator<Item = RulerRef<'_>>
pub fn military(&self) -> &Military
pub fn save<F>(&mut self, f: F)
pub fn on_next_round<F>(&mut self, f: F)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for World
impl !RefUnwindSafe for World
impl Send for World
impl Sync for World
impl Unpin for World
impl UnsafeUnpin for World
impl !UnwindSafe for World
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.