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
+17
View File
@@ -68,6 +68,13 @@ pub(crate) enum Action {
/// the source is solid and the destination already has a solid occupant.
/// Zero time cost — multiple teleports may fire in one frame.
Teleport { x: i32, y: i32 },
/// Shove the pushable chain starting at `(x, y)` one step in `dir` (acts on
/// arbitrary cells, not the source object). Zero time cost.
Push { x: i32, y: i32, dir: Direction },
/// Apply a batch of one-way solid moves simultaneously (read-all, then
/// write-all, so cycles/swaps work). Each tuple is `(src_x, src_y, dst_x,
/// dst_y)`. Zero time cost.
Swap(Vec<(i32, i32, i32, i32)>),
}
// ── Direction helper ──────────────────────────────────────────────────────────
@@ -163,6 +170,16 @@ pub(crate) fn action_to_map(action: &Action) -> rhai::Map {
m.insert("x".into(), Dynamic::from(*x as i64));
m.insert("y".into(), Dynamic::from(*y as i64));
}
Action::Push { x, y, dir } => {
m.insert("type".into(), ds("Push"));
m.insert("x".into(), Dynamic::from(*x as i64));
m.insert("y".into(), Dynamic::from(*y as i64));
m.insert("dir".into(), ds(dir_to_str(*dir)));
}
// Swap pairs are not inspectable via the queue map API; emit type only.
Action::Swap(_) => {
m.insert("type".into(), ds("Swap"));
}
}
m
}