Implement interval logic for emitters

This commit is contained in:
Juliana Sims 2024-05-23 16:28:53 -04:00
parent 65076c40f3
commit 13aa8606a9
6 changed files with 65 additions and 30 deletions

View file

@ -575,22 +575,21 @@ the default ORIENTATION value of 'orthogonal' is supported."
(layer (tile-map-layer-ref tile-map layer-name)))
(append-map (lambda (y)
(concatenate
(filter-map (lambda (x)
(match (tile-layer-ref layer x y)
(#f #f)
((= map-tile-ref tile)
(match (tile-type tile)
(#f #f)
("wall"
(match (assq-ref (tile-properties tile) 'kind)
("brick" (list x y obj:wall:brick))
("copper" (list x y obj:wall:copper))
(kind (error "unsupported wall kind" kind))))
("exit" (list x y obj:exit))
("clock-emitter" (list x y obj:clock-emitter))
("switched-emitter" (list x y obj:switched-emitter))
(type (error "unsupported background object" type))))))
(iota (tile-layer-width layer)))))
(filter-map
(lambda (x)
(match (tile-layer-ref layer x y)
(#f #f)
((= map-tile-ref tile)
(match (tile-type tile)
(#f #f)
("wall"
(match (assq-ref (tile-properties tile) 'kind)
("brick" (list x y obj:wall:brick))
("copper" (list x y obj:wall:copper))
(kind (error "unsupported wall kind" kind))))
("exit" (list x y obj:exit))
(type (error "unsupported background object" type))))))
(iota (tile-layer-width layer)))))
(iota (tile-layer-height layer)))))
(define (compile-object-layer tile-map layer-name)
@ -621,6 +620,10 @@ the default ORIENTATION value of 'orthogonal' is supported."
(assq-ref properties 'target-y)))
('gem (list x y obj:gem))
('gate (list x y obj:gate))
('clock-emitter (list x y obj:clock-emitter
(assq-ref properties 'interval)))
('switched-emitter (list x y obj:switched-emitter
(assq-ref properties 'interval)))
('and-gate (list x y obj:and-gate
(parse-direction
(assq-ref properties 'direction))))