MLM Plugin: Add toggle for rocks highlighting (#6181)

Splits the showRocks config into showVeins and showRocks so that the user can decide to show only Veins without the visual clutter of the RockFalls forced highlighting.
This commit is contained in:
Alexsuperfly
2018-11-23 07:23:57 -05:00
committed by Tomas Slusny
parent c395b2b81f
commit ef567e364f
2 changed files with 31 additions and 13 deletions

View File

@@ -33,11 +33,21 @@ import net.runelite.client.config.ConfigItem;
public interface MotherlodeConfig extends Config
{
@ConfigItem(
keyName = "showRocks",
keyName = "showVeins",
name = "Show pay-dirt mining spots",
description = "Configures whether or not the pay-dirt mining spots are displayed."
)
default boolean showRocks()
default boolean showVeins()
{
return true;
}
@ConfigItem(
keyName = "showRocks",
name = "Show rocks obstacles",
description = "Configures whether or not the fallen rocks obstacles are displayed."
)
default boolean showRockFalls()
{
return true;
}

View File

@@ -71,7 +71,7 @@ class MotherlodeRocksOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics)
{
if (!config.showRocks() || !plugin.isInMlm())
if ((!config.showVeins() && !config.showRockFalls()) || !plugin.isInMlm())
{
return null;
}
@@ -86,27 +86,35 @@ class MotherlodeRocksOverlay extends Overlay
private void renderTiles(Graphics2D graphics, Player local)
{
LocalPoint localLocation = local.getLocalLocation();
for (WallObject vein : plugin.getVeins())
if (config.showVeins())
{
LocalPoint location = vein.getLocalLocation();
if (localLocation.distanceTo(location) <= MAX_DISTANCE)
for (WallObject vein : plugin.getVeins())
{
// Only draw veins on the same level
if (plugin.isUpstairs(localLocation) == plugin.isUpstairs(vein.getLocalLocation()))
LocalPoint location = vein.getLocalLocation();
if (localLocation.distanceTo(location) <= MAX_DISTANCE)
{
renderVein(graphics, vein);
// Only draw veins on the same level
if (plugin.isUpstairs(localLocation) == plugin.isUpstairs(vein.getLocalLocation()))
{
renderVein(graphics, vein);
}
}
}
}
for (GameObject rock : plugin.getRocks())
if (config.showRockFalls())
{
LocalPoint location = rock.getLocalLocation();
if (localLocation.distanceTo(location) <= MAX_DISTANCE)
for (GameObject rock : plugin.getRocks())
{
renderRock(graphics, rock);
LocalPoint location = rock.getLocalLocation();
if (localLocation.distanceTo(location) <= MAX_DISTANCE)
{
renderRock(graphics, rock);
}
}
}
}
private void renderVein(Graphics2D graphics, WallObject vein)