server state variable

This commit is contained in:
austin 2025-05-15 13:07:35 -04:00
parent 4e488e43cd
commit 96f6577f95
26 changed files with 71 additions and 67 deletions

View File

@ -17,7 +17,7 @@ public class ImGuiEntityServerTab {
public static void drawServerView(boolean show, Entity detailViewEntity){ public static void drawServerView(boolean show, Entity detailViewEntity){
if(show && ImGui.collapsingHeader("Server Details")){ if(show && ImGui.collapsingHeader("Server Details")){
ImGui.indent(); ImGui.indent();
ServerDataCell serverDataCell = Globals.entityDataCellMapper.getEntityDataCell(detailViewEntity); ServerDataCell serverDataCell = Globals.serverState.entityDataCellMapper.getEntityDataCell(detailViewEntity);
if(serverDataCell == null){ if(serverDataCell == null){
ImGui.text("Entity's data cell is null!"); ImGui.text("Entity's data cell is null!");
} else { } else {

View File

@ -68,14 +68,14 @@ public class ImGuiAI {
ImGui.text("AI"); ImGui.text("AI");
//ai manager stuff //ai manager stuff
ImGui.text("AI Manager active: " + Globals.aiManager.isActive()); ImGui.text("AI Manager active: " + Globals.serverState.aiManager.isActive());
if(ImGui.button("Toggle AI Manager")){ if(ImGui.button("Toggle AI Manager")){
Globals.aiManager.setActive(!Globals.aiManager.isActive()); Globals.serverState.aiManager.setActive(!Globals.serverState.aiManager.isActive());
} }
if(ImGui.collapsingHeader("Statuses")){ if(ImGui.collapsingHeader("Statuses")){
for(AI ai : Globals.aiManager.getAIList()){ for(AI ai : Globals.serverState.aiManager.getAIList()){
ImGui.indent(); ImGui.indent();
if(ImGui.collapsingHeader(ai.getParent().getId() + " - " + ai.getStatus())){ if(ImGui.collapsingHeader(ai.getParent().getId() + " - " + ai.getStatus())){
if(ImGui.button("Draw current pathing")){ if(ImGui.button("Draw current pathing")){

View File

@ -43,7 +43,6 @@ import electrosphere.net.config.NetConfig;
import electrosphere.net.monitor.NetMonitor; import electrosphere.net.monitor.NetMonitor;
import electrosphere.net.server.player.PlayerManager; import electrosphere.net.server.player.PlayerManager;
import electrosphere.net.synchronization.server.EntityValueTrackingService; import electrosphere.net.synchronization.server.EntityValueTrackingService;
import electrosphere.net.synchronization.server.ServerSynchronizationManager;
import electrosphere.renderer.RenderUtils; import electrosphere.renderer.RenderUtils;
import electrosphere.renderer.RenderingEngine; import electrosphere.renderer.RenderingEngine;
import electrosphere.renderer.actor.instance.InstanceManager; import electrosphere.renderer.actor.instance.InstanceManager;
@ -60,8 +59,6 @@ import electrosphere.renderer.ui.elements.ImagePanel;
import electrosphere.renderer.ui.font.FontManager; import electrosphere.renderer.ui.font.FontManager;
import electrosphere.script.ScriptEngine; import electrosphere.script.ScriptEngine;
import electrosphere.server.ServerState; import electrosphere.server.ServerState;
import electrosphere.server.ai.AIManager;
import electrosphere.server.datacell.EntityDataCellMapper;
import electrosphere.server.datacell.RealmManager; import electrosphere.server.datacell.RealmManager;
import electrosphere.server.db.DatabaseController; import electrosphere.server.db.DatabaseController;
import electrosphere.server.entity.poseactor.PoseModel; import electrosphere.server.entity.poseactor.PoseModel;
@ -166,7 +163,6 @@ public class Globals {
// //
//Server manager thing //Server manager thing
// //
public static ServerSynchronizationManager serverSynchronizationManager;
public static boolean RUN_SERVER = true; public static boolean RUN_SERVER = true;
// //
@ -212,7 +208,6 @@ public class Globals {
//Server scene management //Server scene management
// //
public static RealmManager realmManager; public static RealmManager realmManager;
public static EntityDataCellMapper entityDataCellMapper;
// //
//behavior tree tracking service //behavior tree tracking service
@ -342,10 +337,6 @@ public class Globals {
//collision world data //collision world data
public static CollisionWorldData commonWorldData; public static CollisionWorldData commonWorldData;
//ai manager
public static AIManager aiManager;
/** /**
* State for the client * State for the client
@ -433,11 +424,8 @@ public class Globals {
skyboxColors = new ArrayList<Vector3f>(); skyboxColors = new ArrayList<Vector3f>();
//load asset manager //load asset manager
assetManager = new AssetManager(); assetManager = new AssetManager();
//ai manager
aiManager = new AIManager(0);
//realm & data cell manager //realm & data cell manager
realmManager = new RealmManager(); realmManager = new RealmManager();
entityDataCellMapper = new EntityDataCellMapper();
//game config //game config
gameConfigDefault = electrosphere.data.Config.loadDefaultConfig(); gameConfigDefault = electrosphere.data.Config.loadDefaultConfig();
gameConfigCurrent = gameConfigDefault; gameConfigCurrent = gameConfigDefault;
@ -456,7 +444,6 @@ public class Globals {
} }
//profiler //profiler
profiler = new Profiler(); profiler = new Profiler();
Globals.serverSynchronizationManager = new ServerSynchronizationManager();
Globals.movementAudioService = new MovementAudioService(); Globals.movementAudioService = new MovementAudioService();
Globals.hitboxAudioService = new HitboxAudioService(); Globals.hitboxAudioService = new HitboxAudioService();
@ -634,13 +621,11 @@ public class Globals {
* Unloads scene * Unloads scene
*/ */
public static void unloadScene(){ public static void unloadScene(){
Globals.serverState.aiManager.shutdown();
Globals.playerManager = new PlayerManager(); Globals.playerManager = new PlayerManager();
Globals.clientState = new ClientState(); Globals.clientState = new ClientState();
Globals.serverState = new ServerState(); Globals.serverState = new ServerState();
Globals.serverSynchronizationManager = new ServerSynchronizationManager();
if(Globals.aiManager != null){
Globals.aiManager.shutdown();
}
if(Globals.realmManager != null){ if(Globals.realmManager != null){
Globals.realmManager.reset(); Globals.realmManager.reset();
} }
@ -653,8 +638,8 @@ public class Globals {
*/ */
public static void resetGlobals(){ public static void resetGlobals(){
Globals.unloadScene(); Globals.unloadScene();
if(Globals.aiManager != null){ if(Globals.serverState != null && Globals.serverState.aiManager != null){
Globals.aiManager.shutdown(); Globals.serverState.aiManager.shutdown();
} }
// //
//Actual globals to destroy //Actual globals to destroy
@ -669,8 +654,6 @@ public class Globals {
Globals.signalSystem = null; Globals.signalSystem = null;
Globals.serviceManager = null; Globals.serviceManager = null;
Globals.fileWatcherService = null; Globals.fileWatcherService = null;
Globals.serverSynchronizationManager = null;
Globals.aiManager = null;
Globals.playerManager = null; Globals.playerManager = null;
Globals.javaPID = null; Globals.javaPID = null;
Globals.RENDER_FLAG_RENDER_SHADOW_MAP = true; Globals.RENDER_FLAG_RENDER_SHADOW_MAP = true;

View File

@ -31,7 +31,7 @@ public class ChunkGenerationTestLoading {
// //
Globals.RUN_CLIENT = true; Globals.RUN_CLIENT = true;
Globals.RUN_SERVER = true; Globals.RUN_SERVER = true;
Globals.aiManager.setActive(false); Globals.serverState.aiManager.setActive(false);
Globals.signalSystem.post(SignalType.UI_MODIFICATION, ()->{ Globals.signalSystem.post(SignalType.UI_MODIFICATION, ()->{

View File

@ -51,7 +51,7 @@ public class LevelEditorLoading {
// //
Globals.RUN_CLIENT = true; Globals.RUN_CLIENT = true;
Globals.RUN_SERVER = true; Globals.RUN_SERVER = true;
Globals.aiManager.setActive(false); Globals.serverState.aiManager.setActive(false);
Globals.signalSystem.post(SignalType.UI_MODIFICATION, ()->{ Globals.signalSystem.post(SignalType.UI_MODIFICATION, ()->{

View File

@ -1,5 +1,6 @@
package electrosphere.engine.loadingthreads; package electrosphere.engine.loadingthreads;
import electrosphere.client.ClientState;
import electrosphere.client.ui.menu.WindowStrings; import electrosphere.client.ui.menu.WindowStrings;
import electrosphere.client.ui.menu.WindowUtils; import electrosphere.client.ui.menu.WindowUtils;
import electrosphere.client.ui.menu.mainmenu.MenuGeneratorsTitleMenu; import electrosphere.client.ui.menu.mainmenu.MenuGeneratorsTitleMenu;
@ -7,6 +8,7 @@ import electrosphere.engine.Globals;
import electrosphere.engine.signal.Signal.SignalType; import electrosphere.engine.signal.Signal.SignalType;
import electrosphere.engine.threads.LabeledThread.ThreadLabel; import electrosphere.engine.threads.LabeledThread.ThreadLabel;
import electrosphere.renderer.ui.elements.Window; import electrosphere.renderer.ui.elements.Window;
import electrosphere.server.ServerState;
import electrosphere.server.datacell.RealmManager; import electrosphere.server.datacell.RealmManager;
/** /**
@ -50,9 +52,8 @@ public class MainMenuLoading {
* Resets the client state * Resets the client state
*/ */
private static void resetClientState(){ private static void resetClientState(){
Globals.clientState.playerEntity = null;
Globals.clientState.clientSimulation = null;
Globals.clientState.clientConnection.setShouldDisconnect(true); Globals.clientState.clientConnection.setShouldDisconnect(true);
Globals.clientState = new ClientState();
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false); Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false);
} }
@ -61,9 +62,7 @@ public class MainMenuLoading {
*/ */
private static void resetServerState(){ private static void resetServerState(){
Globals.serverState.server.close(); Globals.serverState.server.close();
Globals.serverState.server = null; Globals.serverState = new ServerState();
Globals.serverSynchronizationManager = null;
Globals.realmManager.reset();
Globals.realmManager = new RealmManager(); Globals.realmManager = new RealmManager();
} }

View File

@ -50,11 +50,11 @@ public class EntityCreationUtils {
throw new IllegalStateException("Failed to create a server data cell"); throw new IllegalStateException("Failed to create a server data cell");
} }
//register to entity data cell mapper //register to entity data cell mapper
Globals.entityDataCellMapper.registerEntity(rVal, cell); Globals.serverState.entityDataCellMapper.registerEntity(rVal, cell);
//enable behavior tree tracking //enable behavior tree tracking
ServerBehaviorTreeUtils.registerEntity(rVal); ServerBehaviorTreeUtils.registerEntity(rVal);
if(Globals.entityDataCellMapper.getEntityDataCell(rVal) == null){ if(Globals.serverState.entityDataCellMapper.getEntityDataCell(rVal) == null){
throw new Error("Failed to map entity to cell!"); throw new Error("Failed to map entity to cell!");
} }
@ -79,11 +79,11 @@ public class EntityCreationUtils {
throw new IllegalStateException("Realm inventory data cell undefined!"); throw new IllegalStateException("Realm inventory data cell undefined!");
} }
//register to entity data cell mapper //register to entity data cell mapper
Globals.entityDataCellMapper.registerEntity(rVal, cell); Globals.serverState.entityDataCellMapper.registerEntity(rVal, cell);
//enable behavior tree tracking //enable behavior tree tracking
ServerBehaviorTreeUtils.registerEntity(rVal); ServerBehaviorTreeUtils.registerEntity(rVal);
if(Globals.entityDataCellMapper.getEntityDataCell(rVal) == null){ if(Globals.serverState.entityDataCellMapper.getEntityDataCell(rVal) == null){
throw new Error("Failed to map entity to cell!"); throw new Error("Failed to map entity to cell!");
} }

View File

@ -43,14 +43,14 @@ public class EntityUtils {
Realm realm = Globals.realmManager.getEntityRealm(e); Realm realm = Globals.realmManager.getEntityRealm(e);
if(realm != null){ if(realm != null){
//get data cell //get data cell
ServerDataCell dataCell = Globals.entityDataCellMapper.getEntityDataCell(e); ServerDataCell dataCell = Globals.serverState.entityDataCellMapper.getEntityDataCell(e);
if(dataCell != null){ if(dataCell != null){
dataCell.getScene().deregisterEntity(e); dataCell.getScene().deregisterEntity(e);
} }
} }
Globals.realmManager.removeEntity(e); Globals.realmManager.removeEntity(e);
} }
Globals.entityDataCellMapper.ejectEntity(e); Globals.serverState.entityDataCellMapper.ejectEntity(e);
EntityLookupUtils.removeEntity(e); EntityLookupUtils.removeEntity(e);
} }

View File

@ -94,7 +94,7 @@ public class ServerEntityUtils {
*/ */
protected static void repositionEntityRecursive(Realm realm, Entity entity, Vector3d position){ protected static void repositionEntityRecursive(Realm realm, Entity entity, Vector3d position){
//if server, get current server data cell //if server, get current server data cell
ServerDataCell oldDataCell = Globals.entityDataCellMapper.getEntityDataCell(entity); ServerDataCell oldDataCell = Globals.serverState.entityDataCellMapper.getEntityDataCell(entity);
ServerDataCell newDataCell = realm.getDataCellManager().getDataCellAtPoint(position); ServerDataCell newDataCell = realm.getDataCellManager().getDataCellAtPoint(position);
if(oldDataCell == null){ if(oldDataCell == null){
LoggerInterface.loggerEngine.WARNING( LoggerInterface.loggerEngine.WARNING(
@ -164,8 +164,8 @@ public class ServerEntityUtils {
HitboxCollectionState.destroyHitboxState(entity,true); HitboxCollectionState.destroyHitboxState(entity,true);
Globals.realmManager.removeEntity(entity); Globals.realmManager.removeEntity(entity);
EntityLookupUtils.removeEntity(entity); EntityLookupUtils.removeEntity(entity);
if(Globals.aiManager != null){ if(Globals.serverState.aiManager != null){
Globals.aiManager.removeAI(entity); Globals.serverState.aiManager.removeAI(entity);
} }
if(ServerCharacterData.hasServerCharacterDataTree(entity)){ if(ServerCharacterData.hasServerCharacterDataTree(entity)){
Globals.characterService.removeEntity(ServerCharacterData.getServerCharacterData(entity).getCharacterData()); Globals.characterService.removeEntity(ServerCharacterData.getServerCharacterData(entity).getCharacterData());

View File

@ -514,7 +514,7 @@ public class ServerInventoryState implements BehaviorTree {
Realm realm = Globals.realmManager.getEntityRealm(realWorldItem); Realm realm = Globals.realmManager.getEntityRealm(realWorldItem);
if(realm != null){ if(realm != null){
//get closest chunk //get closest chunk
ServerDataCell dataCell = Globals.entityDataCellMapper.getEntityDataCell(realWorldItem); ServerDataCell dataCell = Globals.serverState.entityDataCellMapper.getEntityDataCell(realWorldItem);
//broadcast destroy item //broadcast destroy item
NetworkMessage unequipMessage = InventoryMessage.constructserverCommandUnequipItemMessage(creature.getId(), InventoryProtocol.INVENTORY_TYPE_EQUIP, inventorySlot); NetworkMessage unequipMessage = InventoryMessage.constructserverCommandUnequipItemMessage(creature.getId(), InventoryProtocol.INVENTORY_TYPE_EQUIP, inventorySlot);
dataCell.broadcastNetworkMessage(unequipMessage); dataCell.broadcastNetworkMessage(unequipMessage);

View File

@ -772,7 +772,7 @@ public class CommonEntityUtils {
/// ///
/// ///
if(rawType.getAITrees() != null){ if(rawType.getAITrees() != null){
Globals.aiManager.attachAI(entity, rawType.getAITrees()); Globals.serverState.aiManager.attachAI(entity, rawType.getAITrees());
} }
//add health system //add health system
@ -781,7 +781,7 @@ public class CommonEntityUtils {
ServerEntityTagUtils.attachTagToEntity(entity, EntityTags.LIFE_STATE); ServerEntityTagUtils.attachTagToEntity(entity, EntityTags.LIFE_STATE);
} }
if(Globals.entityDataCellMapper.getEntityDataCell(entity) == null){ if(Globals.serverState.entityDataCellMapper.getEntityDataCell(entity) == null){
throw new Error("Failed to map entity to cell!"); throw new Error("Failed to map entity to cell!");
} }

View File

@ -583,7 +583,7 @@ public class ItemUtils {
if(Globals.realmManager.getEntityRealm(rVal) == null){ if(Globals.realmManager.getEntityRealm(rVal) == null){
LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Created item without it being assigned to a realm!")); LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Created item without it being assigned to a realm!"));
} }
if(Globals.entityDataCellMapper.getEntityDataCell(rVal) == null){ if(Globals.serverState.entityDataCellMapper.getEntityDataCell(rVal) == null){
throw new Error("Failed to get data cell or the entity"); throw new Error("Failed to get data cell or the entity");
} }
@ -628,7 +628,7 @@ public class ItemUtils {
if(Globals.realmManager.getEntityRealm(rVal) == null){ if(Globals.realmManager.getEntityRealm(rVal) == null){
LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Created item without it being assigned to a realm!")); LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Created item without it being assigned to a realm!"));
} }
if(Globals.entityDataCellMapper.getEntityDataCell(rVal) == null){ if(Globals.serverState.entityDataCellMapper.getEntityDataCell(rVal) == null){
throw new Error("Failed to get data cell or the entity"); throw new Error("Failed to get data cell or the entity");
} }

View File

@ -35,7 +35,7 @@ public class SynchronizationProtocol implements ServerProtocolTemplate<Synchroni
public void handleSyncMessage(ServerConnectionHandler connectionHandler, SynchronizationMessage message) { public void handleSyncMessage(ServerConnectionHandler connectionHandler, SynchronizationMessage message) {
switch(message.getMessageSubtype()){ switch(message.getMessageSubtype()){
case CLIENTREQUESTBTREEACTION:{ case CLIENTREQUESTBTREEACTION:{
Globals.serverSynchronizationManager.pushMessage(message); Globals.serverState.serverSynchronizationManager.pushMessage(message);
} break; } break;
case UPDATECLIENTSTATE: case UPDATECLIENTSTATE:
case UPDATECLIENTSTRINGSTATE: case UPDATECLIENTSTRINGSTATE:

View File

@ -12,6 +12,11 @@ public class MainServerFunctions {
* Calls the main server routines that should fire each frame * Calls the main server routines that should fire each frame
*/ */
public static void simulate(){ public static void simulate(){
//check dependencies
if(Globals.serverState == null){
return;
}
Globals.profiler.beginCpuSample("MainServerFunctions.simulate"); Globals.profiler.beginCpuSample("MainServerFunctions.simulate");
// //
@ -28,14 +33,14 @@ public class MainServerFunctions {
} }
Globals.profiler.endCpuSample(); Globals.profiler.endCpuSample();
Globals.profiler.beginCpuSample("MainServerFunctions.simulate - Server process synchronization messages"); Globals.profiler.beginCpuSample("MainServerFunctions.simulate - Server process synchronization messages");
if(Globals.serverSynchronizationManager != null){ if(Globals.serverState.serverSynchronizationManager != null){
Globals.serverSynchronizationManager.processMessages(); Globals.serverState.serverSynchronizationManager.processMessages();
} }
Globals.profiler.endCpuSample(); Globals.profiler.endCpuSample();
// //
//Update AI //Update AI
Globals.aiManager.simulate(); Globals.serverState.aiManager.simulate();
// //
//Services //Services

View File

@ -1,6 +1,9 @@
package electrosphere.server; package electrosphere.server;
import electrosphere.net.server.Server; import electrosphere.net.server.Server;
import electrosphere.net.synchronization.server.ServerSynchronizationManager;
import electrosphere.server.ai.AIManager;
import electrosphere.server.datacell.EntityDataCellMapper;
/** /**
* Server state * Server state
@ -12,4 +15,19 @@ public class ServerState {
*/ */
public Server server; public Server server;
/**
* Synchronization manager on the server
*/
public final ServerSynchronizationManager serverSynchronizationManager = new ServerSynchronizationManager();
/**
* ai manager
*/
public AIManager aiManager = new AIManager(0);
/**
* The entity->datacell mapper
*/
public final EntityDataCellMapper entityDataCellMapper = new EntityDataCellMapper();
} }

View File

@ -32,12 +32,12 @@ public class StartTimerNode implements AITreeNode {
} }
this.frameCount = frameCount; this.frameCount = frameCount;
//create the timer //create the timer
Globals.aiManager.getTimerService().createTimer(this.frameCount); Globals.serverState.aiManager.getTimerService().createTimer(this.frameCount);
} }
@Override @Override
public AITreeNodeResult evaluate(Entity entity, Blackboard blackboard) { public AITreeNodeResult evaluate(Entity entity, Blackboard blackboard) {
TimerService timerService = Globals.aiManager.getTimerService(); TimerService timerService = Globals.serverState.aiManager.getTimerService();
if(timerService.isActive(this.timerId)){ if(timerService.isActive(this.timerId)){
return AITreeNodeResult.RUNNING; return AITreeNodeResult.RUNNING;
} else { } else {

View File

@ -56,7 +56,7 @@ public class RandomizerNode implements CollectionNode {
@Override @Override
public AITreeNodeResult evaluate(Entity entity, Blackboard blackboard) { public AITreeNodeResult evaluate(Entity entity, Blackboard blackboard) {
if(this.currentChild == null){ if(this.currentChild == null){
Random random = Globals.aiManager.getRandom(); Random random = Globals.serverState.aiManager.getRandom();
int selectedChild = random.nextInt(children.size()); int selectedChild = random.nextInt(children.size());
this.currentChild = this.children.get(selectedChild); this.currentChild = this.children.get(selectedChild);
} }

View File

@ -43,19 +43,19 @@ public class TimerNode implements DecoratorNode {
} }
this.child = child; this.child = child;
this.frameCount = frameCount; this.frameCount = frameCount;
this.timerId = Globals.aiManager.getTimerService().createTimer(); this.timerId = Globals.serverState.aiManager.getTimerService().createTimer();
} }
@Override @Override
public AITreeNodeResult evaluate(Entity entity, Blackboard blackboard) { public AITreeNodeResult evaluate(Entity entity, Blackboard blackboard) {
if(Globals.aiManager.getTimerService().isActive(timerId)){ if(Globals.serverState.aiManager.getTimerService().isActive(timerId)){
return AITreeNodeResult.RUNNING; return AITreeNodeResult.RUNNING;
} }
if(hasReset){ if(hasReset){
this.hasReset = false; this.hasReset = false;
return AITreeNodeResult.SUCCESS; return AITreeNodeResult.SUCCESS;
} else { } else {
Globals.aiManager.getTimerService().resetTimer(timerId, frameCount); Globals.serverState.aiManager.getTimerService().resetTimer(timerId, frameCount);
this.hasReset = true; this.hasReset = true;
return AITreeNodeResult.RUNNING; return AITreeNodeResult.RUNNING;
} }

View File

@ -24,7 +24,7 @@ public class NearbyEntityService implements AIService {
@Override @Override
public void exec(){ public void exec(){
for(AI ai : Globals.aiManager.getAIList()){ for(AI ai : Globals.serverState.aiManager.getAIList()){
Entity entity = ai.getParent(); Entity entity = ai.getParent();
Realm realm = Globals.realmManager.getEntityRealm(entity); Realm realm = Globals.realmManager.getEntityRealm(entity);
if(realm != null){ if(realm != null){

View File

@ -161,7 +161,7 @@ public class Realm {
*/ */
public void sendNetworkMessageToChunk(NetworkMessage message, Entity e){ public void sendNetworkMessageToChunk(NetworkMessage message, Entity e){
//solve for what data cell the entitiy is in //solve for what data cell the entitiy is in
ServerDataCell cell = Globals.entityDataCellMapper.getEntityDataCell(e); ServerDataCell cell = Globals.serverState.entityDataCellMapper.getEntityDataCell(e);
cell.broadcastNetworkMessage(message); cell.broadcastNetworkMessage(message);
} }
@ -180,7 +180,7 @@ public class Realm {
//send the entity to all players //send the entity to all players
cell.initializeEntityForNewPlayers(entity, null); cell.initializeEntityForNewPlayers(entity, null);
//register to entity data cell mapper //register to entity data cell mapper
Globals.entityDataCellMapper.registerEntity(entity, cell); Globals.serverState.entityDataCellMapper.registerEntity(entity, cell);
} }

View File

@ -209,7 +209,7 @@ public class ServerDataCell {
newCell.getScene().registerEntity(entity); newCell.getScene().registerEntity(entity);
newCell.getScene().registerEntityToTags(entity, tags); newCell.getScene().registerEntityToTags(entity, tags);
//update entity data cell mapper //update entity data cell mapper
Globals.entityDataCellMapper.updateEntityCell(entity, newCell); Globals.serverState.entityDataCellMapper.updateEntityCell(entity, newCell);
//send the entity to new players that should care about it //send the entity to new players that should care about it
for(Player player : newCell.activePlayers){ for(Player player : newCell.activePlayers){
if(player.getPlayerEntity() == null || player.getPlayerEntity() != entity){ if(player.getPlayerEntity() == null || player.getPlayerEntity() != entity){

View File

@ -1183,7 +1183,7 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
@Override @Override
public PathingProgressiveData findPathAsync(Vector3d start, Vector3d end) { public PathingProgressiveData findPathAsync(Vector3d start, Vector3d end) {
return Globals.aiManager.getPathfindingService().queuePathfinding(start, end, this.pathfinder, this); return Globals.serverState.aiManager.getPathfindingService().queuePathfinding(start, end, this.pathfinder, this);
} }
@Override @Override

View File

@ -29,7 +29,7 @@ public class DataCellSearchUtils {
LoggerInterface.loggerEngine.ERROR(new IllegalArgumentException("Trying to get entity data cell of an entity that is not assigned to a realm!")); LoggerInterface.loggerEngine.ERROR(new IllegalArgumentException("Trying to get entity data cell of an entity that is not assigned to a realm!"));
return null; return null;
} }
return Globals.entityDataCellMapper.getEntityDataCell(entity); return Globals.serverState.entityDataCellMapper.getEntityDataCell(entity);
} }
/** /**

View File

@ -15,7 +15,7 @@ public class ServerEntityTagUtils {
* @param tag The tag * @param tag The tag
*/ */
public static void attachTagToEntity(Entity entity, String tag){ public static void attachTagToEntity(Entity entity, String tag){
ServerDataCell cell = Globals.entityDataCellMapper.getEntityDataCell(entity); ServerDataCell cell = Globals.serverState.entityDataCellMapper.getEntityDataCell(entity);
cell.getScene().registerEntityToTag(entity, tag); cell.getScene().registerEntityToTag(entity, tag);
} }
@ -25,7 +25,7 @@ public class ServerEntityTagUtils {
* @param tag The tag * @param tag The tag
*/ */
public static void removeTagFromEntity(Entity entity, String tag){ public static void removeTagFromEntity(Entity entity, String tag){
ServerDataCell cell = Globals.entityDataCellMapper.getEntityDataCell(entity); ServerDataCell cell = Globals.serverState.entityDataCellMapper.getEntityDataCell(entity);
cell.getScene().removeEntityFromTag(entity, tag); cell.getScene().removeEntityFromTag(entity, tag);
} }

View File

@ -44,8 +44,8 @@ public class UnitUtils {
//optionally apply ai //optionally apply ai
if(unitDefinition.getAI() != null){ if(unitDefinition.getAI() != null){
Globals.aiManager.removeAI(rVal); Globals.serverState.aiManager.removeAI(rVal);
Globals.aiManager.attachAI(rVal, unitDefinition.getAI()); Globals.serverState.aiManager.attachAI(rVal, unitDefinition.getAI());
} }
//optionally add equipment //optionally add equipment

View File

@ -21,7 +21,6 @@ public class StateCleanupCheckerExtension implements AfterEachCallback {
Globals.renderingEngine, Globals.renderingEngine,
Globals.audioEngine, Globals.audioEngine,
Globals.javaPID, Globals.javaPID,
Globals.serverSynchronizationManager,
Globals.playerManager, Globals.playerManager,
LoggerInterface.loggerEngine, LoggerInterface.loggerEngine,
RenderingEngine.screenFramebuffer, RenderingEngine.screenFramebuffer,