Open jocopa3 opened 1 year ago
All icons for UI are placeholders until I can either make new assets or find some with an agreeable license.
Both the Screen Markers plugin and the Loot Tracker plugin in core RuneLite have enable/disable icons made by Psikoi that I believe are under RuneLite's BSD-2 license.
Navigation Button currently uses marker.png as the plugin's icon; open to ideas for something better to use.
I like the look of that icon in the panel. It makes sense and I cannot think of anything better at the moment.
Minor update: hide-marker
is now a Boolean
type rather than allowing any value. Since it's optional, default behavior is to show the marker, plugins are expected to set hide-marker
true to disable the world map marker.
This PR is incomplete, namely UI and API is not finalized. I'm publishing it to receive feedback from others.
Overview
A common request I see from other plugin developers is wanting some way to interface with shortest path but there currently doesn't exist a way to do so. This PR proposes a potential API that can be exposed to external plugins to allow them to make requests while also allowing users to control which paths are visible and prioritize which plugin paths should override other paths.
HashMap
to transfer data until some form of Plugin Messaging event is added to RuneLite, a la: https://github.com/runelite/runelite/pull/16863requestPath
code path as external plugins.startUp
andshutDown
functions to avoid redundantly loading data in-case the user toggles the plugin on/off.Notes
Video Demo
Video demonstrates that shortest-path's normal functions still work as expected, but also that other plugins (e.x. Quest Helper) can interface with it. Plugins can be re-ordered and paths hidden via the side panel. Shortest Path still tracks request/clear commands even if it's disabled so that the data remains current the next time it's enabled.
https://github.com/Skretzo/shortest-path/assets/2230152/33622cee-eed8-49d2-9b52-a416f0a0bee7
API
This initial proposal is meant to implement the bare minimum feature-set most people want and that can be easily maintained going forward. Additional features like changing pathfinding options, drawing multiple paths, changing path colors, etc., are out of the intended scope of this PR.
Plugins interface over the
EventBus
by passing a hashmap of typeHashMap<String, Object>
containing the required parameters. Any invalid requests or requests with invalid/missing parameters are ignored and a debug message printed. For simplicity, the API is entirely one-way communication and Shortest Path does not send responses or acknowledgements back to requesters. Here is a working example class that external plugins can use directly to interface with shortest path or use as a reference.Internally, the API side is handled by
ShortestPathAPI.java
. It validates that the objects received are the correct types and prints debug messages when it receives invalid requests or parameters; these messages can be seen in logs or when RuneLite is run with the--debug
argument.Required Parameters
plugin
command
shortestpath:
followed by the command.Commands
request-path
: Asks shortest path to try and draw a path from the player's position or start point to the target point. The requested path will only be drawn if no other plugin has an active path or the requesting plugin is higher on the user's priority list than other plugins with active paths.clear-path
: Clears any paths set by the requesting plugin; does not affect other plugins paths.Some commands may have additional parameters as listed below.
request-path
Command: Keytarget
start
null
, then the player's position is used as the start point.hide-marker
true
, shortest path won't draw the target "marker" overlay on the world map. This is useful to plugins like Quest Helper that already draw their own world map marker.