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))
|
(properties (map-object-properties obj))
|
||||||
(r (map-object-shape obj))
|
(r (map-object-shape obj))
|
||||||
(x (/ (rect-x r) tw))
|
(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
|
(match type
|
||||||
('player-spawn (list x y obj:player-spawn))
|
('player-spawn (list x y obj:player-spawn))
|
||||||
('block
|
('block
|
||||||
(match (assq-ref properties 'kind)
|
(match (property-ref 'kind)
|
||||||
("crate" (list x y obj:block:crate))
|
("crate" (list x y obj:block:crate))
|
||||||
("copper" (list x y obj:block:copper))
|
("copper" (list x y obj:block:copper))
|
||||||
(kind (error "unsupported block kind" kind))))
|
(kind (error "unsupported block kind" kind))))
|
||||||
('floor-switch (list x y obj:floor-switch
|
('floor-switch (list x y obj:floor-switch
|
||||||
(assq-ref properties 'target-x)
|
(property-ref 'target-x)
|
||||||
(assq-ref properties 'target-y)))
|
(property-ref 'target-y)))
|
||||||
('gem (list x y obj:gem))
|
('gem (list x y obj:gem))
|
||||||
('gate (list x y obj:gate))
|
('gate (list x y obj:gate))
|
||||||
('clock-emitter (list x y obj:clock-emitter
|
('clock-emitter (list x y obj:clock-emitter
|
||||||
(assq-ref properties 'interval)))
|
(property-ref 'interval)))
|
||||||
('switched-emitter (list x y obj:switched-emitter
|
('switched-emitter (list x y obj:switched-emitter
|
||||||
(assq-ref properties 'interval)))
|
(property-ref 'interval)))
|
||||||
('and-gate (list x y obj:and-gate
|
('and-gate (list x y obj:and-gate
|
||||||
(parse-direction
|
(parse-direction
|
||||||
(assq-ref properties 'direction))))
|
(property-ref 'direction))))
|
||||||
('xor-gate (list x y obj:xor-gate
|
('xor-gate (list x y obj:xor-gate
|
||||||
(parse-direction
|
(parse-direction
|
||||||
(assq-ref properties 'direction))))
|
(property-ref 'direction))))
|
||||||
('or-gate (list x y obj:or-gate
|
('or-gate (list x y obj:or-gate
|
||||||
(parse-direction
|
(parse-direction
|
||||||
(assq-ref properties 'direction))))
|
(property-ref 'direction))))
|
||||||
('electric-switch (list x y obj:electric-switch
|
('electric-switch (list x y obj:electric-switch
|
||||||
(assq-ref properties 'target-x)
|
(property-ref 'target-x)
|
||||||
(assq-ref properties 'target-y)))
|
(property-ref 'target-y)))
|
||||||
('electron-warp (list x y obj:electron-warp
|
('electron-warp (list x y obj:electron-warp
|
||||||
(assq-ref properties 'target-x)
|
(property-ref 'target-x)
|
||||||
(assq-ref properties 'target-y)))
|
(property-ref 'target-y)))
|
||||||
('bomb (list x y obj:bomb))
|
('bomb (list x y obj:bomb))
|
||||||
('brick (list x y obj:brick))
|
('brick (list x y obj:brick))
|
||||||
(_ (error "unsupported object type" type)))))
|
(_ (error "unsupported object type" type)))))
|
||||||
|
@ -662,7 +668,7 @@ the default ORIENTATION value of 'orthogonal' is supported."
|
||||||
,(compile-tile-layer tile-map "background")
|
,(compile-tile-layer tile-map "background")
|
||||||
,(u8-list->bytevector
|
,(u8-list->bytevector
|
||||||
(append
|
(append
|
||||||
(compile-environment-layer tile-map "background")
|
(pk 'tmap (compile-environment-layer tile-map "background"))
|
||||||
(compile-object-layer tile-map "objects")))
|
(pk 'ol (compile-object-layer tile-map "objects"))))
|
||||||
collected-gem?))))))
|
collected-gem?))))))
|
||||||
(_ (error "file name expected")))
|
(_ (error "file name expected")))
|
||||||
|
|
Loading…
Add table
Reference in a new issue