spinners and gems

This commit is contained in:
2026-06-21 18:27:45 -05:00
parent 9b53552f4a
commit d4b9278838
17 changed files with 626 additions and 56 deletions
+13
View File
@@ -75,6 +75,12 @@ pub(crate) enum Action {
/// 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)>),
/// Add `n` to the player's gem count (negative subtracts; the count is
/// clamped at 0). Zero time cost. Applied to `GameState::player_gems`.
AddGems(i64),
/// Remove the source object from the board. Zero time cost. Used by grab
/// things (e.g. gems) to despawn themselves from their `grab()` hook.
Die,
}
// ── Direction helper ──────────────────────────────────────────────────────────
@@ -180,6 +186,13 @@ pub(crate) fn action_to_map(action: &Action) -> rhai::Map {
Action::Swap(_) => {
m.insert("type".into(), ds("Swap"));
}
Action::AddGems(n) => {
m.insert("type".into(), ds("AddGems"));
m.insert("n".into(), Dynamic::from(*n));
}
Action::Die => {
m.insert("type".into(), ds("Die"));
}
}
m
}