Files

889 B
Raw Permalink Blame History

Darklord.js — collectDomainParticipants() (satır 2208)

← Darklord.js · ← Master

function collectDomainParticipants(c, owner, cx, floorY, cz)
{
    var out = {};
    out[lower(owner.getName())] = true;

    var players = allPlayers(c);
    var radiusSq = (DOMAIN_RADIUS - 1.0) * (DOMAIN_RADIUS - 1.0);
    for (var i = 0; i < listSize(players); i++)
    {
        var pl = listGet(players, i);
        if (!pl || !pl.getName) continue;
        if (getDimensionSafe(pl) !== getDimensionSafe(owner)) continue;

        var pos = pl.getPosition();
        var dx = pos.x - cx;
        var dz = pos.z - cz;
        if (dx * dx + dz * dz <= radiusSq && pos.y >= floorY - 2 && pos.y <= floorY + DOMAIN_HEIGHT + 4)
        {
            out[lower(pl.getName())] = true;
        }
    }

    return out;
}