lint.fnl 848 Bytes
Newer Older
1
(local lume (require :lib.lume))
2

Phil Hagelberg's avatar
Phil Hagelberg committed
3
(local invisibles [:furniture-starts :enemy-starts :player :goal :patrols
Phil Hagelberg's avatar
Phil Hagelberg committed
4
                   :messages :blockers])
5 6 7

(fn [map]
  (let [layers {}]
8
    (each [_ layer (ipairs map.layers)]
9 10 11 12 13 14 15
      (tset layers layer.name layer))
    ;; it's easy to forget to set these layers to invisible in tiled.
    ;; why not just force them invisible here?
    (each [_ invisible (ipairs invisibles)]
      (tset (. layers invisible) :visible false))
    ;; make sure every enemy has a patrol-id that actually exists
    (let [patrols {}]
16
      (each [_ patrol (ipairs layers.patrols.objects)]
17
        (tset patrols patrol.id patrol))
18
      (each [_ enemy (ipairs layers.enemy-starts.objects)]
19
        (assert (. patrols enemy.properties.patrol-id)
20 21
                (.. "patrol not found: " enemy.properties.patrol-id))))
    map))