spinners and gems
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user