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");
}
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);
}
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());
}
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;
}
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;
}
Aggregations