forked from panel-attack/panel-game
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverLauncher.lua
More file actions
32 lines (28 loc) · 1.03 KB
/
serverLauncher.lua
File metadata and controls
32 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
if arg[1] == "debug" then
-- for debugging in visual studio code
pcall(function() require("lldebugger").start() end)
end
-- We must launch the server from the root directory so all the requires are the right path relatively.
require("server.server_globals")
local util = require("common.lib.util")
util.addToCPath("./common/lib/??")
util.addToCPath("./server/lib/??")
require("server.tests.ServerTests")
require("server.tests.LeaderboardTests")
require("server.tests.RoomTests")
require("server.tests.LoginTests")
local database = require("server.PADatabase")
local Server = require("server.server")
local GameModes = require("common.engine.GameModes")
local Persistence = require("server.Persistence")
local server = Server(database, Persistence)
server:initializePlayerData("players.txt")
server:initializeLeaderboard(GameModes.getPreset("TWO_PLAYER_VS"), "leaderboard.csv")
local isPlayerTableEmpty = database:getPlayerRecordCount() == 0
if isPlayerTableEmpty then
server:importDatabase()
end
server:start()
while true do
server:update()
end