// In Editor when the platform prop is initialized
        // the game server will try to replace the water tiles
        // under the platform with a bridge tile variant.
        private static void ServerEditorReplaceWaterTilesWithBridge(IStaticWorldObject gameObject)
        {
            IWorldServerService serverWorld = null;

            foreach (var tile in gameObject.OccupiedTiles)
            {
                if (!(tile.ProtoTile is IProtoTileWater protoTileWater))
                {
                    continue;
                }

                var bridgeProtoTile = protoTileWater.BridgeProtoTile;
                if (ReferenceEquals(protoTileWater, bridgeProtoTile) ||
                    bridgeProtoTile is null)
                {
                    continue;
                }

                serverWorld = Server.World;

                // replace proto tile with bridge
                serverWorld.SetTileData(tile.Position,
                                        bridgeProtoTile,
                                        tile.Height,
                                        tile.IsSlope,
                                        tile.IsCliff);
            }

            serverWorld?.FixMapTilesRecentlyModified();
        }
        // In Editor when the platform prop is initialized
        // the game server will try to replace the water tiles
        // under the platform with a bridge tile variant.
        private static void ServerEditorReplaceWaterTilesWithBridge(IStaticWorldObject gameObject)
        {
            IWorldServerService world = null;

            foreach (var tile in gameObject.OccupiedTiles)
            {
                var currentProtoTile = tile.ProtoTile;
                if (!(currentProtoTile is IProtoTileWater protoTileWater))
                {
                    if (tile.IsCliffOrSlope)
                    {
                        (world ??= Server.World)
                        .SetTileData(tile.Position,
                                     currentProtoTile,
                                     tile.Height,
                                     isSlope: false,
                                     isCliff: false);
                    }

                    continue;
                }

                var bridgeProtoTile = protoTileWater.BridgeProtoTile;
                if (ReferenceEquals(protoTileWater, bridgeProtoTile) ||
                    bridgeProtoTile is null)
                {
                    continue;
                }

                // replace proto tile with bridge
                (world ??= Server.World)
                .SetTileData(tile.Position,
                             bridgeProtoTile,
                             tile.Height,
                             isSlope: false,
                             isCliff: false);
            }

            world?.FixMapTilesRecentlyModified();
        }
        private static void ServerEditorReplaceBridgeTilesWithPlaceholder(IStaticWorldObject gameObject)
        {
            IWorldServerService serverWorld = null;

            foreach (var tile in gameObject.OccupiedTiles)
            {
                if (!(tile.ProtoTile is IProtoTileWater))
                {
                    continue;
                }

                serverWorld = Server.World;

                // replace proto tile with a sea water tile
                serverWorld.SetTileData(tile.Position,
                                        Api.GetProtoEntity <TileWaterSea>(),
                                        tile.Height,
                                        tile.IsSlope,
                                        tile.IsCliff);
            }

            serverWorld?.FixMapTilesRecentlyModified();
        }