Compare commits

...

2 Commits

Author SHA1 Message Date
40afb93d61 added base-level multi-client support to table 2024-03-20 15:29:41 -05:00
eb8db81789 restored mapCrypt looping 2024-03-20 15:29:00 -05:00
5 changed files with 39 additions and 18 deletions

Binary file not shown.

View File

@ -4,21 +4,30 @@ local map = {
{ "-", "_", "w", "w", "-", "-", "-", "-", "-", "-" },
{ "-", "-", "w", "w", "-", "w", "-", "-", "-", "-" },
{ "w", "-", "-", "-", "w", "w", "-", "-", "-", "-" },
{ "w", "-", "w", "-", "-", "w", "w", "w", "-", "-" },
{ "w", "-", "w", "-", "-", "w", "-", "-", "-", "-" },
{ "-", "-", "w", "-", "-", "w", "-", "w", "-", "-" },
{ "w", "-", "ww", "-", "-", "w", "w", "w", "-", "-" },
{ "w", "-", "ww", "-", "-", "w", "-", "-", "-", "-" },
{ "-", "-", "ww", "-", "-", "w", "-", "w", "-", "-" },
{ "-", "-", "-", "-", "-", "-", "-", "w", "-", "-" },
{ "-", "-", "w", "-", "-", "-", "-", "w", "w", "-" },
{ "-", "-", "w", "-", "-", "-", "-", "-", "w", "-" }
{ "-", "-", "ww", "-", "-", "-", "-", "w", "w", "-" },
{ "-", "-", "ww", "-", "-", "-", "-", "-", "w", "-" }
},
tileset = {
display = { "-", "_", "w", "ww" },
db = { "floor_stone,", "floor_wood", "wall_stone", "wall_wood" }
},
mapCrypt = function(self, tile)
if tile == "-" then
return "floor_stone"
elseif tile == "_" then
return "floor_wood"
elseif tile == "w" then
return "wall_stone"
for i=1, #self.tileset.display do
if self.tileset.display[i] == tile then
return self.tileset.db[i]
end
end
--if tile == "-" then
-- return "floor_stone"
--elseif tile == "_" then
-- return "floor_wood"
--elseif tile == "w" then
-- return "wall_stone"
--end
end,
mapDecrypt = function(self, tile)
-- TODO: Rework function so it returns both char and mat type

View File

@ -6,19 +6,29 @@ sqlite3 database.sqlite3 "
x TEXT,
y TEXT,
occupied_by_type TEXT,
occupied_by_id INTEGER
occupied_by_id INTEGER,
game_ref INTEGER
);
CREATE TABLE IF NOT EXISTS entity_ref (
id INTEGER PRIMARY KEY AUTOINCREMENT,
entity_id INTEGER,
type TEXT,
hp INTEGER,
inventory_ref INTEGER
inventory_ref INTEGER,
game_ref INTEGER
);
CREATE TABLE IF NOT EXISTS player_inventory (
id INTEGER PRIMARY KEY AUTOINCREMENT,
type TEXT,
quantity INTEGER,
func_ref TEXT
game_ref INTEGER
);
CREATE TABLE IF NOT EXISTS games (
id INTEGER PRIMARY KEY AUTOINCREMENT,
player_id INTEGER
);
CREATE TABLE IF NOT EXISTS players (
id INTEGER PRIMARY KEY AUTOINCREMENT,
player_name TEXT
)
"

View File

@ -1,5 +1,10 @@
<!DOCTYPE HTML>
<script src="/static/htmx.min.js"></script>
<% if not isPopulated then %>
<div id="clickable">
<button hx-post="/clickme" hx-target="#clickable">Start</button>
</div>
<% end %>
<article>
<p style="text-align: center;">Game</p>
<main style="width: 50%;" class="container" id="map" hx-get="/map/render" hx-trigger="every 1s,load">

View File

@ -6,10 +6,7 @@
</div>
<% end %>
<article>
<p style="text-align: center;">Game</p>
<main style="width: 50%;" class="container" id="map" hx-get="/map/render" hx-trigger="every 1s,load">
</article>
<a href="/game">Play Now</a>
</main>