fix/vector compass directions

This commit is contained in:
SowinskiBraeden committed 2024-01-27 11:31:45 -08:00
1 parent 0823f7bf7c
commit 66660657da
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayzr-bot", "name": "dayzr-bot",
"version": "12.5.7", "version": "12.5.8",
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.", "description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
"main": "index.js", "main": "index.js",
"nodemonConfig": { "nodemonConfig": {
+1 -1
View File
@@ -4,7 +4,7 @@ module.exports = {
let distance = parseFloat(Math.sqrt(Math.pow(delta[0], 2) + Math.pow(delta[1], 2)).toFixed(0)); let distance = parseFloat(Math.sqrt(Math.pow(delta[0], 2) + Math.pow(delta[1], 2)).toFixed(0));
let thetat = Math.round(Math.atan2(delta[0], delta[1]) / Math.PI * 180); let thetat = Math.round(Math.atan2(delta[0], delta[1]) / Math.PI * 180);
let theta = (thetat < 0) ? (360 + thetat) : thetat; let theta = (thetat < 0) ? (360 + thetat) : thetat;
let compass = ["S", "SW", "W", "NW", "N", "N by NE", "NE", "E", "SE", "S"]; let compass = ["S", "SW", "W", "NW", "N", "NE", "E", "SE", "S"];
let dir = compass[Math.round(theta / 45)]; let dir = compass[Math.round(theta / 45)];
return {distance, theta, dir} return {distance, theta, dir}