Skip to main content

Engine

Struct Engine 

Source
pub struct Engine {
    pub rooms: BTreeMap<RoomId, Room>,
    /* private fields */
}
Expand description

The core MUD engine — holds all state

Fields§

§rooms: BTreeMap<RoomId, Room>

Implementations§

Source§

impl Engine

Source

pub fn new() -> Self

Source

pub fn add_room(&mut self, room: Room) -> Result<(), String>

Source

pub fn remove_room(&mut self, id: &RoomId) -> Result<Room, String>

Source

pub fn get_room(&self, id: &RoomId) -> Option<&Room>

Source

pub fn get_room_mut(&mut self, id: &RoomId) -> Option<&mut Room>

Source

pub fn rooms_by_domain(&self, domain: &Domain) -> Vec<&Room>

Source

pub fn rooms_by_depth(&self, depth: &Depth) -> Vec<&Room>

Source

pub fn all_rooms(&self) -> Vec<&Room>

Source

pub fn add_tile(&mut self, tile: Tile) -> Result<(), String>

Source

pub fn get_tile(&self, id: &TileId) -> Option<&Tile>

Source

pub fn get_tile_mut(&mut self, id: &TileId) -> Option<&mut Tile>

Source

pub fn remove_tile(&mut self, id: &TileId) -> Result<Tile, String>

Source

pub fn tiles_by_domain(&self, domain: &Domain) -> Vec<&Tile>

Source

pub fn tile_dependencies(&self, id: &TileId) -> Vec<&Tile>

Source

pub fn add_npc(&mut self, npc: Npc) -> Result<(), String>

Source

pub fn get_npc(&self, id: &NpcId) -> Option<&Npc>

Source

pub fn get_npc_mut(&mut self, id: &NpcId) -> Option<&mut Npc>

Source

pub fn npcs_in_room(&self, room: &RoomId) -> Vec<&Npc>

Source

pub fn connect_agent( &mut self, agent_id: AgentId, start_room: RoomId, ) -> Result<(), String>

Source

pub fn disconnect_agent(&mut self, id: &AgentId) -> Result<AgentSession, String>

Source

pub fn get_session(&self, id: &AgentId) -> Option<&AgentSession>

Source

pub fn get_session_mut(&mut self, id: &AgentId) -> Option<&mut AgentSession>

Source

pub fn navigate( &mut self, agent: &AgentId, direction: &str, ) -> Result<RoomId, String>

Source

pub fn pick_up_tile( &mut self, agent: &AgentId, tile_id: &TileId, ) -> Result<(), String>

Source

pub fn drop_tile( &mut self, agent: &AgentId, tile_id: &TileId, ) -> Result<(), String>

Source

pub fn craft( &mut self, agent: &AgentId, input_ids: &[TileId], recipe_name: &str, ) -> Result<Tile, String>

Source

pub fn talk_to_npc( &mut self, _agent: &AgentId, npc_id: &NpcId, query: &str, ) -> Result<String, String>

Source

pub fn look(&self, agent: &AgentId) -> Result<String, String>

Source

pub fn map(&self, agent: &AgentId) -> Result<String, String>

Source

pub fn zeitgeist(&self) -> &Zeitgeist

Source

pub fn zeitgeist_mut(&mut self) -> &mut Zeitgeist

Source

pub fn execute( &mut self, agent: &AgentId, cmd: Command, ) -> Result<String, String>

Source

pub fn receive_flux(&mut self, flux: &FluxTransference) -> Result<(), String>

Process an incoming FLUX transference

Trait Implementations§

Source§

impl Default for Engine

Source§

fn default() -> Self

Returns the “default value” for a type. 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<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, 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.