aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-09-18 09:22:18 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-09-18 09:22:18 +0800
commit2020b4e189fac02c1b5809522d25bc836d857930 (patch)
treebe415643e9357e40ecf46e6319c8ed0c7b9287b6 /src
parent91ce2e47013f18e85a08bc9d368130673b67f6ea (diff)
downloadSoopyV2-2020b4e189fac02c1b5809522d25bc836d857930.tar.gz
SoopyV2-2020b4e189fac02c1b5809522d25bc836d857930.tar.bz2
SoopyV2-2020b4e189fac02c1b5809522d25bc836d857930.zip
+ convert command for ordered waypoints
Diffstat (limited to 'src')
-rw-r--r--src/features/waypoints/index.js22
-rw-r--r--src/utils/networkUtils.js7
2 files changed, 19 insertions, 10 deletions
diff --git a/src/features/waypoints/index.js b/src/features/waypoints/index.js
index 9d98ef2..9188ddf 100644
--- a/src/features/waypoints/index.js
+++ b/src/features/waypoints/index.js
@@ -138,6 +138,21 @@ class Waypoints extends Feature {
console.log(e.stack)
}
})
+ this.registerCommand("converttoorder", () => {
+ try {
+ this.userWaypointsArr.forEach(w => {
+ let k = w.options.name
+ this.orderedWaypoints.set(parseInt(k), [w.x, w.y, w.z, k])
+ })
+ this.currentOrderedWaypointIndex = 0
+
+ if (this.showInfoInChat.getValue()) ChatLib.chat(this.FeatureManager.messagePrefix + "Converted into order. You might need to do /clearwaypoints to see (WARNING WILL CLEAR NORMAL WAYPOINTS)!")
+ } catch (e) {
+ if (this.showInfoInChat.getValue()) ChatLib.chat(this.FeatureManager.messagePrefix + "Error loading!")
+ console.log(JSON.stringify(e, undefined, 2))
+ console.log(e.stack)
+ }
+ })
this.registerCommand("setorderwaypointindex", (ind) => {
this.currentOrderedWaypointIndex = parseInt(ind)
if (this.showInfoInChat.getValue()) ChatLib.chat(this.FeatureManager.messagePrefix + "Set index to " + ind + "!")
@@ -167,24 +182,21 @@ class Waypoints extends Feature {
let distanceTo1 = Infinity
if (currentWaypoint) {
distanceTo1 = Math.hypot(Player.getX() - currentWaypoint[0], Player.getY() - currentWaypoint[1], Player.getZ() - currentWaypoint[2])
- drawCoolWaypoint(currentWaypoint[0], currentWaypoint[1], currentWaypoint[2], 0, 255, 0, { name: this.currentOrderedWaypointIndex.toString() })
+ drawCoolWaypoint(currentWaypoint[0], currentWaypoint[1], currentWaypoint[2], 0, 255, 0, { name: currentWaypoint[3] })
}
let nextWaypoint = this.orderedWaypoints.get(this.currentOrderedWaypointIndex + 1)
- let name = (this.currentOrderedWaypointIndex + 1).toString()
if (!nextWaypoint) {
if (this.orderedWaypoints.get(0)) {
nextWaypoint = this.orderedWaypoints.get(0)
- name = "0"
} else if (this.orderedWaypoints.get(1)) {
nextWaypoint = this.orderedWaypoints.get(1)
- name = "1"
}
}
let distanceTo2 = Infinity
if (nextWaypoint) {
distanceTo2 = Math.hypot(Player.getX() - nextWaypoint[0], Player.getY() - nextWaypoint[1], Player.getZ() - nextWaypoint[2])
- drawCoolWaypoint(nextWaypoint[0], nextWaypoint[1], nextWaypoint[2], 0, 255, 0, { name })
+ drawCoolWaypoint(nextWaypoint[0], nextWaypoint[1], nextWaypoint[2], 0, 255, 0, { name: nextWaypoint[3] })
}
if (this.lastCloser === this.currentOrderedWaypointIndex && distanceTo1 > distanceTo2 && distanceTo2 < 15) {
diff --git a/src/utils/networkUtils.js b/src/utils/networkUtils.js
index ca3270a..41d27e5 100644
--- a/src/utils/networkUtils.js
+++ b/src/utils/networkUtils.js
@@ -176,10 +176,7 @@ if (!global.networkUtilsThingSoopyPromise) {
}
})
- global.networkUtilsThingSoopyPromise = {
- getUrlContent: getUrlContent,
- fetch: fetch
- }
+ global.networkUtilsThingSoopyPromise = fetch
}
-module.exports = global.networkUtilsThingSoopyPromise
+export default global.networkUtilsThingSoopyPromise