object indicators: fix marking multilocs after var changes
If a var changes after the marked objects are loaded, causing the object's name to match a marked object, it would not be identified due to it not firing spawn events
This commit is contained in:
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.objectindicators;
|
||||
import java.awt.Color;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.TileObject;
|
||||
|
||||
/**
|
||||
@@ -38,5 +39,13 @@ import net.runelite.api.TileObject;
|
||||
class ColorTileObject
|
||||
{
|
||||
private final TileObject tileObject;
|
||||
/**
|
||||
* Non-transformed object composition for the object
|
||||
*/
|
||||
private final ObjectComposition composition;
|
||||
/**
|
||||
* Name to highlight for multilocs
|
||||
*/
|
||||
private final String name;
|
||||
private final Color color;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.DecorativeObject;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GroundObject;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.WallObject;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -71,6 +72,18 @@ class ObjectIndicatorsOverlay extends Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
ObjectComposition composition = colorTileObject.getComposition();
|
||||
if (composition.getImpostorIds() != null)
|
||||
{
|
||||
// This is a multiloc
|
||||
composition = composition.getImpostor();
|
||||
// Only mark the object if the name still matches
|
||||
if (composition == null || !composition.getName().equals(colorTileObject.getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (color == null || !config.rememberObjectColors())
|
||||
{
|
||||
// Fallback to the current config if the object is marked before the addition of multiple colors
|
||||
|
||||
@@ -292,16 +292,15 @@ public class ObjectIndicatorsPlugin extends Plugin
|
||||
{
|
||||
if (worldPoint.getRegionX() == objectPoint.getRegionX()
|
||||
&& worldPoint.getRegionY() == objectPoint.getRegionY()
|
||||
&& worldPoint.getPlane() == objectPoint.getZ())
|
||||
&& worldPoint.getPlane() == objectPoint.getZ()
|
||||
&& objectPoint.getId() == object.getId())
|
||||
{
|
||||
// Transform object to get the name which matches against what we've stored
|
||||
ObjectComposition composition = getObjectComposition(object.getId());
|
||||
if (composition != null && objectPoint.getName().equals(composition.getName()))
|
||||
{
|
||||
log.debug("Marking object {} due to matching {}", object, objectPoint);
|
||||
objects.add(new ColorTileObject(object, objectPoint.getColor()));
|
||||
break;
|
||||
}
|
||||
log.debug("Marking object {} due to matching {}", object, objectPoint);
|
||||
objects.add(new ColorTileObject(object,
|
||||
client.getObjectDefinition(object.getId()),
|
||||
objectPoint.getName(),
|
||||
objectPoint.getColor()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -415,7 +414,10 @@ public class ObjectIndicatorsPlugin extends Plugin
|
||||
else
|
||||
{
|
||||
objectPoints.add(point);
|
||||
objects.add(new ColorTileObject(object, color));
|
||||
objects.add(new ColorTileObject(object,
|
||||
client.getObjectDefinition(object.getId()),
|
||||
name,
|
||||
color));
|
||||
log.debug("Marking object: {}", point);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user