object indicators: support non-gameobject multilocs

This commit is contained in:
Adam
2019-10-02 19:31:27 -04:00
parent d6772a3be4
commit b22fc6b301

View File

@@ -333,31 +333,42 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
final DecorativeObject tileDecorativeObject = tile.getDecorativeObject(); final DecorativeObject tileDecorativeObject = tile.getDecorativeObject();
final WallObject tileWallObject = tile.getWallObject(); final WallObject tileWallObject = tile.getWallObject();
if (tileWallObject != null && tileWallObject.getId() == id) if (objectIdEquals(tileWallObject, id))
{ {
return tileWallObject; return tileWallObject;
} }
if (tileDecorativeObject != null && tileDecorativeObject.getId() == id) if (objectIdEquals(tileDecorativeObject, id))
{ {
return tileDecorativeObject; return tileDecorativeObject;
} }
for (GameObject object : tileGameObjects) for (GameObject object : tileGameObjects)
{ {
if (object == null) if (objectIdEquals(object, id))
{
continue;
}
if (object.getId() == id)
{ {
return object; return object;
} }
}
return null;
}
private boolean objectIdEquals(TileObject tileObject, int id)
{
if (tileObject == null)
{
return false;
}
if (tileObject.getId() == id)
{
return true;
}
// Menu action EXAMINE_OBJECT sends the transformed object id, not the base id, unlike // Menu action EXAMINE_OBJECT sends the transformed object id, not the base id, unlike
// all of the GAME_OBJECT_OPTION actions, so check the id against the impostor ids // all of the GAME_OBJECT_OPTION actions, so check the id against the impostor ids
final ObjectComposition comp = client.getObjectDefinition(object.getId()); final ObjectComposition comp = client.getObjectDefinition(tileObject.getId());
if (comp.getImpostorIds() != null) if (comp.getImpostorIds() != null)
{ {
@@ -365,13 +376,12 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
{ {
if (impostorId == id) if (impostorId == id)
{ {
return object; return true;
}
} }
} }
} }
return null; return false;
} }
private void markObject(String name, final TileObject object) private void markObject(String name, final TileObject object)