mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 04:32:06 +00:00 
			
		
		
		
	Update shutdown time to be accurate
This commit is contained in:
		| @@ -18,47 +18,42 @@ void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* | ||||
| 		Game::logger->Log("MovementSwitchBehavior", "Unable to read movementType from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits()); | ||||
| 		return; | ||||
| 	}; | ||||
| 	Game::logger->LogDebug("MovementSwitchBehavior", "Movement type %i", movementType); | ||||
|  | ||||
| 	switch (movementType) { | ||||
| 	case 1: | ||||
| 	case 3: | ||||
| 		this->m_groundAction->Handle(context, bitStream, branch); | ||||
| 		break; | ||||
| 	case 2: | ||||
| 		this->m_jumpAction->Handle(context, bitStream, branch); | ||||
| 		break; | ||||
| 	case 3: | ||||
| 		this->m_fallingAction->Handle(context, bitStream, branch); | ||||
| 		break; | ||||
| 	case 4: | ||||
| 		this->m_doubleJumpAction->Handle(context, bitStream, branch); | ||||
| 		break; | ||||
| 	case 5: | ||||
| 		this->m_fallingAction->Handle(context, bitStream, branch); | ||||
| 		this->m_airAction->Handle(context, bitStream, branch); | ||||
| 		break; | ||||
| 	case 6: | ||||
| 		this->m_jetpackAction->Handle(context, bitStream, branch); | ||||
| 		break; | ||||
| 	default: | ||||
| 		this->m_groundAction->Handle(context, bitStream, branch); | ||||
| 		Game::logger->Log("MovementSwitchBehavior", "Invalid movement behavior type (%i)!", movementType); | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void MovementSwitchBehavior::Load() { | ||||
| 	this->m_groundAction = GetAction("ground_action"); | ||||
|  | ||||
| 	this->m_airAction = GetAction("air_action"); | ||||
| 	if (!this->m_airAction) this->m_airAction = this->m_groundAction; | ||||
|  | ||||
| 	this->m_doubleJumpAction = GetAction("double_jump_action"); | ||||
| 	if (!this->m_doubleJumpAction) this->m_airAction = this->m_groundAction; | ||||
|  | ||||
| 	this->m_fallingAction = GetAction("falling_action"); | ||||
| 	if (!this->m_fallingAction) this->m_airAction = this->m_groundAction; | ||||
|  | ||||
| 	this->m_groundAction = GetAction("ground_action"); | ||||
|  | ||||
| 	this->m_jetpackAction = GetAction("jetpack_action"); | ||||
| 	if (!this->m_jetpackAction) this->m_airAction = this->m_groundAction; | ||||
|  | ||||
| 	this->m_jumpAction = GetAction("jump_action"); | ||||
| 	if (!this->m_jumpAction) this->m_airAction = this->m_groundAction; | ||||
|  | ||||
| 	this->m_movingAction = GetAction("moving_action"); | ||||
| 	if (!this->m_movingAction) this->m_airAction = this->m_groundAction; | ||||
| } | ||||
|   | ||||
| @@ -19,8 +19,6 @@ public: | ||||
|  | ||||
| 	Behavior* m_jumpAction; | ||||
|  | ||||
| 	Behavior* m_movingAction; | ||||
|  | ||||
| 	/* | ||||
| 	 * Inherited | ||||
| 	 */ | ||||
|   | ||||
| @@ -296,6 +296,7 @@ int main(int argc, char** argv) { | ||||
| 	uint32_t chatReconnectionTime = 30 * currentFramerate; // 30 seconds in frames | ||||
| 	uint32_t saveTime = 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) { | ||||
| 		Metrics::StartMeasurement(MetricVariable::Frame); | ||||
| 		Metrics::StartMeasurement(MetricVariable::GameLoop); | ||||
| @@ -333,6 +334,8 @@ int main(int argc, char** argv) { | ||||
| 			framesSinceLastUsersSave *= ratioBeforeToAfter; | ||||
| 			sqlPingTime = 10 * 60 * currentFramerate; // 10 minutes in frames | ||||
| 			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 | ||||
| @@ -440,7 +443,7 @@ int main(int argc, char** argv) { | ||||
| 			framesSinceLastUser++; | ||||
|  | ||||
| 			//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; | ||||
| 			} | ||||
| 		} else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 EmosewaMC
					EmosewaMC