diff --git a/src/resources/commands/callbacks/WaypointCmdCallback.java b/src/resources/commands/callbacks/WaypointCmdCallback.java index c7b087fd..55466c60 100644 --- a/src/resources/commands/callbacks/WaypointCmdCallback.java +++ b/src/resources/commands/callbacks/WaypointCmdCallback.java @@ -32,6 +32,9 @@ import resources.Location; import resources.Terrain; import resources.commands.ICmdCallback; import resources.objects.SWGObject; +import resources.objects.building.BuildingObject; +import resources.objects.cell.CellObject; +import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import resources.objects.waypoint.WaypointObject; import resources.objects.waypoint.WaypointObject.WaypointColor; @@ -146,7 +149,8 @@ public class WaypointCmdCallback implements ICmdCallback { return; } - Location location = new Location(player.getCreatureObject().getLocation()); + CreatureObject creature = player.getCreatureObject(); + Location location = creature.getWorldLocation(); if (!Float.isNaN(x)) location.setX(x); @@ -183,7 +187,6 @@ public class WaypointCmdCallback implements ICmdCallback { WaypointObject waypoint = (WaypointObject) objManager.createObject("object/waypoint/shared_waypoint.iff", location, false); waypoint.setColor(color); waypoint.setName(name); - // TODO: Check if the location collides with a building, and if it does then set the proper cellId return waypoint; } diff --git a/src/resources/objects/SWGObject.java b/src/resources/objects/SWGObject.java index faf8c32c..ce516a74 100644 --- a/src/resources/objects/SWGObject.java +++ b/src/resources/objects/SWGObject.java @@ -46,6 +46,7 @@ import resources.containers.DefaultPermissions; import resources.encodables.StringId; import resources.network.BaselineBuilder; import resources.network.DeltaBuilder; +import resources.objects.building.BuildingObject; import resources.objects.creature.CreatureObject; import resources.player.Player; import resources.player.PlayerState; @@ -875,7 +876,15 @@ public abstract class SWGObject implements Serializable, Comparable { } } } - + + public boolean isInBuilding() { + SWGObject parent = getParent(); + if (parent == null) + return false; + parent = parent.getParent(); + return parent != null && parent instanceof BuildingObject; + } + @Override public String toString() { return "SWGObject[ID=" + objectId + " NAME=" + objectName + " TEMPLATE=" + template + "]";