portals 1

This commit is contained in:
2026-06-13 17:58:04 -05:00
parent 49d32eedf5
commit 6818f0545a
9 changed files with 151 additions and 7 deletions
+9 -3
View File
@@ -1,11 +1,11 @@
use std::collections::BTreeMap;
use std::collections::{BTreeMap, HashMap};
use crate::archetype::Archetype;
use crate::archetype::Archetype::Empty;
use crate::glyph::Glyph;
use crate::log::LogLine;
use crate::object_def::ObjectDef;
use crate::utils::Direction;
use crate::utils::{ObjectId, Player, PortalDef, Solid};
use crate::utils::{ObjectId, Player, PortalDef, RegistryValue, Solid};
/// The complete state of one game board (a single room or screen).
///
@@ -67,6 +67,11 @@ pub struct Board {
/// [`LogLine`]s. Empty for a clean load; see [`Board::is_valid`]. Not part of
/// the map file (purely a load diagnostic).
pub(crate) load_errors: Vec<LogLine>,
/// Per-board key→value store written and read by Rhai scripts via the
/// `Registry` scope constant. Persists automatically across board transitions
/// because all boards live as `Rc<RefCell<Board>>` in `World::boards` and are
/// never evicted. Not saved to disk in v1.
pub registry: HashMap<String, RegistryValue>,
}
impl Board {
@@ -308,7 +313,7 @@ impl Board {
#[cfg(test)]
pub(crate) mod tests {
use std::collections::BTreeMap;
use std::collections::{BTreeMap, HashMap};
use color::Rgba8;
use crate::archetype::Archetype;
use crate::glyph::Glyph;
@@ -345,6 +350,7 @@ pub(crate) mod tests {
portals: Vec::new(),
board_script_name: None,
load_errors: Vec::new(),
registry: HashMap::new(),
}
}