spinners and fmt

This commit is contained in:
2026-06-21 01:32:47 -05:00
parent d32914d99d
commit 8e90084b53
31 changed files with 1445 additions and 284 deletions
+5 -21
View File
@@ -144,7 +144,6 @@ pub(crate) struct ObjectTemplate {
pub opaque: bool,
pub pushable: bool,
pub script_name: Option<String>,
pub builtin_script: Option<&'static str>,
pub tags: Vec<String>,
pub name: Option<String>,
}
@@ -214,7 +213,6 @@ fn resolve_entry(ch: char, e: &PaletteEntry, errors: &mut Vec<LogLine>) -> Resol
opaque: e.opaque.unwrap_or(true),
pushable: e.pushable.unwrap_or(false),
script_name: e.script_name.clone(),
builtin_script: None,
tags: e.tags.clone().unwrap_or_default(),
name: e.name.clone(),
}),
@@ -234,26 +232,12 @@ fn resolve_entry(ch: char, e: &PaletteEntry, errors: &mut Vec<LogLine>) -> Resol
}
},
"player" => Resolved::Player,
// Any other kind must be an archetype name.
// Any other kind must be an archetype name. Script-backed archetypes (e.g.
// pushers/spinners) load as a plain terrain cell here and are turned into
// their scripted objects afterward by `Board::expand_builtin_archetypes`
// (called from `TryFrom<MapFile>`), so the expansion lives in one place.
other => match Archetype::try_from(other) {
// Script-backed archetypes (e.g. pushers) expand into an object carrying
// the embedded script plus a `BUILTIN_<archetype>` tag the script reads.
Ok(a) => match crate::builtin_scripts::archetype_script(a) {
Some(src) => {
let b = a.behavior();
Resolved::Object(ObjectTemplate {
glyph: glyph_with_default(a.default_glyph()),
solid: b.solid,
opaque: b.opaque,
pushable: false,
script_name: None,
builtin_script: Some(src),
tags: vec![crate::builtin_scripts::builtin_tag(a)],
name: None,
})
}
None => Resolved::Cell(glyph_with_default(a.default_glyph()), a),
},
Ok(a) => Resolved::Cell(glyph_with_default(a.default_glyph()), a),
Err(msg) => {
errors.push(LogLine::error(format!(
"palette '{ch}': {msg}; using error block"