Allow bombs to be activated by switches
This commit is contained in:
parent
133fdb5752
commit
7b5206b4b2
1 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue