protected override void OnLocationChange(Point3D oldLoc) { if( Cannon == null ) { Cannon = new CannonEast(this); Direction = Direction.East; Cannon.MoveToWorld( new Point3D(X + 1,Y,Z), Map); } else { Direction = Direction.East; Cannon.MoveToWorld( new Point3D(X + 1,Y,Z), Map); } base.OnLocationChange(oldLoc); }
public void UnHitch() { Mobile from = m_Owner; Mobile mount = m_Hitch; Map map = Map; Point3D p = Location; BaseCannon cn = null; switch( Direction ) { case Direction.Up: case Direction.North: { cn = new CannonNorth(m_Owner); break; } case Direction.Down: case Direction.South: { cn = new CannonSouth(m_Owner); break; } case Direction.Right: case Direction.East: { cn = new CannonEast(m_Owner); break; } case Direction.Left: case Direction.West: { cn = new CannonWest(m_Owner); break; } } cn.CCom.HitsMax = m_HitsMax; cn.CCom.Hits = m_Hits; Delete(); bool canspawn = true; if( !mount.Deleted && mount != null && !mount.IsDeadBondedPet && mount.Map != Map.Internal && from.InRange(p,5) && ((BaseCreature)m_Hitch).ControlMaster == m_Owner ) { foreach( AddonComponent ac in cn.Components ) { if( !map.CanSpawnMobile(new Point3D(p.X + ac.Offset.X,p.Y + ac.Offset.Y,p.Z + ac.Offset.Z) ) ) canspawn = false; } } if( !canspawn ) { from.SendLocalizedMessage( 1011578 ); // There is an obstacle blocking this location or part of the structure would be on invalid terrain. MovableCannon mc = new MovableCannon(from,mount); mc.HitsMax = cn.CCom.HitsMax; mc.Hits = cn.CCom.Hits; mc.Location = p; cn.Delete(); } else { from.SendMessage("The Cannon has been unhitched."); cn.MoveToWorld(p,map); } }
public void UnHitch() { Mobile from = m_Owner; Mobile mount = m_Hitch; Map map = Map; Point3D p = Location; BaseCannon cn = null; switch (Direction) { case Direction.Up: case Direction.North: { cn = new CannonNorth(m_Owner); break; } case Direction.Down: case Direction.South: { cn = new CannonSouth(m_Owner); break; } case Direction.Right: case Direction.East: { cn = new CannonEast(m_Owner); break; } case Direction.Left: case Direction.West: { cn = new CannonWest(m_Owner); break; } } Delete(); bool canspawn = true; if (!mount.Deleted && mount != null && !mount.IsDeadBondedPet && mount.Map != Map.Internal && from.InRange(p, 5) && ((BaseCreature)m_Hitch).ControlMaster == m_Owner) { foreach (AddonComponent ac in cn.Components) { if (!map.CanSpawnMobile(new Point3D(p.X + ac.Offset.X, p.Y + ac.Offset.Y, p.Z + ac.Offset.Z))) { canspawn = false; } } } if (!canspawn) { from.SendLocalizedMessage(1011578); // There is an obstacle blocking this location or part of the structure would be on invalid terrain. MovableCannon mc = new MovableCannon(from, mount); mc.Location = p; cn.Delete(); } else { from.SendMessage("The Cannon has been unhitched."); cn.MoveToWorld(p, map); } }
public override void OnThink() { if( Combatant == null ) return; Direction d = this.GetDirectionTo(Combatant); if( Direction != d ) Direction = d; if( Cannon.Direction != Direction ) { switch (Direction) { case Direction.Up: case Direction.North: { Cannon.Delete(); Cannon = new CannonNorth(this); Cannon.MoveToWorld( new Point3D(X,Y - 3,Z), Map); Cannon.Direction = Direction; break; } case Direction.Down: case Direction.South: { Cannon.Delete(); Cannon = new CannonSouth(this); Cannon.MoveToWorld( new Point3D(X,Y + 1,Z), Map); Cannon.Direction = Direction; break; } case Direction.Right: case Direction.East: { Cannon.Delete(); Cannon = new CannonEast(this); Cannon.MoveToWorld( new Point3D(X + 1,Y,Z), Map); Cannon.Direction = Direction; break; } case Direction.Left: case Direction.West: { Cannon.Delete(); Cannon = new CannonWest(this); Cannon.MoveToWorld( new Point3D(X - 3,Y,Z), Map); Cannon.Direction = Direction; break; } } } base.OnThink(); }
public void GetDirection() { switch (Direction) { case Direction.Up: case Direction.North: { Cannon.Delete(); Cannon = new CannonNorth(this); Cannon.MoveToWorld( new Point3D(X,Y - 3,Z), Map); Cannon.Direction = Direction; break; } case Direction.Down: case Direction.South: { Cannon.Delete(); Cannon = new CannonSouth(this); Cannon.MoveToWorld( new Point3D(X,Y + 1,Z), Map); Cannon.Direction = Direction; break; } case Direction.Right: case Direction.East: { Cannon.Delete(); Cannon = new CannonEast(this); Cannon.MoveToWorld( new Point3D(X + 1,Y,Z), Map); Cannon.Direction = Direction; break; } case Direction.Left: case Direction.West: { Cannon.Delete(); Cannon = new CannonWest(this); Cannon.MoveToWorld( new Point3D(X - 3,Y,Z), Map); Cannon.Direction = Direction; break; } } }