diff --git a/app.lua b/app.lua index 8d4cb87..26e71d3 100644 --- a/app.lua +++ b/app.lua @@ -38,7 +38,7 @@ app:match("/map/render", function(self) self.tiles[h][i] = map:find({x = h, y = i}) -- The map database has floor_stone and wall_floor instead of simple ASCII characters -- So we run mapFunc:mapDecrypt to convert it back to the desired characters for visual display - self.tiles[h][i].occupied_by_type = mapFunc:mapDecrypt(self.tiles[h][i].occupied_by_type) + self.tiles[h][i].occupied_by_type = mapFunc:mapDecrypt(self.tiles[h][i].occupied_by_type)[1] end end return {render = "map", layout = false} diff --git a/lua_scripts/map.lua b/lua_scripts/map.lua index 7eb7dc5..ad2e657 100644 --- a/lua_scripts/map.lua +++ b/lua_scripts/map.lua @@ -19,11 +19,26 @@ local map = { end end, mapDecrypt = function(self, tile) - if tile == "floor_stone" then - return "-" - elseif tile == "wall_stone" then - return "w" - end + -- TODO: Rework function so it returns both char and mat type + -- This introduces breaking changes + local tileset = {} + if string.find(tile, "wall") then + tileset[1] = "w" + elseif string.find(tile, "floor") then + tileset[1] = "-" + end + if string.find(tile, "stone") then + tileset[2] = "stone" + elseif string.find(tile, "wood") then + tileset[2] = "wood" + end + return tileset + + -- if tile == "floor_stone" then + -- return "-" + -- elseif tile == "wall_stone" then + -- return "w" + -- end end, -- Map Populate / check if map exists populate = function(self, map) @@ -46,8 +61,6 @@ local map = { return true end end, - tileColor = function(self) - end } local tiles = {}