Replace Element with Behavior + Archetype; update map format

Element is replaced by two types: Behavior (a plain struct of runtime
properties: passable, opaque) and Archetype (an enum of named presets:
Empty, Wall, Object, ErrorBlock). Board.cells changes from Vec<(Glyph,
usize)> to Vec<(Glyph, Archetype)>, eliminating the per-board element
palette. Map files now reference archetypes by name (archetype = "wall")
instead of property bags (passable = false), so the archetype list can
be reordered without breaking saved games. Unknown archetype names
produce an ErrorBlock cell (yellow ? on red) so malformed maps are
immediately visible in-game.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 15:20:46 -05:00
parent 453c7baf4e
commit ac6a8dec57
4 changed files with 168 additions and 82 deletions
+4 -3
View File
@@ -5,8 +5,9 @@ height = 25
player_start = [30, 12]
[palette]
" " = { passable = true, ch = " ", fg = "#000000", bg = "#000000" }
"#" = { passable = false, ch = "#", fg = "#808080", bg = "#606060" }
" " = { archetype = "empty", ch = " ", fg = "#000000", bg = "#000000" }
"#" = { archetype = "wall", ch = "#", fg = "#808080", bg = "#606060" }
"+" = { archetype = "banana", ch = "#", fg = "#808080", bg = "#606060" }
[grid]
content = """
@@ -18,7 +19,7 @@ content = """
# #
# ###### #
# # #
# # #
# +++ # #
# # #
# #
# #