Search in sources :

Example 1 with ComponentSystemManager

use of org.terasology.engine.core.ComponentSystemManager in project Terasology by MovingBlocks.

the class ReadWriteStorageManager method startSaving.

private void startSaving() {
    logger.info("Saving - Creating game snapshot");
    PerformanceMonitor.startActivity("Saving");
    ComponentSystemManager componentSystemManager = CoreRegistry.get(ComponentSystemManager.class);
    for (ComponentSystem sys : componentSystemManager.getAllSystems()) {
        sys.preSave();
    }
    saveRequested = false;
    saveTransaction = createSaveTransaction();
    saveThreadManager.offer(saveTransaction);
    if (recordAndReplayCurrentStatus.getStatus() == RecordAndReplayStatus.NOT_ACTIVATED) {
        saveGamePreviewImage();
    }
    for (ComponentSystem sys : componentSystemManager.getAllSystems()) {
        sys.postSave();
    }
    PerformanceMonitor.endActivity();
    entitySetDeltaRecorder = new EntitySetDeltaRecorder(this.entityRefReplacingComponentLibrary);
    logger.info("Saving - Snapshot created: Writing phase starts");
}
Also used : ComponentSystem(org.terasology.engine.entitySystem.systems.ComponentSystem) ComponentSystemManager(org.terasology.engine.core.ComponentSystemManager)

Example 2 with ComponentSystemManager

use of org.terasology.engine.core.ComponentSystemManager in project Terasology by MovingBlocks.

the class HeadlessEnvironment method setupComponentManager.

@Override
protected void setupComponentManager() {
    ComponentSystemManager componentSystemManager = new ComponentSystemManager(context);
    componentSystemManager.initialise();
    context.put(ComponentSystemManager.class, componentSystemManager);
}
Also used : ComponentSystemManager(org.terasology.engine.core.ComponentSystemManager)

Example 3 with ComponentSystemManager

use of org.terasology.engine.core.ComponentSystemManager in project Terasology by MovingBlocks.

the class PreBeginSystems method begin.

@Override
public void begin() {
    ComponentSystemManager csm = context.get(ComponentSystemManager.class);
    final List<ComponentSystem> componentSystemList = csm.getAllSystems();
    componentSystems = componentSystemList.iterator();
    setTotalSteps(componentSystemList.size());
}
Also used : ComponentSystem(org.terasology.engine.entitySystem.systems.ComponentSystem) ComponentSystemManager(org.terasology.engine.core.ComponentSystemManager)

Example 4 with ComponentSystemManager

use of org.terasology.engine.core.ComponentSystemManager in project Terasology by MovingBlocks.

the class RegisterInputSystem method step.

@Override
public boolean step() {
    ComponentSystemManager componentSystemManager = context.get(ComponentSystemManager.class);
    LocalPlayerSystem localPlayerSystem = new LocalPlayerSystem();
    componentSystemManager.register(localPlayerSystem, "engine:localPlayerSystem");
    context.put(LocalPlayerSystem.class, localPlayerSystem);
    CameraTargetSystem cameraTargetSystem = new CameraTargetSystem();
    context.put(CameraTargetSystem.class, cameraTargetSystem);
    componentSystemManager.register(cameraTargetSystem, "engine:CameraTargetSystem");
    InputSystem inputSystem = context.get(InputSystem.class);
    componentSystemManager.register(inputSystem, "engine:InputSystem");
    return true;
}
Also used : LocalPlayerSystem(org.terasology.engine.logic.players.LocalPlayerSystem) InputSystem(org.terasology.engine.input.InputSystem) ComponentSystemManager(org.terasology.engine.core.ComponentSystemManager) CameraTargetSystem(org.terasology.engine.input.cameraTarget.CameraTargetSystem)

Example 5 with ComponentSystemManager

use of org.terasology.engine.core.ComponentSystemManager in project Terasology by MovingBlocks.

the class AwaitCharacterSpawn method step.

@Override
public boolean step() {
    ComponentSystemManager componentSystemManager = context.get(ComponentSystemManager.class);
    for (UpdateSubscriberSystem updater : componentSystemManager.iterateUpdateSubscribers()) {
        updater.update(0.0f);
    }
    LocalPlayer localPlayer = context.get(LocalPlayer.class);
    ClientComponent client = localPlayer.getClientEntity().getComponent(ClientComponent.class);
    if (client != null && client.character.exists()) {
        client.character.send(new AwaitedLocalCharacterSpawnEvent());
        return true;
    } else {
        chunkProvider.update();
    }
    return false;
}
Also used : LocalPlayer(org.terasology.engine.logic.players.LocalPlayer) UpdateSubscriberSystem(org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem) ClientComponent(org.terasology.engine.network.ClientComponent) ComponentSystemManager(org.terasology.engine.core.ComponentSystemManager)

Aggregations

ComponentSystemManager (org.terasology.engine.core.ComponentSystemManager)13 ComponentSystem (org.terasology.engine.entitySystem.systems.ComponentSystem)4 BeforeEach (org.junit.jupiter.api.BeforeEach)3 EngineEntityManager (org.terasology.engine.entitySystem.entity.internal.EngineEntityManager)3 EngineTime (org.terasology.engine.core.EngineTime)2 ModuleManager (org.terasology.engine.core.module.ModuleManager)2 EntityManager (org.terasology.engine.entitySystem.entity.EntityManager)2 EventSystem (org.terasology.engine.entitySystem.event.internal.EventSystem)2 EventLibrary (org.terasology.engine.entitySystem.metadata.EventLibrary)2 ConsoleImpl (org.terasology.engine.logic.console.ConsoleImpl)2 BlockEntityRegistry (org.terasology.engine.world.BlockEntityRegistry)2 Path (java.nio.file.Path)1 Context (org.terasology.engine.context.Context)1 GameEngine (org.terasology.engine.core.GameEngine)1 TerasologyEngine (org.terasology.engine.core.TerasologyEngine)1 LoadPrefabs (org.terasology.engine.core.modes.loadProcesses.LoadPrefabs)1 EngineSubsystem (org.terasology.engine.core.subsystem.EngineSubsystem)1 UpdateSubscriberSystem (org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem)1 Game (org.terasology.engine.game.Game)1 InputSystem (org.terasology.engine.input.InputSystem)1