|
|
|
@ -9,17 +9,30 @@ use crate::id::Id;
|
|
|
|
|
use crate::try_log;
|
|
|
|
|
use crate::world::{Area, AreaType, Direction, Exit, DIRECTION_LIST};
|
|
|
|
|
|
|
|
|
|
/// A specific location in the world.
|
|
|
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
|
|
|
pub struct Room {
|
|
|
|
|
/// Unique identifier
|
|
|
|
|
pub id: Id,
|
|
|
|
|
|
|
|
|
|
/// Parent zone that the room is in
|
|
|
|
|
pub zone: Id,
|
|
|
|
|
|
|
|
|
|
/// Name of the room
|
|
|
|
|
pub name: String,
|
|
|
|
|
|
|
|
|
|
/// Description, each line an entry in a `Vec`
|
|
|
|
|
pub description: Vec<String>,
|
|
|
|
|
|
|
|
|
|
/// Whether users in the room should be visible to the parent zone
|
|
|
|
|
pub users_visible: bool,
|
|
|
|
|
|
|
|
|
|
/// Exits from the room
|
|
|
|
|
pub exits: HashMap<Direction, Exit>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Room {
|
|
|
|
|
/// Return a list of available exits by the short identifier
|
|
|
|
|
pub fn exit_string(&self) -> String {
|
|
|
|
|
if self.exits.is_empty() {
|
|
|
|
|
return String::new();
|
|
|
|
|