object indicators: support non-gameobject multilocs
This commit is contained in:
@@ -333,47 +333,57 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
|
||||||
final ObjectComposition comp = client.getObjectDefinition(object.getId());
|
|
||||||
|
|
||||||
if (comp.getImpostorIds() != null)
|
|
||||||
{
|
|
||||||
for (int impostorId : comp.getImpostorIds())
|
|
||||||
{
|
|
||||||
if (impostorId == id)
|
|
||||||
{
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
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
|
||||||
|
// all of the GAME_OBJECT_OPTION actions, so check the id against the impostor ids
|
||||||
|
final ObjectComposition comp = client.getObjectDefinition(tileObject.getId());
|
||||||
|
|
||||||
|
if (comp.getImpostorIds() != null)
|
||||||
|
{
|
||||||
|
for (int impostorId : comp.getImpostorIds())
|
||||||
|
{
|
||||||
|
if (impostorId == id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void markObject(String name, final TileObject object)
|
private void markObject(String name, final TileObject object)
|
||||||
{
|
{
|
||||||
if (object == null)
|
if (object == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user