More native utils + move startup stuff into startup.js

This commit is contained in:
Vortrex
2022-04-20 06:47:54 -05:00
parent 16537fa332
commit 6999661bba
30 changed files with 369 additions and 201 deletions

View File

@@ -8,11 +8,8 @@
// ===========================================================================
function initRaceScript() {
if(!getServerConfig().devServer) {
getServerData().races = loadRacesFromDatabase();
}
setRaceDataIndexes();
logToConsole(LOG_INFO, "[VRR.Race]: Initializing race script ...");
logToConsole(LOG_INFO, "[VRR.Race]: Race script initialized successfully!");
}
// ===========================================================================
@@ -28,4 +25,33 @@ function getRaceData(raceId) {
return false;
}
// ===========================================================================
function setAllRaceDataIndexes() {
for(let i in getServerData().races) {
getServerData().races[i].index = i;
}
}
// ===========================================================================
function loadRacesFromDatabase() {
// To-do
return [];
}
// ===========================================================================
function saveRacesToDatabase() {
for(let i in getServerData().races) {
saveRaceToDatabase(getServerData().races[i]);
}
}
// ===========================================================================
function saveRaceToDatabase(raceData) {
return true;
}
// ===========================================================================