fix: don't delete camera during purgeWorld command
import org.terasology.entitySystem.entity.EntityBuilder;
import org.terasology.entitySystem.entity.EntityManager;
import org.terasology.entitySystem.entity.EntityRef;
+import org.terasology.entitySystem.entity.internal.EntityScope;
import org.terasology.entitySystem.entity.lifecycleEvents.OnActivatedComponent;
import org.terasology.entitySystem.entity.lifecycleEvents.OnChangedComponent;
import org.terasology.entitySystem.event.ReceiveEvent;
@@ -81,6 +82,7 @@ private void ensureCameraEntityCreated() {
EntityBuilder builder = entityManager.newBuilder("engine:camera");
builder.setPersistent(false);
clientComponent.camera = builder.build();
+ clientComponent.camera.setScope(EntityScope.GLOBAL); // Ensure that the camera isn't destroyed by the purgeWorld command.
localPlayer.getClientEntity().saveComponent(clientComponent);
}
}
