fov
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user