From 066ce2aaaac2509a976c4747f708588846ed543c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 18 Mar 2024 19:38:28 -0500 Subject: [PATCH] expanded tile descript in DB --- app.lua | 4 ++++ database.sqlite3 | Bin 20480 -> 20480 bytes lua_scripts/map.lua | 19 +++++++++++++++++-- views/index.etlua | 7 ++++++- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/app.lua b/app.lua index 36da22a..8d4cb87 100644 --- a/app.lua +++ b/app.lua @@ -24,6 +24,7 @@ end) app:get("/", function(self) self.text = say.hello() + self.isPopulated = mapFunc:mapExists(map) return {render = "index", } @@ -35,6 +36,9 @@ app:match("/map/render", function(self) 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 + self.tiles[h][i].occupied_by_type = mapFunc:mapDecrypt(self.tiles[h][i].occupied_by_type) end end return {render = "map", layout = false} diff --git a/database.sqlite3 b/database.sqlite3 index a3ee4113060656c99d9b0b8142f82a38a6093cc2..9b1bdcc3bf11e3a179ec0bf78c355c7bb459572d 100644 GIT binary patch literal 20480 zcmeI2J8WBJ6o7r>B=&tb_a+T#d0bQ4CM0R%_!+_@ZZIX}(KK~QQ=qOB-xN!ZoreP$ zB&0+vUCIIyES7pk9G??}MAvYvM7jQae*6Ev zUruBxXU|L*Dz39q-dN35oQUs$Pm+A&j^p$BE{pFr@!h!j#YJo5j`%5|>wmkv>^re6 z>Eh8={T-i~H!WjHT=0zxZ~-pB1-Jkg-~wEL3vdB0zyXKsFSCN;n4 zOr;l{)Va**$yu>{COw-O5ObC4n(JiJ=WBP?w{oRQp;B!u^#)e9O3T>|ccnI@$bH*` z{y=vqB<&onZB=YgEbs=JSFL1wO@3P&gJn&Rf9&?zHN4N=ShdZ9yV&nsOM7>JzqDA} z?dEz>d_2x>y6anRY1!R#*H8An=fU1mZq*$SEBm&4q(HZAOF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3vdB0zy-Jf7vKV1fC~H#Rkm%d diff --git a/lua_scripts/map.lua b/lua_scripts/map.lua index 1a9ac38..4ad34d8 100644 --- a/lua_scripts/map.lua +++ b/lua_scripts/map.lua @@ -11,13 +11,27 @@ local map = { {"-", "-", "w", "-", "-", "-", "-", "w", "w", "-"}, {"-", "-", "w", "-", "-", "-", "-", "-", "w", "-"} }, + mapCrypt = function(self, tile) + if tile == "-" then + return "floor_stone" + elseif tile == "w" then + return "wall_stone" + end + end, + mapDecrypt = function(self, tile) + if tile == "floor_stone" then + return "-" + elseif tile == "wall_stone" then + return "w" + end + end, populate = function(self, map) - for h=1,10 do + for h=1,10 do for i=1,10 do local tile = map:create({ x = h, y = i, - occupied_by_type = self.map_tiles[h][i], + occupied_by_type = self:mapCrypt(self.map_tiles[h][i]), occupied_by_id = "" }) end @@ -48,3 +62,4 @@ return map + diff --git a/views/index.etlua b/views/index.etlua index 8f9270b..5641aea 100644 --- a/views/index.etlua +++ b/views/index.etlua @@ -1,10 +1,15 @@ +<% if not isPopulated then %>
+<% end %> -
+
+

Game

+
+