Use new server config class
This commit is contained in:
@@ -224,8 +224,6 @@ let gameConfig = {
|
|||||||
|
|
||||||
function initConfigScript() {
|
function initConfigScript() {
|
||||||
console.log("[Asshat.Config]: Initializing config script ...");
|
console.log("[Asshat.Config]: Initializing config script ...");
|
||||||
serverConfig = loadServerConfig(server.game, server.port);
|
|
||||||
applyConfigToServer(serverConfig);
|
|
||||||
console.log("[Asshat.Config]: Config script initialized!");
|
console.log("[Asshat.Config]: Config script initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,14 +237,14 @@ function loadServerConfigFromGameAndPort(gameId, port) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
|
let tempServerConfigData = new serverClasses.serverConfigData(dbAssoc);
|
||||||
let tempServerConfigData = serverClasses.serverConfigData(dbAssoc);
|
|
||||||
|
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
|
return tempServerConfigData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -266,16 +264,17 @@ function loadServerConfigFromId(tempServerId) {
|
|||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
function applyConfigToServer() {
|
function applyConfigToServer(tempServerConfig) {
|
||||||
server.name = getServerConfig().name;
|
server.name = tempServerConfig.name;
|
||||||
server.password = getServerConfig().password;
|
server.password = tempServerConfig.password;
|
||||||
gta.time.hour = getServerConfig().hour;
|
gta.time.hour = tempServerConfig.hour;
|
||||||
gta.time.minute = getServerConfig().minute;
|
gta.time.minute = tempServerConfig.minute;
|
||||||
gta.forceWeather(getServerConfig().weather);
|
gta.forceWeather(tempServerConfig.weather);
|
||||||
|
|
||||||
updateServerRules();
|
updateServerRules();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user