lighting
This commit is contained in:
@@ -161,6 +161,7 @@ impl GameState {
|
||||
let world = World {
|
||||
name: String::new(),
|
||||
start: "board".to_string(),
|
||||
torch: crate::fov::SIGHT_RADIUS as u32,
|
||||
scripts,
|
||||
boards: std::collections::HashMap::from([("board".to_string(), board_ref)]),
|
||||
};
|
||||
@@ -182,6 +183,12 @@ impl GameState {
|
||||
&self.current_board_name
|
||||
}
|
||||
|
||||
/// The player's torch radius (world-wide config; see [`World::torch`]),
|
||||
/// passed to [`Board::lighting`] when rendering a dark board.
|
||||
pub fn torch(&self) -> u32 {
|
||||
self.world.torch
|
||||
}
|
||||
|
||||
/// Returns a clone of the `Rc` for the active board.
|
||||
///
|
||||
/// Lets a front-end hold a reference to the current board across a board
|
||||
@@ -304,6 +311,11 @@ impl GameState {
|
||||
obj.glyph.tile = tile;
|
||||
}
|
||||
}
|
||||
Action::SetLight(radius) => {
|
||||
if let Some(obj) = board.objects.get_mut(&ba.source) {
|
||||
obj.light = radius;
|
||||
}
|
||||
}
|
||||
Action::SetTag {
|
||||
target,
|
||||
tag,
|
||||
|
||||
Reference in New Issue
Block a user