Create() публичный Метод

Creates the zone boundaries, and sets CreatedDate/CreatedBy.
public Create ( [ bounds, [ createdBy ) : void
bounds [ New zone boundaries.
createdBy [ Player who created this zone. May not be null.
Результат void
Пример #1
0
        static void DoorAdd(Player player, Vector3I[] marks, object tag)
        {
            int sx = Math.Min(marks[0].X, marks[1].X);
            int ex = Math.Max(marks[0].X, marks[1].X);
            int sy = Math.Min(marks[0].Y, marks[1].Y);
            int ey = Math.Max(marks[0].Y, marks[1].Y);
            int sh = Math.Min(marks[0].Z, marks[1].Z);
            int eh = Math.Max(marks[0].Z, marks[1].Z);

            int volume = (ex - sx + 1) * (ey - sy + 1) * (eh - sh + 1);

            if (volume > maxDoorBlocks)
            {
                player.Message("Doors are only allowed to be {0} blocks", maxDoorBlocks);
                return;
            }

            Zone door = (Zone)tag;

            door.Create(new BoundingBox(marks[0], marks[1]), player.Info);
            player.WorldMap.Zones.Add(door);
            Logger.Log(LogType.UserActivity, "{0} created door {1} (on world {2})", player.Name, door.Name, player.World.Name);
            player.Message("Door created: {0}x{1}x{2}", door.Bounds.Dimensions.X,
                           door.Bounds.Dimensions.Y,
                           door.Bounds.Dimensions.Z);
        }
Пример #2
0
        private static void ZoneAddCallback(Player player, Vector3I[] marks, object tag)
        {
            World playerWorld = player.World;

            if (playerWorld == null)
            {
                PlayerOpException.ThrowNoWorld(player);
            }

            if (!player.Info.Rank.AllowSecurityCircumvention)
            {
                SecurityCheckResult buildCheck = playerWorld.BuildSecurity.CheckDetailed(player.Info);
                switch (buildCheck)
                {
                case SecurityCheckResult.BlackListed:
                    player.Message("Cannot add zones to world {0}&S: You are barred from building here.",
                                   playerWorld.ClassyName);
                    return;

                case SecurityCheckResult.RankTooLow:
                    player.Message("Cannot add zones to world {0}&S: You are not allowed to build here.",
                                   playerWorld.ClassyName);
                    return;
                    //case SecurityCheckResult.RankTooHigh:
                }
            }

            Zone zone  = (Zone)tag;
            var  zones = player.WorldMap.Zones;

            lock (zones.SyncRoot)
            {
                Zone dupeZone = zones.FindExact(zone.Name);
                if (dupeZone != null)
                {
                    player.Message("A zone named \"{0}\" has just been created by {1}",
                                   dupeZone.Name, dupeZone.CreatedBy);
                    return;
                }

                zone.Create(new BoundingBox(marks[0], marks[1]), player.Info);

                player.Message("Zone \"{0}\" created, {1} blocks total.",
                               zone.Name, zone.Bounds.Volume);
                Logger.Log(LogType.UserActivity,
                           "Player {0} created a new zone \"{1}\" containing {2} blocks.",
                           player.Name,
                           zone.Name,
                           zone.Bounds.Volume);

                zones.Add(zone);
            }
        }
Пример #3
0
        internal static void ZoneAddCallback(Player player, Position[] marks, object tag)
        {
            Zone zone = (Zone)tag;

            zone.Create(new BoundingBox(marks[0], marks[1]), player.Info);

            player.Message("Zone \"{0}\" created, {1} blocks total.",
                           zone.Name,
                           zone.Bounds.Volume);
            Logger.Log("Player {0} created a new zone \"{1}\" containing {2} blocks.", LogType.UserActivity,
                       player.Name,
                       zone.Name,
                       zone.Bounds.Volume);

            player.World.Map.AddZone(zone);
        }
Пример #4
0
		static void InitZones() {
			Zone zoneRed = new Zone();
			zoneRed.Name = RedTeam.Name;
			Vector3I redFirst = new Vector3I(map.Bounds.XMin, map.Bounds.YMin, map.Bounds.ZMin);
			Vector3I redSecond = new Vector3I(map.Bounds.Width / 2 - 2, map.Bounds.Length, map.Bounds.ZMax);
			zoneRed.Create(new BoundingBox(redFirst, redSecond), Player.Console.Info);
			map.Zones.Remove(zoneRed.Name);
			map.Zones.Add(zoneRed);
			RedTeam.SetBounds(redFirst, redSecond);

			Zone zoneBlue = new Zone();
			zoneBlue.Name = BlueTeam.Name;
			Vector3I blueFirst = new Vector3I(map.Bounds.XMax, map.Bounds.YMin, map.Bounds.ZMin);
			Vector3I blueSecond = new Vector3I((map.Bounds.Width / 2) + 2, map.Bounds.Length, map.Bounds.ZMax);
			zoneBlue.Create(new BoundingBox(blueFirst, blueSecond), Player.Console.Info);
			map.Zones.Remove(zoneBlue.Name);
			map.Zones.Add(zoneBlue);
			BlueTeam.SetBounds(blueFirst, blueSecond);
		}