Fix Neut Tower map editor

This commit is contained in:
Jeremy Penner 2021-06-25 22:41:00 -04:00
parent 4024abd074
commit 8aeea9aaad
2 changed files with 14 additions and 8 deletions

View file

@ -115,7 +115,7 @@
(local itile (self:itile-from-xy mx my)) (local itile (self:itile-from-xy mx my))
(local iobject (self:iobject-from-xy mx my)) (local iobject (self:iobject-from-xy mx my))
(when (= self.itile nil) (when (= self.itile nil)
(let [player :player] (each [_ player (ipairs (or files.game.players [:player]))]
(match (. self.level player) (match (. self.level player)
{:x mx :y my} (renderer.draw_text style.font player tilex tiley style.text))) {:x mx :y my} (renderer.draw_text style.font player tilex tiley style.text)))
(love.graphics.setColor 1 1 1)) (love.graphics.setColor 1 1 1))
@ -247,12 +247,18 @@
(let [(checked y-new) (checkbox self "Edit objects" (= self.itile nil) x (+ y style.padding.y)) (let [(checked y-new) (checkbox self "Edit objects" (= self.itile nil) x (+ y style.padding.y))
_ (when checked _ (when checked
(set self.itile nil) (set self.itile nil)
(set self.playerpos nil)) (set self.playerpos nil))]
(checked y-new) (checkbox self (.. "Position " :player) (and (= self.itile nil) (= self.playerpos :player)) x (+ y-new style.padding.y))] (set y y-new)
(when checked (each [_ player (ipairs (or files.game.players [:player]))]
(set self.itile nil) (let [(checked y-new) (checkbox self (.. "Position " player) (and (= self.itile nil) (= self.playerpos player)) x (+ y style.padding.y))]
(set self.playerpos :player)) (when checked
(set y y-new)) (set self.itile nil)
(set self.playerpos player))
(set y y-new))))
(each [_ levelflag (ipairs (or files.game.levelflags []))]
(let [(checked y-new) (checkbox self levelflag (. self.level levelflag) x (+ y style.padding.y))]
(when checked (tset self.level levelflag (not (. self.level levelflag))))
(set y y-new)))
(when self.iobject (when self.iobject
(set y (math.max y (if (> self.size.x (+ (* tilew mapw) 300)) (set y (math.max y (if (> self.size.x (+ (* tilew mapw) 300))
(self:draw-object-editor (+ x (* tilew mapw) style.padding.x) ytop) (self:draw-object-editor (+ x (* tilew mapw) style.padding.x) ytop)

File diff suppressed because one or more lines are too long