1
0
Fork 0

Ignore dead entities and spectator players on pressure plates (#5294)

This commit is contained in:
Ethan Jones 2021-09-15 11:33:18 -06:00 committed by GitHub
parent f09258d24e
commit af93c297f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 3 deletions

View File

@ -17,17 +17,29 @@ namespace PressurePlateHandler
Chunk.ForEachEntityInBox(cBoundingBox(Vector3d(0.5, 0, 0.5) + Position, 0.5, 0.5), [&](cEntity & Entity)
{
if (Entity.IsPlayer())
if (Entity.GetHealth() <= 0)
{
FoundPlayer = true;
return false;
}
if (Entity.IsPickup())
if (Entity.IsPlayer())
{
const auto & Player = static_cast<cPlayer &>(Entity);
if (Player.IsGameModeSpectator())
{
return false;
}
FoundPlayer = true;
}
else if (Entity.IsPickup())
{
const auto & Pickup = static_cast<cPickup &>(Entity);
NumberOfEntities += static_cast<size_t>(Pickup.GetItem().m_ItemCount);
return false;
}
NumberOfEntities++;
return false;
});