Commit 04a0c5cc1c5eec9c8276a25374bbcd59f6628dc5

Authored by DarkGod
2 parents 70290456 10ff3399

Merge branch 'chest_graphics_fix' into 'master'

Fix chest graphics bug

Fixes the bug that occurs when golden chests spawn on tiles that already have `add_mos` additional graphics. Since the golden chest expects the chest graphic to be in a particular spot in the list, the act of replacing graphics with the "open chest" often creates unusual behavior like giant open chests.

**This MR is save safe.**

See merge request !799
... ... @@ -96,10 +96,14 @@ g.block_move = function(self, x, y, who, act, couldpass)
96 96 self.autoexplore_ignore = true
97 97 self.name = _t"glowing chest (opened)"
98 98
99   - if self.add_displays and self.add_displays[1] then
100   - self.add_displays[1].image = "object/chestopen3.png"
101   - self:removeAllMOs()
102   - game.level.map:updateMap(x, y)
  99 + if self.add_displays then
  100 + for k, v in ipairs(self.add_displays) do
  101 + if v.image and v.image == "object/chest3.png" then
  102 + v.image = "object/chestopen3.png"
  103 + self:removeAllMOs()
  104 + game.level.map:updateMap(x, y)
  105 + end
  106 + end
103 107 end
104 108 end end, _t"Open", _t"Leave")
105 109
... ...