Allow bombs to be activated by switches

This commit is contained in:
Juliana Sims 2024-05-25 13:53:41 -04:00
parent 133fdb5752
commit 7b5206b4b2
No known key found for this signature in database
GPG key ID: 2A00BD4B0090029E

View file

@ -357,6 +357,8 @@
(define alive? (spawn ^cell #t)) (define alive? (spawn ^cell #t))
(define countdown (spawn ^cell -1)) (define countdown (spawn ^cell -1))
(define pushed? (spawn ^cell)) (define pushed? (spawn ^cell))
(define* (light-fuse #:optional (time 2))
($ countdown time))
(match-lambda* (match-lambda*
(('type) 'bomb) (('type) 'bomb)
(('position) ($ position)) (('position) ($ position))
@ -392,10 +394,12 @@
(('update-wire-state grid-info neighbor-grid) (('update-wire-state grid-info neighbor-grid)
(when (and (< ($ countdown) 0) (when (and (< ($ countdown) 0)
(grid-electrified? neighbor-grid)) (grid-electrified? neighbor-grid))
($ countdown 2))) (light-fuse)))
(('alive?) ($ alive?)) (('alive?) ($ alive?))
(('describe) `(bomb ,($ position) ,($ countdown))) (('describe) `(bomb ,($ position) ,($ countdown)))
(('explode) ($ countdown 2)) (('explode) (light-fuse 1))
(('activate grid-info) (light-fuse))
(('deactivate grid-info) #f)
(('collide other offset grid-info) (('collide other offset grid-info)
(when (eq? ($ other 'type) 'player) (when (eq? ($ other 'type) 'player)
(match ($ position) (match ($ position)