Add currently hovered tile to TileIndicators
- Add tile that is currently being hovered to tile indicators. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -41,4 +41,24 @@ public interface TileIndicatorsConfig extends Config
|
||||
{
|
||||
return Color.GRAY;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "highlightDestinationTile",
|
||||
name = "Highlight destination tile",
|
||||
description = "Highlights tile player is walking to"
|
||||
)
|
||||
default boolean highlightDestinationTile()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "highlightHoveredTile",
|
||||
name = "Highlight hovered tile",
|
||||
description = "Highlights tile player is hovering with mouse"
|
||||
)
|
||||
default boolean highlightHoveredTile()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.tileindicators;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
@@ -39,6 +40,7 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
public class TileIndicatorsOverlay extends Overlay
|
||||
{
|
||||
private static final Color EMPTY = new Color(0, 0, 0, 0);
|
||||
private final Client client;
|
||||
private final TileIndicatorsConfig config;
|
||||
|
||||
@@ -55,20 +57,44 @@ public class TileIndicatorsOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
LocalPoint dest = client.getLocalDestinationLocation();
|
||||
if (dest == null)
|
||||
if (config.highlightHoveredTile())
|
||||
{
|
||||
return null;
|
||||
// Update selected scene tile
|
||||
if (!client.isMenuOpen())
|
||||
{
|
||||
client.setCheckClick(true);
|
||||
client.setMouseCanvasHoverPosition(client.getMouseCanvasPosition());
|
||||
}
|
||||
|
||||
// If we have tile "selected" render it
|
||||
if (client.getSelectedSceneTile() != null)
|
||||
{
|
||||
renderTile(graphics, client.getSelectedSceneTile().getLocalLocation(), EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
Polygon poly = Perspective.getCanvasTilePoly(client, dest);
|
||||
if (poly == null)
|
||||
if (config.highlightDestinationTile())
|
||||
{
|
||||
return null;
|
||||
renderTile(graphics, client.getLocalDestinationLocation(), config.highlightDestinationColor());
|
||||
}
|
||||
|
||||
OverlayUtil.renderPolygon(graphics, poly, config.highlightDestinationColor());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderTile(final Graphics2D graphics, final LocalPoint dest, final Color color)
|
||||
{
|
||||
if (dest == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Polygon poly = Perspective.getCanvasTilePoly(client, dest);
|
||||
|
||||
if (poly == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user