Better error messages when properties are missing from levels
This commit is contained in:
parent
7b5206b4b2
commit
0849e5c85a
1 changed files with 21 additions and 15 deletions
|
@ -604,38 +604,44 @@ the default ORIENTATION value of 'orthogonal' is supported."
|
|||
(properties (map-object-properties obj))
|
||||
(r (map-object-shape obj))
|
||||
(x (/ (rect-x r) tw))
|
||||
(y (/ (rect-y r) th)))
|
||||
(y (/ (rect-y r) th))
|
||||
(property-ref
|
||||
(lambda (key)
|
||||
(or (assq-ref properties key)
|
||||
(and (not (assq key properties))
|
||||
(error "Property missing:"
|
||||
key 'on type 'at x y))))))
|
||||
(match type
|
||||
('player-spawn (list x y obj:player-spawn))
|
||||
('block
|
||||
(match (assq-ref properties 'kind)
|
||||
(match (property-ref 'kind)
|
||||
("crate" (list x y obj:block:crate))
|
||||
("copper" (list x y obj:block:copper))
|
||||
(kind (error "unsupported block kind" kind))))
|
||||
('floor-switch (list x y obj:floor-switch
|
||||
(assq-ref properties 'target-x)
|
||||
(assq-ref properties 'target-y)))
|
||||
(property-ref 'target-x)
|
||||
(property-ref '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)))
|
||||
(property-ref 'interval)))
|
||||
('switched-emitter (list x y obj:switched-emitter
|
||||
(assq-ref properties 'interval)))
|
||||
(property-ref 'interval)))
|
||||
('and-gate (list x y obj:and-gate
|
||||
(parse-direction
|
||||
(assq-ref properties 'direction))))
|
||||
(property-ref 'direction))))
|
||||
('xor-gate (list x y obj:xor-gate
|
||||
(parse-direction
|
||||
(assq-ref properties 'direction))))
|
||||
(property-ref 'direction))))
|
||||
('or-gate (list x y obj:or-gate
|
||||
(parse-direction
|
||||
(assq-ref properties 'direction))))
|
||||
(property-ref 'direction))))
|
||||
('electric-switch (list x y obj:electric-switch
|
||||
(assq-ref properties 'target-x)
|
||||
(assq-ref properties 'target-y)))
|
||||
(property-ref 'target-x)
|
||||
(property-ref 'target-y)))
|
||||
('electron-warp (list x y obj:electron-warp
|
||||
(assq-ref properties 'target-x)
|
||||
(assq-ref properties 'target-y)))
|
||||
(property-ref 'target-x)
|
||||
(property-ref 'target-y)))
|
||||
('bomb (list x y obj:bomb))
|
||||
('brick (list x y obj:brick))
|
||||
(_ (error "unsupported object type" type)))))
|
||||
|
@ -662,7 +668,7 @@ the default ORIENTATION value of 'orthogonal' is supported."
|
|||
,(compile-tile-layer tile-map "background")
|
||||
,(u8-list->bytevector
|
||||
(append
|
||||
(compile-environment-layer tile-map "background")
|
||||
(compile-object-layer tile-map "objects")))
|
||||
(pk 'tmap (compile-environment-layer tile-map "background"))
|
||||
(pk 'ol (compile-object-layer tile-map "objects"))))
|
||||
collected-gem?))))))
|
||||
(_ (error "file name expected")))
|
||||
|
|
Loading…
Add table
Reference in a new issue