Exemplo n.º 1
0
    public static void Close()
    {
        if (Game.RuntimeRoot.HasNode("SkyScene"))
        {
            Game.RuntimeRoot.GetNode("SkyScene").Free();
            //Free instead of QueueFree to prevent crash when starting new world in same frame
        }

        //This is NOT a leak! Their parent was just freed ^
        TilesRoot    = null;
        EntitiesRoot = null;
        MobsRoot     = null;

        Net.Players.Clear();
        Game.PossessedPlayer = null;

        Pathfinder.Clear();
        Chunks.Clear();
        RemoteLoadedChunks.Clear();
        ItemList.Clear();
        Grid.Clear();

        Items.IdInfos.Clear();

        SaveName = null;
        IsOpen   = false;
    }