Tick distances

main
idylls 1 year ago
parent 8d7644aac5
commit 36d5bcec95
Signed by: idylls
GPG Key ID: 8A7167CBC2CC9F0F

@ -457,6 +457,12 @@ class Overlay
config.highlightHoveredBorder(),
config.highlightHoveredBorderWidth(),
)
if (config.drawTickDistance()) {
paintTicks(gfx, ot)
paintTicks(gfx, hpt, ot.size)
paintTicks(gfx, dpt, ot.size)
}
} else {
if (destinationPathTiles != null) {
paintTiles(
@ -465,6 +471,10 @@ class Overlay
config.highlightDestinationBorder(),
config.highlightDestinationBorderWidth(),
)
if (config.drawTickDistance()) {
paintTicks(gfx, destinationPathTiles)
}
}
if (hoveredPathTiles != null) {
@ -474,6 +484,10 @@ class Overlay
config.highlightHoveredBorder(),
config.highlightHoveredBorderWidth(),
)
if (config.drawTickDistance()) {
paintTicks(gfx, hoveredPathTiles)
}
}
}
}
@ -501,9 +515,35 @@ class Overlay
OverlayUtil.renderPolygon(gfx, poly, borderColor, Color(0, 0, 0, 0), BasicStroke(borderWidth.toFloat()))
}
fun paintTicks(
gfx: Graphics2D,
tiles: Iterable<ScenePoint>,
offset: Int = 0,
) {
for (tile in tiles.withIndex()) {
renderTick(gfx, tile.value, tile.index + offset)
}
}
fun renderTick(
gfx: Graphics2D,
tile: ScenePoint,
tick: Int,
) {
val lp = LocalPoint.fromScene(tile.getX(), tile.getY())
val str = "${tick}"
val loc = Perspective.getCanvasTextLocation(client, gfx, lp, str, 0)
if (loc == null) {
return
}
OverlayUtil.renderTextLocation(gfx, loc, str, Color(255, 255, 255))
}
fun isRunning(): Boolean {
val willRun = client.getVarpValue(173) == 1
// TODO: handle ctrl-clicks
// TODO: handle other conditions
return willRun
}

@ -31,6 +31,13 @@ public interface PathosConfig : Config {
position = 2,
)
const val overlapping = "overlapping"
@ConfigSection(
name = "Additional",
description = "Additional Settings",
position = 3,
)
const val additional = "additional"
}
@ConfigItem(
@ -116,4 +123,13 @@ public interface PathosConfig : Config {
position = 2,
)
fun highlightOverlappingBorderWidth(): Double = 1.0
@ConfigItem(
keyName = "tickDistance",
name = "Draw tick distance",
description = "Render the time it will take in ticks to reach each tile",
section = additional,
position = 0,
)
fun drawTickDistance(): Boolean = true
}

Loading…
Cancel
Save