diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-19 06:53:56 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-19 06:53:56 +0800 |
commit | 238104a6e0aed478530c1a71f9f54f13395db252 (patch) | |
tree | c8a94d7fe678c3201169e1cbb2ca2c45389b6fb8 /src/features/waypoints | |
parent | bdbf48f983350e110212cb525407bae09655bb7f (diff) | |
download | SoopyV2-238104a6e0aed478530c1a71f9f54f13395db252.tar.gz SoopyV2-238104a6e0aed478530c1a71f9f54f13395db252.tar.bz2 SoopyV2-238104a6e0aed478530c1a71f9f54f13395db252.zip |
+ add line to ordered waypoints
Diffstat (limited to 'src/features/waypoints')
-rw-r--r-- | src/features/waypoints/index.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/features/waypoints/index.js b/src/features/waypoints/index.js index 15843b5..41b83d1 100644 --- a/src/features/waypoints/index.js +++ b/src/features/waypoints/index.js @@ -3,7 +3,7 @@ import { m } from "../../../mappings/mappings"; import Feature from "../../featureClass/class"; import { Waypoint } from "../../utils/renderJavaUtils"; -import { drawCoolWaypoint } from "../../utils/renderUtils"; +import { drawCoolWaypoint, drawLine } from "../../utils/renderUtils"; import { calculateDistanceQuick } from "../../utils/utils"; import SettingBase from "../settings/settingThings/settingBase"; import ToggleSetting from "../settings/settingThings/toggle"; @@ -38,6 +38,8 @@ class Waypoints extends Feature { this.loadWaypointsFromSendCoords = new ToggleSetting("Load waypoints from /patcher sendcoords messages", "Will dissapear after 1min", true, "load_waypoints_from_sendcoords", this) this.mineWaypointsSetting = new ToggleSetting("CH waypoints", "Will sync between users", true, "minwaypoints", this) + this.orderedWaypointsLine = new ToggleSetting("CH waypoints", "Draw a line from current to next ordered waypoint", false, "order_waypoints_line", this) + try { this.userWaypoints = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2userwaypoints.json") || "{}") } catch (e) { @@ -204,6 +206,10 @@ class Waypoints extends Feature { drawCoolWaypoint(nextWaypoint[0], nextWaypoint[1], nextWaypoint[2], 0, 255, 0, { name: nextWaypoint[3] }) } + if (this.orderedWaypointsLine.getValue() && currentWaypoint && nextWaypoint) { + drawLine(currentWaypoint[0] + 0.5, currentWaypoint[1], currentWaypoint[2] + 0.5, nextWaypoint[0] + 0.5, nextWaypoint[1], nextWaypoint[2] + 0.5, 0, 255, 0) + } + if (this.lastCloser === this.currentOrderedWaypointIndex && distanceTo1 > distanceTo2 && distanceTo2 < 15) { this.currentOrderedWaypointIndex++ if (!this.orderedWaypoints.get(this.currentOrderedWaypointIndex)) { |