Merge pull request #8827 from abextm/wall-orient-2

correct misunderstandings related to wall orientation
This commit is contained in:
Adam
2019-05-24 16:14:40 -04:00
committed by GitHub
3 changed files with 40 additions and 13 deletions

View File

@@ -25,28 +25,33 @@
package net.runelite.api; package net.runelite.api;
/** /**
* Represents the wall of a tile, which is an un-passable boundary. * Represents one or two walls on a tile
*/ */
public interface WallObject extends TileObject public interface WallObject extends TileObject
{ {
/** /**
* Gets the first orientation of the wall. * A bitfield with the orientation of a wall
* * 1 = East
* @return the first orientation, 0-2048 where 0 is north * 2 = North
* 4 = West
* 8 = South
*/ */
int getOrientationA(); int getOrientationA();
/** /**
* Gets the second orientation value of the wall. * A bitfield containing the orientation of the second wall on this tile,
* * or 0 if there is no second wall.
* @return the second orientation, 0-2048 where 0 is north * @see #getOrientationA
*/ */
int getOrientationB(); int getOrientationB();
/** /**
* Gets the boundary configuration of the wall. * A bitfield containing various flags:
* * <pre>{@code
* @return the boundary configuration * object type id = bits & 0x20
* orientation (0-3) = bits >>> 6 & 3
* supports items = bits >>> 8 & 1
* }</pre>
*/ */
int getConfig(); int getConfig();

View File

@@ -110,7 +110,29 @@ public abstract class RSDecorativeObjectMixin implements RSDecorativeObject
@Override @Override
public Area getClickbox() public Area getClickbox()
{ {
return Perspective.getClickbox(client, getModel(), getOrientation(), getLocalLocation()); Area clickbox = new Area();
LocalPoint lp = getLocalLocation();
Area clickboxA = Perspective.getClickbox(client, getModel(), 0,
new LocalPoint(lp.getX() + getXOffset(), lp.getY() + getYOffset()));
Area clickboxB = Perspective.getClickbox(client, getModel2(), 0, lp);
if (clickboxA == null && clickboxB == null)
{
return null;
}
if (clickboxA != null)
{
clickbox.add(clickboxA);
}
if (clickboxB != null)
{
clickbox.add(clickboxB);
}
return clickbox;
} }
@Inject @Inject

View File

@@ -101,8 +101,8 @@ public abstract class RSWallObjectMixin implements RSWallObject
{ {
Area clickbox = new Area(); Area clickbox = new Area();
Area clickboxA = Perspective.getClickbox(client, getModelA(), getOrientationA(), getLocalLocation()); Area clickboxA = Perspective.getClickbox(client, getModelA(), 0, getLocalLocation());
Area clickboxB = Perspective.getClickbox(client, getModelB(), getOrientationB(), getLocalLocation()); Area clickboxB = Perspective.getClickbox(client, getModelB(), 0, getLocalLocation());
if (clickboxA == null && clickboxB == null) if (clickboxA == null && clickboxB == null)
{ {