forked from Jonathan/Peradventure
adding map db
This commit is contained in:
parent
0d9e48752d
commit
d48ad24c08
4
app.lua
4
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)
|
||||
|
||||
|
@ -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 = ...
|
||||
}
|
||||
})
|
||||
|
BIN
database.sqlite3
BIN
database.sqlite3
Binary file not shown.
30
lua_scripts/map.lua
Normal file
30
lua_scripts/map.lua
Normal file
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user