This commit is contained in:
2026-07-11 12:40:35 -05:00
parent f1eaaae5d0
commit 6dccf5fc23
14 changed files with 363 additions and 40 deletions
+13
View File
@@ -64,6 +64,17 @@ pub struct MapHeader {
/// Name of the board-level script in the `[scripts]` table, if any.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub board_script_name: Option<String>,
/// When `true`, this is a "dark" board: front-ends reveal only cells within
/// the player's field of view. Absent ⇒ `false` (fully lit); omitted from
/// the saved TOML when `false`. See [`Board::dark`](crate::board::Board::dark).
#[serde(default, skip_serializing_if = "is_false")]
pub dark: bool,
}
/// serde `skip_serializing_if` predicate: omit a `bool` field when it is `false`
/// (so the common non-dark board doesn't emit a `dark = false` line).
fn is_false(b: &bool) -> bool {
!*b
}
/// Serde form of the board floor attribute (`floor = { … }` in `[map]`).
@@ -401,6 +412,7 @@ impl TryFrom<MapFile> for Board {
next_object_id,
portals,
board_script_name: mf.map.board_script_name,
dark: mf.map.dark,
load_errors,
registry: HashMap::new(),
};
@@ -671,6 +683,7 @@ impl From<&Board> for MapFile {
height: board.height,
floor: floor_to_spec(&board.floor),
board_script_name: board.board_script_name.clone(),
dark: board.dark,
},
grid,
triggers,