player indicators: draw tile highlight on ABOVE_SCENE layer (#4629)
Fixes #1564
This commit is contained in:
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.playerindicators;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Polygon;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -67,15 +66,6 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
|
|
||||||
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color)
|
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color)
|
||||||
{
|
{
|
||||||
if (config.drawTiles())
|
|
||||||
{
|
|
||||||
Polygon poly = actor.getCanvasTilePoly();
|
|
||||||
if (poly != null)
|
|
||||||
{
|
|
||||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config.drawOverheadPlayerNames())
|
if (!config.drawOverheadPlayerNames())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private PlayerIndicatorsOverlay playerIndicatorsOverlay;
|
private PlayerIndicatorsOverlay playerIndicatorsOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private PlayerIndicatorsTileOverlay playerIndicatorsTileOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PlayerIndicatorsMinimapOverlay playerIndicatorsMinimapOverlay;
|
private PlayerIndicatorsMinimapOverlay playerIndicatorsMinimapOverlay;
|
||||||
|
|
||||||
@@ -78,6 +81,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.add(playerIndicatorsOverlay);
|
overlayManager.add(playerIndicatorsOverlay);
|
||||||
|
overlayManager.add(playerIndicatorsTileOverlay);
|
||||||
overlayManager.add(playerIndicatorsMinimapOverlay);
|
overlayManager.add(playerIndicatorsMinimapOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +89,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.remove(playerIndicatorsOverlay);
|
overlayManager.remove(playerIndicatorsOverlay);
|
||||||
|
overlayManager.remove(playerIndicatorsTileOverlay);
|
||||||
overlayManager.remove(playerIndicatorsMinimapOverlay);
|
overlayManager.remove(playerIndicatorsMinimapOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Kamiel <https://github.com/Kamielvf>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.runelite.client.plugins.playerindicators;
|
||||||
|
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Polygon;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
|
|
||||||
|
public class PlayerIndicatorsTileOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private final PlayerIndicatorsService playerIndicatorsService;
|
||||||
|
private final PlayerIndicatorsConfig config;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private PlayerIndicatorsTileOverlay(PlayerIndicatorsConfig config, PlayerIndicatorsService playerIndicatorsService)
|
||||||
|
{
|
||||||
|
this.config = config;
|
||||||
|
this.playerIndicatorsService = playerIndicatorsService;
|
||||||
|
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||||
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setPriority(OverlayPriority.MED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (!config.drawTiles())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
playerIndicatorsService.forEachPlayer((player, color) ->
|
||||||
|
{
|
||||||
|
final Polygon poly = player.getCanvasTilePoly();
|
||||||
|
|
||||||
|
if (poly != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user