Allow block to be pushed onto tile with gate that is being switched on/off.
This commit is contained in:
parent
3e79c279a8
commit
049e859dac
1 changed files with 21 additions and 23 deletions
|
@ -128,6 +128,8 @@
|
|||
(('post-tick grid-info) #f)
|
||||
(('enter obj grid-info) #f)
|
||||
(('exit obj grid-info) #f)
|
||||
(('activate grid-info) #f)
|
||||
(('deactivate grid-info) #f)
|
||||
(('wire-state grid-info from from-x from-y)
|
||||
(match type
|
||||
((or 'copper 'electron-head 'electron-tail)
|
||||
|
@ -228,14 +230,14 @@
|
|||
(('describe) `(switched-emitter ,position ,(wire-state)))
|
||||
(('collide other offset grid-info) #f)))
|
||||
|
||||
(define (first-non-player-occupant grid-info x y)
|
||||
(define (non-player-occupants grid-info x y)
|
||||
(let lp ((objs ($ grid-info 'occupants x y)))
|
||||
(match objs
|
||||
(() #f)
|
||||
(() '())
|
||||
((obj . rest)
|
||||
(if (eq? ($ obj 'type) 'player)
|
||||
(lp rest)
|
||||
obj)))))
|
||||
(cons obj (lp rest)))))))
|
||||
|
||||
(define (^floor-switch bcom x y target-x target-y)
|
||||
(define position (vector x y 0))
|
||||
|
@ -250,22 +252,20 @@
|
|||
(('exit obj grid-info)
|
||||
(when (= (length ($ grid-info 'occupants x y)) 1)
|
||||
($ on? #f)
|
||||
(match (first-non-player-occupant grid-info target-x target-y)
|
||||
(#f (pk "no switch target!"))
|
||||
(target
|
||||
($ grid-info 'append-event `(floor-switch-off ,x ,y))
|
||||
($ target 'deactivate grid-info)))))
|
||||
(for-each (lambda (obj)
|
||||
($ grid-info 'append-event `(floor-switch-off ,x ,y))
|
||||
($ obj 'deactivate grid-info))
|
||||
(non-player-occupants grid-info target-x target-y))))
|
||||
(('wire-state grid-info from from-x from-y) #f)
|
||||
(('update-wire-state grid-info neighbor-grid) #f)
|
||||
(('alive?) #t)
|
||||
(('describe) `(floor-switch ,position ,($ on?)))
|
||||
(('collide other offset grid-info)
|
||||
($ on? #t)
|
||||
(match (first-non-player-occupant grid-info target-x target-y)
|
||||
(#f (pk "no switch target!"))
|
||||
(target
|
||||
($ grid-info 'append-event `(floor-switch-on ,x ,y))
|
||||
($ target 'activate grid-info))))))
|
||||
(for-each (lambda (obj)
|
||||
($ grid-info 'append-event `(floor-switch-on ,x ,y))
|
||||
($ obj 'activate grid-info))
|
||||
(non-player-occupants grid-info target-x target-y)))))
|
||||
|
||||
(define (^electric-switch bcom x y target-x target-y)
|
||||
(define position (vector x y 0))
|
||||
|
@ -285,19 +285,17 @@
|
|||
($ timer t)
|
||||
(when (= t 0)
|
||||
($ on? #f)
|
||||
(match (first-non-player-occupant grid-info target-x target-y)
|
||||
(#f (pk "no switch target!"))
|
||||
(target
|
||||
($ grid-info 'append-event `(electric-switch-off ,x ,y))
|
||||
($ target 'deactivate grid-info)))))
|
||||
(for-each (lambda (obj)
|
||||
($ grid-info 'append-event `(electic-switch-off ,x ,y))
|
||||
($ obj 'deactivate grid-info))
|
||||
(non-player-occupants grid-info target-x target-y))))
|
||||
(when (>= (electron-head-count neighbor-grid) 1)
|
||||
($ on? #t)
|
||||
($ timer 2)
|
||||
(match (first-non-player-occupant grid-info target-x target-y)
|
||||
(#f (pk "no switch target!"))
|
||||
(target
|
||||
($ grid-info 'append-event `(electric-switch-on ,x ,y))
|
||||
($ target 'activate grid-info))))))
|
||||
(for-each (lambda (obj)
|
||||
($ grid-info 'append-event `(electic-switch-on ,x ,y))
|
||||
($ obj 'activate grid-info))
|
||||
(non-player-occupants grid-info target-x target-y)))))
|
||||
(('alive?) #t)
|
||||
(('describe) `(electric-switch ,position ,($ on?)))
|
||||
(('collide other offset grid-info) #f)))
|
||||
|
|
Loading…
Add table
Reference in a new issue