Files

34 lines
1.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Darklord.js — nearestBloodPool() (satır 1741)
[← Darklord.js](index.md) · [← Master](../../wiki.md)
```javascript
function nearestBloodPool(player, requireNear)
{
var best = null;
var bestDist = 999999.0;
var pos = player.getPosition();
for (var i = 0; i < MEMBERS.length; i++)
{
var pool = getBloodPool(MEMBERS[i].player);
if (!pool || !pool.active) continue;
if (!pool.permanent && !pool.restoring && Number(pool.holdUntil || pool.expiresAt || 0) <= nowMs()) continue;
if (Number(pool.dim) !== getDimensionSafe(player)) continue;
var dx = pos.x - Number(pool.x);
var dy = pos.y - Number(pool.y);
var dz = pos.z - Number(pool.z);
var d = Math.sqrt(dx * dx + dy * dy + dz * dz);
if (d < bestDist)
{
best = pool;
bestDist = d;
}
}
if (requireNear && best && bestDist > Number(best.radius || BLOOD_POOL_RADIUS) + 1.3) return null;
return best;
}
```