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", "w", "-", "-" }, { "w", "-", "ww", "-", "-", "w", "w", "w", "-", "-" },
{ "w", "-", "w", "-", "-", "w", "-", "-", "-", "-" }, { "w", "-", "ww", "-", "-", "w", "-", "-", "-", "-" },
{ "-", "-", "w", "-", "-", "w", "-", "w", "-", "-" }, { "-", "-", "ww", "-", "-", "w", "-", "w", "-", "-" },
{ "-", "-", "-", "-", "-", "-", "-", "w", "-", "-" }, { "-", "-", "-", "-", "-", "-", "-", "w", "-", "-" },
{ "-", "-", "w", "-", "-", "-", "-", "w", "w", "-" }, { "-", "-", "ww", "-", "-", "-", "-", "w", "w", "-" },
{ "-", "-", "w", "-", "-", "-", "-", "-", "w", "-" } { "-", "-", "ww", "-", "-", "-", "-", "-", "w", "-" }
},
tileset = {
display = { "-", "_", "w", "ww" },
db = { "floor_stone,", "floor_wood", "wall_stone", "wall_wood" }
}, },
mapCrypt = function(self, tile) mapCrypt = function(self, tile)
if tile == "-" then for i=1, #self.tileset.display do
return "floor_stone" if self.tileset.display[i] == tile then
elseif tile == "_" then return self.tileset.db[i]
return "floor_wood" end
elseif tile == "w" then
return "wall_stone"
end end
--if tile == "-" then
-- return "floor_stone"
--elseif tile == "_" then
-- return "floor_wood"
--elseif tile == "w" then
-- return "wall_stone"
--end
end, end,
mapDecrypt = function(self, tile) mapDecrypt = function(self, tile)
-- TODO: Rework function so it returns both char and mat type -- TODO: Rework function so it returns both char and mat type

View File

@ -6,19 +6,29 @@ sqlite3 database.sqlite3 "
x TEXT, x TEXT,
y TEXT, y TEXT,
occupied_by_type TEXT, occupied_by_type TEXT,
occupied_by_id INTEGER occupied_by_id INTEGER,
game_ref INTEGER
); );
CREATE TABLE IF NOT EXISTS entity_ref ( CREATE TABLE IF NOT EXISTS entity_ref (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,
entity_id INTEGER, entity_id INTEGER,
type TEXT, type TEXT,
hp INTEGER, hp INTEGER,
inventory_ref INTEGER inventory_ref INTEGER,
game_ref INTEGER
); );
CREATE TABLE IF NOT EXISTS player_inventory ( CREATE TABLE IF NOT EXISTS player_inventory (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,
type TEXT, type TEXT,
quantity INTEGER, 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> <!DOCTYPE HTML>
<script src="/static/htmx.min.js"></script> <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> <article>
<p style="text-align: center;">Game</p> <p style="text-align: center;">Game</p>
<main style="width: 50%;" class="container" id="map" hx-get="/map/render" hx-trigger="every 1s,load"> <main style="width: 50%;" class="container" id="map" hx-get="/map/render" hx-trigger="every 1s,load">

View File

@ -6,10 +6,7 @@
</div> </div>
<% end %> <% end %>
<article> <a href="/game">Play Now</a>
<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>
</main> </main>