Allow blocks to be pushed through gates.
This commit is contained in:
parent
808ccd247c
commit
1cb85bd682
1 changed files with 11 additions and 8 deletions
|
@ -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))
|
|
||||||
($ grid-info 'occupants x y))))
|
|
||||||
(match occupant-types
|
|
||||||
((or () ('switch))
|
|
||||||
($ pushed? #t)
|
($ pushed? #t)
|
||||||
($ position (vector x y z)))
|
($ position (vector x y z)))
|
||||||
(_ #f))))))))))))
|
(match ($ grid-info 'occupants x y)
|
||||||
|
(() (do-push))
|
||||||
|
((obj)
|
||||||
|
(match ($ obj 'type)
|
||||||
|
('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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue