Allow blocks to be pushed through gates.

This commit is contained in:
David Thompson 2024-05-24 16:57:17 -04:00
parent 808ccd247c
commit 1cb85bd682

View file

@ -154,14 +154,17 @@
(#(w h) (#(w h)
(let ((x (modulo (+ x dx) w)) (let ((x (modulo (+ x dx) w))
(y (modulo (+ y dy) h))) (y (modulo (+ y dy) h)))
(let ((occupant-types (define (do-push)
(map (lambda (obj) ($ obj 'type)) ($ pushed? #t)
($ grid-info 'occupants x y)))) ($ position (vector x y z)))
(match occupant-types (match ($ grid-info 'occupants x y)
((or () ('switch)) (() (do-push))
($ pushed? #t) ((obj)
($ position (vector x y z))) (match ($ obj 'type)
(_ #f)))))))))))) ('switch (do-push))
('gate (when ($ obj 'open?) (do-push)))
(_ (values))))
(_ (values))))))))))))
(('pushed?) ($ pushed?)))) (('pushed?) ($ pushed?))))
(define (^clock-emitter bcom x y interval) (define (^clock-emitter bcom x y interval)