Skip to main content

Game

Struct Game 

Source
pub struct Game { /* private fields */ }

Implementations§

Source§

impl Game

Source

pub fn new(map: Map, player: Player) -> Result<Self, InitError>

Source

pub async fn load(path: &Path) -> Result<Self, LoadError>

Source

pub async fn save(&self, path: &Path) -> Result<(), SaveError>

Source

pub fn schedule_event(&mut self, event: Event, event_ticks: u32)

Source

pub fn execute_events(&mut self) -> Result<(), ApplyError>

Source

pub fn emit_meta_event(&mut self, meta_event: MetaEvent)

Source

pub fn read_one_meta_event(&mut self) -> Option<MetaEvent>

Source

pub fn map(&self) -> &Map

Source

pub fn place_block( &mut self, point: CoordPair, block: PlaceableBlock, ) -> Result<(), AccessError>

Source

pub fn player(&self) -> &Player

Source

pub fn move_player_pointer( &mut self, direction: Direction, ) -> Result<(), MovePlayerError>

Source

pub fn move_player_head( &mut self, direction: Direction, ) -> Result<(), MovePlayerError>

Source

pub fn make_player_face( &mut self, direction: Direction, ) -> Result<(), MovePlayerError>

Source

pub fn monster_registry(&self) -> &Registry

Source

pub fn try_spawn_moster( &mut self, pos: MonsterPosition, ) -> Result<(), SpawnMonsterError>

Source

pub fn vanish_monster(&mut self, id: Id) -> Result<(), VanishMonsterError>

Source

pub fn try_move_monster( &mut self, id: Id, direction: Direction, ) -> Result<(), MoveMonsterError>

Source

pub fn move_monster_head( &mut self, id: Id, direction: Direction, ) -> Result<(), MoveMonsterError>

Source

pub fn make_monster_face( &mut self, id: Id, direction: Direction, ) -> Result<(), MoveMonsterError>

Source

pub fn monster_attack(&mut self, id: Id) -> Result<(), MonsterAttackError>

Source

pub fn monster_growl(&mut self, id: Id) -> Result<(), MonsterGrowlError>

Source

pub fn monster_follow_player( &mut self, id: Id, speed: Coord, limit: u32, ) -> Result<(), MonsterFollowError>

Source

pub fn damage_player(&mut self, amount: StatValue)

Source

pub fn heal_player(&mut self, amount: StatValue)

Trait Implementations§

Source§

impl Clone for Game

Source§

fn clone(&self) -> Game

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Game

Source§

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

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

impl<'de> Deserialize<'de> for Game

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Game

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Game

§

impl RefUnwindSafe for Game

§

impl Send for Game

§

impl Sync for Game

§

impl Unpin for Game

§

impl UnsafeUnpin for Game

§

impl UnwindSafe for Game

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

Source§

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