agility plugin: add trap obstacle overlay

Add an option to show an overlay over traps in agility courses
This commit is contained in:
Jeremy Plsek
2018-05-07 21:20:24 -04:00
committed by Adam
parent cb6e1ae5fb
commit d868a6d60c
4 changed files with 39 additions and 3 deletions

View File

@@ -82,7 +82,7 @@ public interface AgilityConfig extends Config
@ConfigItem(
keyName = "markHighlight",
name = "Mark highlight Color",
name = "Mark Highlight Color",
description = "Color of highlighted Marks of Grace",
position = 5
)
@@ -101,4 +101,26 @@ public interface AgilityConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "trapOverlay",
name = "Show Trap Overlay",
description = "Enable/disable the highlighting of traps on Agility courses",
position = 7
)
default boolean showTrapOverlay()
{
return true;
}
@ConfigItem(
keyName = "trapHighlight",
name = "Trap Overlay Color",
description = "Color of Agility trap overlay",
position = 8
)
default Color getTrapColor()
{
return Color.RED;
}
}

View File

@@ -69,7 +69,8 @@ public class AgilityOverlay extends Overlay
final Tile markOfGrace = plugin.getMarkOfGrace();
plugin.getObstacles().forEach((object, tile) ->
{
if (Obstacles.SHORTCUT_OBSTACLE_IDS.contains(object.getId()) && !config.highlightShortcuts())
if (Obstacles.SHORTCUT_OBSTACLE_IDS.contains(object.getId()) && !config.highlightShortcuts() ||
Obstacles.TRAP_OBSTACLE_IDS.contains(object.getId()) && !config.showTrapOverlay())
{
return;
}
@@ -77,6 +78,13 @@ public class AgilityOverlay extends Overlay
if (tile.getPlane() == client.getPlane()
&& object.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
{
// This assumes that the obstacle is not clickable.
if (Obstacles.TRAP_OBSTACLE_IDS.contains(object.getId()))
{
OverlayUtil.renderPolygon(graphics, object.getCanvasTilePoly(), config.getTrapColor());
return;
}
Area objectClickbox = object.getClickbox();
if (objectClickbox != null)
{

View File

@@ -286,7 +286,8 @@ public class AgilityPlugin extends Plugin
}
if (Obstacles.COURSE_OBSTACLE_IDS.contains(newObject.getId()) ||
Obstacles.SHORTCUT_OBSTACLE_IDS.contains(newObject.getId()))
Obstacles.SHORTCUT_OBSTACLE_IDS.contains(newObject.getId()) ||
Obstacles.TRAP_OBSTACLE_IDS.contains(newObject.getId()))
{
obstacles.put(newObject, tile);
}

View File

@@ -177,4 +177,9 @@ public class Obstacles
// Revenant Caves
PILLAR_31561
);
public static final Set<Integer> TRAP_OBSTACLE_IDS = Sets.newHashSet(
// Agility pyramid
NULL_3550, NULL_10872, NULL_10873
);
}