Ejemplo n.º 1
0
        // 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();
        }
Ejemplo n.º 2
0
        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();
        }