MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / getNPCsInRadius

Method getNPCsInRadius

src/logic/ScriptEngine.cpp:265–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265std::set<Handle::EntityHandle> ScriptEngine::getNPCsInRadius(const Math::float3& center, float radius)
266{
267 std::set<Handle::EntityHandle> outSet;
268 float radSq = radius * radius;
269
270 for (const Handle::EntityHandle& e : m_WorldNPCs)
271 {
272 Math::float3 translation = m_World.getEntity<Components::PositionComponent>(e).m_WorldMatrix.Translation();
273
274 if ((center - translation).lengthSquared() < radSq)
275 outSet.insert(e);
276 }
277
278 return outSet;
279}
280
281Handle::EntityHandle ScriptEngine::findWorldNPC(const std::string& name)
282{

Callers 1

onActionMethod · 0.80

Calls 3

TranslationMethod · 0.80
lengthSquaredMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected