--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]] local ____exports = {} --- Аналог Entities.FindAllByClassnameWithin без VectorWS: обход через FindAllByClassname + дистанция. function ____exports.findAllByClassnameInRadius(classname, center, radius) local all = Entities:FindAllByClassname(classname) local result = {} local r2 = radius * radius for ____, ent in ipairs(all) do do if not ent or ent:IsNull() then goto __continue3 end local pos = ent:GetAbsOrigin() local dx = pos.x - center.x local dy = pos.y - center.y if dx * dx + dy * dy <= r2 then result[#result + 1] = ent end end ::__continue3:: end return result end --- Аналог Entities.FindByClassnameNearest: ближайшая сущность класса в пределах maxRadius. function ____exports.findNearestByClassname(classname, origin, maxRadius) local all = Entities:FindAllByClassname(classname) local best local bestDist = maxRadius + 1 for ____, ent in ipairs(all) do do if not ent or ent:IsNull() then goto __continue8 end local d = (origin - ent:GetAbsOrigin()):Length2D() if d <= maxRadius and d < bestDist then bestDist = d best = ent end end ::__continue8:: end return best end return ____exports