Fix SubEntity hitbox hit detection (#1175)

This commit is contained in:
Matt.T 2026-03-12 12:32:27 +00:00 committed by GitHub
parent bb8ffee0d3
commit e689562027
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1628,18 +1628,18 @@ void LevelChunk::getEntities(shared_ptr<Entity> except, AABB *bb, vector<shared_
for (auto& e : *entities)
{
if ( e && e != except && e->bb->intersects(bb) && (selector == nullptr || selector->matches(e)))
if (e && e != except && e->bb->intersects(bb) && (selector == nullptr || selector->matches(e)))
{
es.push_back(e);
vector<shared_ptr<Entity> > *subs = e->getSubEntities();
if (subs != nullptr)
{
for (const auto& sub : *subs)
for (const auto& subEntity : *subs)
{
e = sub;
if ( e && e != except && e->bb->intersects(bb) && (selector == nullptr || selector->matches(e)))
if (subEntity && subEntity != except && subEntity->bb->intersects(bb) && (selector == nullptr || selector->matches(subEntity)))
{
es.push_back(e);
es.push_back(subEntity);
}
}
}