mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 13:37:22 +00:00
Calculate world shutdown timer (#910)
This commit is contained in:
parent
015cbc06ea
commit
96313ecd69
@ -296,6 +296,7 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t chatReconnectionTime = 30 * currentFramerate; // 30 seconds in frames
|
uint32_t chatReconnectionTime = 30 * currentFramerate; // 30 seconds in frames
|
||||||
uint32_t saveTime = 10 * 60 * currentFramerate; // 10 minutes in frames
|
uint32_t saveTime = 10 * 60 * currentFramerate; // 10 minutes in frames
|
||||||
uint32_t sqlPingTime = 10 * 60 * currentFramerate; // 10 minutes in frames
|
uint32_t sqlPingTime = 10 * 60 * currentFramerate; // 10 minutes in frames
|
||||||
|
uint32_t emptyShutdownTime = (cloneID == 0 ? 30 : 5) * 60 * currentFramerate; // 30 minutes for main worlds, 5 for all others.
|
||||||
while (true) {
|
while (true) {
|
||||||
Metrics::StartMeasurement(MetricVariable::Frame);
|
Metrics::StartMeasurement(MetricVariable::Frame);
|
||||||
Metrics::StartMeasurement(MetricVariable::GameLoop);
|
Metrics::StartMeasurement(MetricVariable::GameLoop);
|
||||||
@ -333,6 +334,8 @@ int main(int argc, char** argv) {
|
|||||||
framesSinceLastUsersSave *= ratioBeforeToAfter;
|
framesSinceLastUsersSave *= ratioBeforeToAfter;
|
||||||
sqlPingTime = 10 * 60 * currentFramerate; // 10 minutes in frames
|
sqlPingTime = 10 * 60 * currentFramerate; // 10 minutes in frames
|
||||||
framesSinceLastSQLPing *= ratioBeforeToAfter;
|
framesSinceLastSQLPing *= ratioBeforeToAfter;
|
||||||
|
emptyShutdownTime = (cloneID == 0 ? 30 : 5) * 60 * currentFramerate; // 30 minutes for main worlds, 5 for all others.
|
||||||
|
framesSinceLastUser *= ratioBeforeToAfter;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Warning if we ran slow
|
//Warning if we ran slow
|
||||||
@ -440,7 +443,7 @@ int main(int argc, char** argv) {
|
|||||||
framesSinceLastUser++;
|
framesSinceLastUser++;
|
||||||
|
|
||||||
//If we haven't had any players for a while, time out and shut down:
|
//If we haven't had any players for a while, time out and shut down:
|
||||||
if (framesSinceLastUser == (cloneID != 0 ? 4000 : 40000)) {
|
if (framesSinceLastUser >= emptyShutdownTime) {
|
||||||
Game::shouldShutdown = true;
|
Game::shouldShutdown = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user