fix engine not closing when x button
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
parent
c136762d16
commit
4ddb894e5c
@ -1775,6 +1775,7 @@ Interaction editing debug menu
|
|||||||
Fix chest physics&interaction data
|
Fix chest physics&interaction data
|
||||||
Break out collidable template edit into dedicated component
|
Break out collidable template edit into dedicated component
|
||||||
Fix virtual scrollable
|
Fix virtual scrollable
|
||||||
|
Fix engine not closing when X button is hit on main menu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
package electrosphere.engine;
|
package electrosphere.engine;
|
||||||
|
|
||||||
import static org.lwjgl.glfw.GLFW.glfwWindowShouldClose;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.graalvm.polyglot.HostAccess.Export;
|
import org.graalvm.polyglot.HostAccess.Export;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.ode4j.ode.OdeHelper;
|
import org.ode4j.ode.OdeHelper;
|
||||||
|
|
||||||
import electrosphere.audio.AudioEngine;
|
import electrosphere.audio.AudioEngine;
|
||||||
@ -118,7 +117,7 @@ public class Main {
|
|||||||
|
|
||||||
//controls
|
//controls
|
||||||
if(Globals.RUN_CLIENT){
|
if(Globals.RUN_CLIENT){
|
||||||
initControlHandler();
|
Main.initControlHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
//init ODE
|
//init ODE
|
||||||
@ -185,8 +184,8 @@ public class Main {
|
|||||||
* Runs the main loop indefinitely. Blocks the thread this is called in.
|
* Runs the main loop indefinitely. Blocks the thread this is called in.
|
||||||
*/
|
*/
|
||||||
public static void mainLoop(){
|
public static void mainLoop(){
|
||||||
mainLoop(0);
|
Main.mainLoop(0);
|
||||||
shutdown();
|
Main.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -369,7 +368,7 @@ public class Main {
|
|||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(Globals.ENGINE_SHUTDOWN_FLAG || (Globals.RUN_CLIENT && glfwWindowShouldClose(Globals.window))){
|
if(Globals.ENGINE_SHUTDOWN_FLAG || (Globals.RUN_CLIENT && GLFW.glfwWindowShouldClose(Globals.window))){
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
|||||||
import electrosphere.entity.types.terrain.BlockChunkEntity;
|
import electrosphere.entity.types.terrain.BlockChunkEntity;
|
||||||
import electrosphere.entity.types.terrain.TerrainChunk;
|
import electrosphere.entity.types.terrain.TerrainChunk;
|
||||||
import electrosphere.server.ai.services.PathfindingService;
|
import electrosphere.server.ai.services.PathfindingService;
|
||||||
import electrosphere.server.datacell.Realm;
|
|
||||||
import electrosphere.server.datacell.gridded.GriddedDataCellLoaderService;
|
import electrosphere.server.datacell.gridded.GriddedDataCellLoaderService;
|
||||||
import electrosphere.util.CodeUtils;
|
import electrosphere.util.CodeUtils;
|
||||||
|
|
||||||
@ -117,17 +116,7 @@ public class ThreadManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Globals.realmManager != null && Globals.realmManager.getRealms() != null){
|
if(Globals.realmManager != null && Globals.realmManager.getRealms() != null){
|
||||||
for(Realm realm : Globals.realmManager.getRealms()){
|
Globals.realmManager.reset();
|
||||||
if(realm.getServerWorldData() != null && realm.getServerWorldData().getServerTerrainManager() != null){
|
|
||||||
realm.getServerWorldData().getServerTerrainManager().closeThreads();
|
|
||||||
}
|
|
||||||
if(realm.getServerWorldData() != null && realm.getServerWorldData().getServerBlockManager() != null){
|
|
||||||
realm.getServerWorldData().getServerBlockManager().closeThreads();
|
|
||||||
}
|
|
||||||
if(realm.getDataCellManager() != null){
|
|
||||||
realm.getDataCellManager().halt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -245,6 +245,11 @@ public class RealmManager {
|
|||||||
* Resets the realm manager
|
* Resets the realm manager
|
||||||
*/
|
*/
|
||||||
public void reset(){
|
public void reset(){
|
||||||
|
for(Realm realm : this.realms){
|
||||||
|
if(realm.getServerWorldData() != null && realm.getServerWorldData().getServerTerrainManager() != null){
|
||||||
|
realm.getServerWorldData().getServerTerrainManager().closeThreads();
|
||||||
|
}
|
||||||
|
}
|
||||||
for(Realm realm : this.realms){
|
for(Realm realm : this.realms){
|
||||||
if(
|
if(
|
||||||
realm.getServerWorldData() != null &&
|
realm.getServerWorldData() != null &&
|
||||||
@ -254,6 +259,15 @@ public class RealmManager {
|
|||||||
){
|
){
|
||||||
FluidAcceleratedSimulator.cleanup();
|
FluidAcceleratedSimulator.cleanup();
|
||||||
}
|
}
|
||||||
|
if(realm.getServerWorldData() != null && realm.getServerWorldData().getServerTerrainManager() != null){
|
||||||
|
realm.getServerWorldData().getServerTerrainManager().closeThreads();
|
||||||
|
}
|
||||||
|
if(realm.getServerWorldData() != null && realm.getServerWorldData().getServerBlockManager() != null){
|
||||||
|
realm.getServerWorldData().getServerBlockManager().closeThreads();
|
||||||
|
}
|
||||||
|
if(realm.getDataCellManager() != null){
|
||||||
|
realm.getDataCellManager().halt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.realms.clear();
|
this.realms.clear();
|
||||||
lock.lock();
|
lock.lock();
|
||||||
@ -262,17 +276,5 @@ public class RealmManager {
|
|||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes the realm manager, destroying all resources
|
|
||||||
*/
|
|
||||||
public void close(){
|
|
||||||
for(Realm realm : this.realms){
|
|
||||||
if(realm.getServerWorldData() != null && realm.getServerWorldData().getServerTerrainManager() != null){
|
|
||||||
realm.getServerWorldData().getServerTerrainManager().closeThreads();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user