fixed initialization display bugs on game page
This commit is contained in:
parent
e0e6c30752
commit
d9610bea3b
8
app.lua
8
app.lua
@ -79,12 +79,13 @@ app:match("/map/render", function(self)
|
|||||||
for i = 1, 10 do
|
for i = 1, 10 do
|
||||||
-- The map database has floor_stone and wall_floor instead of simple ASCII characters
|
-- 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
|
-- So we run mapFunc:mapDecrypt to convert it back to the desired characters for visual display
|
||||||
local tile = map:find({ x = h, y = i })
|
local tile = map:find({ x = h, y = i, game_ref = self.session.gameref })
|
||||||
self.tiles[h][i] = mapFunc:mapDecrypt(tile.occupied_by_type)
|
self.tiles[h][i] = mapFunc:mapDecrypt(tile.occupied_by_type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return { render = "map", layout = false }
|
return { render = "map", layout = false }
|
||||||
end
|
end
|
||||||
|
return { layout = false }
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
@ -146,6 +147,11 @@ return app
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BIN
database.sqlite3
BIN
database.sqlite3
Binary file not shown.
6
setup_db
6
setup_db
@ -29,6 +29,10 @@ sqlite3 database.sqlite3 "
|
|||||||
);
|
);
|
||||||
CREATE TABLE IF NOT EXISTS players (
|
CREATE TABLE IF NOT EXISTS players (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
player_name TEXT
|
player_name TEXT,
|
||||||
|
x INTEGER,
|
||||||
|
y INTEGER,
|
||||||
|
health INTEGER,
|
||||||
|
game_ref INTEGER
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
|
@ -2,14 +2,21 @@
|
|||||||
<script src="/static/htmx.min.js"></script>
|
<script src="/static/htmx.min.js"></script>
|
||||||
<% if not isPopulated then %>
|
<% if not isPopulated then %>
|
||||||
<div id="clickable">
|
<div id="clickable">
|
||||||
<button hx-post="/clickme" hx-target="#clickable">Start</button>
|
<button hx-post="/clickme" hx-target="#clickable" onclick="location.reload()">Start</button>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<article class="container-fluid">
|
<article class="container-fluid">
|
||||||
<p style="text-align: center;">Game</p>
|
<div class="grid">
|
||||||
<main style="width: 50%;" class="container" id="map" hx-get="/map/render" hx-trigger="every 10s,load">
|
<script></script>
|
||||||
</main>
|
<% if isPopulated then %>
|
||||||
<div>
|
<div>
|
||||||
<% render("views.player_ui") %>
|
<p style="text-align: center;">Map</p>
|
||||||
|
<main style="width: 50%;" class="container" id="map" hx-get="/map/render" hx-trigger="every 5s,load">
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<div>
|
||||||
|
<% render("views.player_ui") %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
Loading…
Reference in New Issue
Block a user