Example #1
0
        public List<PathCoordinate> CreatePathToCoordinate(EntityBase entityFrom, AbsWorldCoords coordinate, double maxDistance = 24.0, double untilDistanceToTarget = 1.0)
        {
            PathCoordinate start = GetCoordinateFromCacheOrAdd(entityFrom.BlockPosition);
            PathCoordinate end = GetCoordinateFromCacheOrAdd(UniversalCoords.FromAbsWorld(coordinate.X - (entityFrom.Width * 0.5), coordinate.Y, coordinate.Z - (entityFrom.Width * 0.5)));
            Size size = new Size((int)Math.Floor(entityFrom.Width + 1.0), (int)Math.Floor(entityFrom.Height + 1.0));

            return GeneratePath(start, end, size, maxDistance, untilDistanceToTarget);
        }
Example #2
0
        protected BaseFallingPhysics(WorldManager world, AbsWorldCoords pos)
        {
            World = world;
            Position = pos;
            EntityId = world.Server.AllocateEntity();

            CreateEntityPacket entity = new CreateEntityPacket { EntityId = EntityId };
            World.Server.SendPacketToNearbyPlayers(World,
                                                   UniversalCoords.FromAbsWorld(Position),
                                                   entity);
        }
Example #3
0
        public override void Simulate()
        {
            int x = (int)Math.Floor(Position.X);
            int y = (int)Math.Floor(Position.Y);
            int z = (int)Math.Floor(Position.Z);
            byte? blockId = World.GetBlockId(x, y, z);
            if (blockId == null || blockId != (byte)BlockData.Blocks.Air)
            {
                Stop();
                return;
            }

            if (Position.Y <= 1)
            {
                Stop(true);
                return;
            }

            Position = new AbsWorldCoords(Position.ToVector() + Velocity);
        }
Example #4
0
 public static UniversalCoords FromAbsWorld(AbsWorldCoords absWorldCoords)
 {
     return FromAbsWorld(absWorldCoords.X, absWorldCoords.Y, absWorldCoords.Z);
 }
Example #5
0
 public FallingSand(WorldManager world, AbsWorldCoords pos) : base(world, pos)
 {
     Type = Net.Packets.AddObjectVehiclePacket.ObjectType.FallingObjects;
     BlockId = (byte) BlockData.Blocks.Sand;
     Velocity = new Vector3(0, -0.4D, 0);
 }
Example #6
0
 public BoundingBox(AbsWorldCoords minimum, AbsWorldCoords maximum)
     : this(minimum.ToVector(), maximum.ToVector())
 {
 }
Example #7
0
 public static UniversalCoords FromAbsWorld(AbsWorldCoords absWorldCoords)
 {
     return(FromAbsWorld(absWorldCoords.X, absWorldCoords.Y, absWorldCoords.Z));
 }
Example #8
0
 public EntityMoveEventArgs(IEntityBase entity, AbsWorldCoords newPosition, AbsWorldCoords oldPosition) 
     : base(entity)
 {
     NewPosition = newPosition;
     OldPosition = oldPosition;
 }
Example #9
0
 public EntitySpawnEventArgs(IEntityBase entity, AbsWorldCoords Location)
     : base(entity)
 {
     this.Location = Location;
 }
Example #10
0
 public FallingGravel(WorldManager world, AbsWorldCoords pos) : base(world, pos)
 {
     Type = Net.Packets.AddObjectVehiclePacket.ObjectType.FallingObjects;
     BlockId = (byte) BlockData.Blocks.Gravel;
 }