Tweaks to map loading

This commit is contained in:
Marco 2025-03-28 14:02:33 +01:00
commit e56b896365

View file

@ -98,13 +98,12 @@ public partial class GlobalState : Node
private void DeferredGotoScene(string path, MapStartDataResource startData = null)
{
// if (InventoryManager.Instance is not null)
// {
// SessionSettings.Items = InventoryManager.Instance.Save();
// }
// It is now safe to remove the current scene.
CurrentScene.Free();
//var sceneParent = CurrentScene.GetParent();
//sceneParent.RemoveChild(CurrentScene);
//sceneParent.QueueFree();
// Load a new scene.
var nextScene = GD.Load<PackedScene>(path);
@ -128,9 +127,10 @@ public partial class GlobalState : Node
DeferredAddStartDataToGameManager(startData);
}
if (GameManager.Instance is not null) {
GameManager.Instance.ApplySessionState(SessionSettings);
}
// Do not do this here because it might get the old gamemanager instead
// if (GameManager.Instance is not null) {
// GameManager.Instance.ApplySessionState(SessionSettings);
// }
FadeIn();
}