Beispiel #1
0
    public void RemoveFurniture(TileOWW tile)
    {
        string furnitureType = tile.GetInstalledFurniture()?.GetFurnitureType();

        // 'Airlock' may be in 'Airlock Open' state
        if (furnitureType == "Airlock Open")
        {
            furnitureType = "Airlock";
        }

        // Update pathfinding
        if (furnitureType == "Wall")
        {
            // TODO: reset all failed jobs
        }

        tile.RemoveInstalledFurniture();

        // Multi-tile references
        for (int i = 0; i < furnitureTypes[furnitureType].sizeX; i++)
        {
            for (int j = 0; j < furnitureTypes[furnitureType].sizeY; j++)
            {
                TileOWW temp = WorldController.Instance.GetWorld().GetTileAt(tile.GetX() + i, tile.GetY() + j);
                temp.installedFurnitureAltX = null;
                temp.installedFurnitureAltY = null;

                if (tile.GetTileType() == "Hull")
                {
                    emptyHullTiles.Add(tile);
                }
            }
        }

        // Remove from map of furnitureType TileOWW
        while (furnitureTileOWWMap[furnitureType].Contains(tile))
        {
            furnitureTileOWWMap[furnitureType].Remove(tile);
        }

        ObjectiveController.Instance.CheckObjectives();
    }