This commit is contained in:
2026-06-21 22:04:10 -05:00
parent 475534f7c4
commit 87979ac610
7 changed files with 134 additions and 255 deletions
+8 -7
View File
@@ -71,10 +71,11 @@ pub(crate) enum Action {
/// 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)>),
/// Shift a set of cells, given as `(x, y)` coordinates: each cell moves to the
/// next coordinate in the list, unless it can't move, or that cell is blocked.
/// Rotates the contents of the last cell back to the beginning.
/// Zero time cost.
Shift(Vec<(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),
@@ -182,9 +183,9 @@ pub(crate) fn action_to_map(action: &Action) -> rhai::Map {
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"));
// Shift cells are not inspectable via the queue map API; emit type only.
Action::Shift(_) => {
m.insert("type".into(), ds("Shift"));
}
Action::AddGems(n) => {
m.insert("type".into(), ds("AddGems"));