mirror of
https://github.com/YouHaveTrouble/DiscipleOfLand.git
synced 2026-05-12 06:26:56 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b3ec17f2c0 | |||
| c00e4178c5 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discipleofland",
|
"name": "discipleofland",
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+4
-4
@@ -67,18 +67,18 @@ export default defineComponent({
|
|||||||
methods: {
|
methods: {
|
||||||
findNearestAetheryte(zone: string, x: number, y: number): Aetheryte | null {
|
findNearestAetheryte(zone: string, x: number, y: number): Aetheryte | null {
|
||||||
let result = null;
|
let result = null;
|
||||||
|
let distance = Number.MAX_SAFE_INTEGER;
|
||||||
for (const aetheryte of this.aetherytes) {
|
for (const aetheryte of this.aetherytes) {
|
||||||
let distance = Number.MAX_VALUE;
|
if (aetheryte.position.zone !== zone) continue;
|
||||||
if (aetheryte.position.zone === zone) {
|
|
||||||
const a = aetheryte.position.x - x;
|
const a = aetheryte.position.x - x;
|
||||||
const b = aetheryte.position.y - y;
|
const b = aetheryte.position.y - y;
|
||||||
const distanceToAetheryte = Math.sqrt((a * a) + (b * b));
|
const distanceToAetheryte = Math.hypot(a, b);
|
||||||
if (distanceToAetheryte < distance) {
|
if (distanceToAetheryte < distance) {
|
||||||
|
`Aetheryte ${aetheryte.name.en} (${distance}) is new nearest aetheryte`;
|
||||||
distance = distanceToAetheryte;
|
distance = distanceToAetheryte;
|
||||||
result = aetheryte;
|
result = aetheryte;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user