diff --git a/app.lua b/app.lua index 49da45a..4ebef33 100644 --- a/app.lua +++ b/app.lua @@ -1,18 +1,20 @@ local lapis = require("lapis") local app = lapis.Application() local say = require('lua_scripts/main') +local mapFunc = require('lua_scripts/map') local player = require('player') local db = require("lapis.db") local Model = require("lapis.db.model").Model -local db = Model:extend('database') +local map = Model:extend('map') app:enable("etlua") app.layout = require "views.layout" app:post("/clickme", function(self) self.plane = "P-38L" + mapFunc.populate(self, map) return {self.plane, layout = false} end) diff --git a/config.lua b/config.lua index fd412a1..2c6dc80 100644 --- a/config.lua +++ b/config.lua @@ -4,8 +4,9 @@ config("development", { server = "nginx", code_cache = "off", num_workers = "1", + port = "1010" sqlite = { - database = "my_database.sqlite", + database = "database.sqlite3", -- open_flags = ... } }) diff --git a/database.sqlite3 b/database.sqlite3 index d5c7d88..6c4792d 100644 Binary files a/database.sqlite3 and b/database.sqlite3 differ diff --git a/lua_scripts/map.lua b/lua_scripts/map.lua new file mode 100644 index 0000000..439f802 --- /dev/null +++ b/lua_scripts/map.lua @@ -0,0 +1,30 @@ +local map = { + populate = function(self, map) + for h=1,100 do + for i=1,100 do + local tile = map:create({ + x = h, + y = i, + occupied_by_type = "", + occupied_by_id = "" + }) + end + end + end +} +local tiles = {} + +return map + + + + + + + + + + + + + diff --git a/setup_db b/setup_db index 6e67040..3e91186 100755 --- a/setup_db +++ b/setup_db @@ -15,7 +15,7 @@ sqlite3 database.sqlite3 " hp INTEGER, inventory_ref INTEGER ); - CREATE TABLE IF NOT EXISTS player_inventory ( + CREATE TABLE IF NOT EXISTS player_inventory ( id INTEGER PRIMARY KEY AUTOINCREMENT, type TEXT, quantity INTEGER,