Compare commits
No commits in common. "d7bc833df70ca8014b9f2aafb9c78109858fc0cd" and "dab56a3f8c1762da2377ad2b4e9a7747157e28a5" have entirely different histories.
d7bc833df7
...
dab56a3f8c
5
app.lua
5
app.lua
@ -35,13 +35,14 @@ app:match("/map/render", function(self)
|
||||
for h=1,10 do
|
||||
self.tiles[h] = {}
|
||||
for i=1,10 do
|
||||
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
|
||||
local tile = map:find({ x = h, y = i })
|
||||
self.tiles[h][i] = mapFunc:mapDecrypt(tile.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}
|
||||
end)
|
||||
|
||||
return app
|
||||
|
||||
|
@ -23,14 +23,14 @@ local map = {
|
||||
-- This introduces breaking changes
|
||||
local tileset = {}
|
||||
if string.find(tile, "wall") then
|
||||
tileset.char = "w"
|
||||
tileset[1] = "w"
|
||||
elseif string.find(tile, "floor") then
|
||||
tileset.char = "-"
|
||||
tileset[1] = "-"
|
||||
end
|
||||
if string.find(tile, "stone") then
|
||||
tileset.material = "stone"
|
||||
tileset[2] = "stone"
|
||||
elseif string.find(tile, "wood") then
|
||||
tileset.material = "wood"
|
||||
tileset[2] = "wood"
|
||||
end
|
||||
return tileset
|
||||
|
||||
@ -62,5 +62,20 @@ local map = {
|
||||
end
|
||||
end,
|
||||
}
|
||||
local tiles = {}
|
||||
|
||||
return map
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<% for h=1,10 do %>
|
||||
<div class="grid">
|
||||
<% for i=1,10 do %>
|
||||
<div><%= tiles[h][i].char %></div>
|
||||
<div><%= tiles[h][i].occupied_by_type %></div>
|
||||
<% end %>
|
||||
<br>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user