Registry refactor and clear queues on board entry
This commit is contained in:
+6
-5
@@ -23,15 +23,16 @@ fn tick(me, state, dt) {
|
||||
|
||||
mover = """
|
||||
fn init(me, state) {
|
||||
if Registry.get("dancer_x") != () {
|
||||
let new_x = Registry.get("dancer_x");
|
||||
let new_y = Registry.get("dancer_y");
|
||||
log(`q: ${me.queue.length}`);
|
||||
if Board.registry.get("dancer_x") != () {
|
||||
let new_x = Board.registry.get("dancer_x");
|
||||
let new_y = Board.registry.get("dancer_y");
|
||||
if me.x != new_x || me.y != new_y {
|
||||
teleport(new_x, new_y);
|
||||
}
|
||||
} else {
|
||||
Registry.set("dancer_x", me.x);
|
||||
Registry.set("dancer_y", me.y);
|
||||
Board.registry.set("dancer_x", me.x);
|
||||
Board.registry.set("dancer_y", me.y);
|
||||
log(`Set reg to ${me.x} ${me.y}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user