Big API refactor
This commit is contained in:
@@ -6,17 +6,17 @@
|
||||
// pusher shares one compiled copy and learns its direction from the
|
||||
// `BUILTIN_pusher_<dir>` tag the map loader attached to it.
|
||||
|
||||
fn tick(dt) {
|
||||
fn tick(me, state, dt) {
|
||||
// Only queue a step when idle. `move` shoves the chain ahead via step_object
|
||||
// and is a no-op when blocked; the delay pads each step out to ~0.5s (move
|
||||
// itself costs 0.25s), matching the old global pusher heartbeat.
|
||||
//
|
||||
// The direction is read here, at the top level of the hook, because `Me` is a
|
||||
// per-object scope constant and is not visible inside other script functions.
|
||||
if Queue.length() == 0 {
|
||||
let dir = if Me.has_tag("BUILTIN_pusher_north") { North }
|
||||
else if Me.has_tag("BUILTIN_pusher_south") { South }
|
||||
else if Me.has_tag("BUILTIN_pusher_east") { East }
|
||||
if !me.waiting {
|
||||
let dir = if me.has_tag("BUILTIN_pusher_north") { North }
|
||||
else if me.has_tag("BUILTIN_pusher_south") { South }
|
||||
else if me.has_tag("BUILTIN_pusher_east") { East }
|
||||
else { West };
|
||||
move(dir);
|
||||
delay(0.25);
|
||||
|
||||
Reference in New Issue
Block a user