npcunaggroarea: add option to hide when out of combat

This commit is contained in:
Josh
2022-01-17 21:53:53 -06:00
committed by Adam
parent 5ca0eef25d
commit aa73a9eabc
2 changed files with 18 additions and 0 deletions

View File

@@ -117,4 +117,15 @@ public interface NpcAggroAreaConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "hideIfOutOfCombat",
name = "Hide when out of combat",
description = "Hides unaggressive area lines when out of combat.",
position = 8
)
default boolean hideIfOutOfCombat()
{
return false;
}
}

View File

@@ -34,6 +34,7 @@ import java.time.Instant;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.geometry.Geometry;
@@ -70,6 +71,12 @@ class NpcAggroAreaOverlay extends Overlay
return null;
}
final Player localPlayer = client.getLocalPlayer();
if (localPlayer.getHealthScale() == -1 && config.hideIfOutOfCombat())
{
return null;
}
GeneralPath lines = plugin.getLinesToDisplay()[client.getPlane()];
if (lines == null)
{