glyph serialization

This commit is contained in:
2026-07-26 23:29:43 -05:00
parent 9844671c46
commit ab5f22fe76
20 changed files with 408 additions and 143 deletions
+5 -5
View File
@@ -128,17 +128,17 @@ impl Board {
let sensors = self.sensors.iter().filter(|&s| s.x == x && s.y == y);
// Is there a sensor above the grid?
if let Some(above) = sensors.clone().find(|s| s.draw_layer == DrawLayer::Above && s.scripting.glyph.tile != 0) {
if let Some(above) = sensors.clone().find(|s| s.draw_layer == DrawLayer::Above && s.scripting.glyph.is_visible()) {
return above.scripting.glyph;
}
// Does the grid have a good glyph?
if let Some(glyph) = grid_glyph && glyph.tile != 0 {
if let Some(glyph) = grid_glyph && glyph.is_visible() {
return glyph;
}
// Is there a sensor below the grid?
if let Some(below) = sensors.clone().find(|s| s.draw_layer == DrawLayer::Below && s.scripting.glyph.tile != 0) {
if let Some(below) = sensors.clone().find(|s| s.draw_layer == DrawLayer::Below && s.scripting.glyph.is_visible()) {
return below.scripting.glyph;
}
@@ -798,7 +798,7 @@ pub(crate) mod tests {
draw_layer: DrawLayer::Above,
scripting: ScriptAttributes {
id: board.next_object_id,
glyph: Glyph { tile: 1, fg: Rgba8 { r: 255, g: 0, b: 0, a: 255 }, bg: Rgba8 { r: 0, g: 0, b: 0, a: 255 } },
glyph: Glyph { tile: '', fg: Rgba8 { r: 255, g: 0, b: 0, a: 255 }, bg: Rgba8 { r: 0, g: 0, b: 0, a: 255 } },
optics: Optics {
glow: 4,
opaque: false
@@ -916,7 +916,7 @@ pub(crate) mod tests {
// Player parked at (2,0) so it doesn't overlap either asserted cell.
let mut board = open_board(3, 1, (2, 0));
let floor_glyph = Glyph {
tile: '.' as u32,
tile: '.',
fg: Rgba8 {
r: 10,
g: 20,