#W# InnExitDoor and go locations.

This commit is contained in:
WarrentyExpired 2026-08-23 15:22:22 -04:00
parent 66c963c885
commit aa8e3e15d8
5 changed files with 170 additions and 257 deletions

View file

@ -134,8 +134,33 @@ namespace Server.Custom.InnRooms
private void TeleportToRoom(Mobile m)
{
Point3D dest = RoomLocation;
// Scans the void room (up to 12 tiles away from center) to find your physical exit door
if (RoomMap != null)
{
IPooledEnumerable eable = RoomMap.GetItemsInRange(RoomLocation, 12);
foreach (Item item in eable)
{
if (item is InnExitDoor)
{
dest = item.Location; // Teleports them exactly where you placed the exit!
break;
}
}
eable.Free();
}
// Save their exact spot in the tavern so the exit door knows where to return them
if (m is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)m;
pm.LastInnLocation = m.Location;
pm.LastInnMap = m.Map;
}
m.PlaySound(0x1EA);
m.MoveToWorld(RoomLocation, RoomMap);
m.MoveToWorld(dest, RoomMap);
m.SendMessage(0x3B2, "You enter the inn room.");
}
@ -187,6 +212,20 @@ namespace Server.Custom.InnRooms
}
m_House.Delete();
// Kick anyone currently inside the room back to the tavern door
List<Mobile> insideMobiles = m_House.GetMobiles();
foreach (Mobile m in insideMobiles)
{
if (m is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)m;
// Send them right back to this physical InnDoor in the town
pm.MoveToWorld(this.Location, this.Map);
pm.LastInnLocation = Point3D.Zero;
pm.LastInnMap = null;
pm.SendMessage(33, "The rent has expired and you have been evicted from the room.");
}
}
}
m_Renter = null;