fCraft.Zone.Create C# (CSharp) Method

Create() public method

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.
return void
        public void Create( [NotNull] BoundingBox bounds, [NotNull] PlayerInfo createdBy )
        {
            if ( bounds == null )
                throw new ArgumentNullException( "bounds" );
            if ( createdBy == null )
                throw new ArgumentNullException( "createdBy" );
            CreatedDate = DateTime.UtcNow;
            Bounds = bounds;
            CreatedBy = createdBy.Name;
        }

Usage Example

Example #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);
        }
All Usage Examples Of fCraft.Zone::Create