From af93c297f4e18fced161250403de8f737558ad3b Mon Sep 17 00:00:00 2001 From: Ethan Jones Date: Wed, 15 Sep 2021 11:33:18 -0600 Subject: Ignore dead entities and spectator players on pressure plates (#5294) --- .../IncrementalRedstoneSimulator/PressurePlateHandler.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h b/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h index 7e377df68..003b5b253 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h @@ -17,17 +17,29 @@ namespace PressurePlateHandler Chunk.ForEachEntityInBox(cBoundingBox(Vector3d(0.5, 0, 0.5) + Position, 0.5, 0.5), [&](cEntity & Entity) { + if (Entity.GetHealth() <= 0) + { + return false; + } + if (Entity.IsPlayer()) { + const auto & Player = static_cast(Entity); + + if (Player.IsGameModeSpectator()) + { + return false; + } + FoundPlayer = true; } - - if (Entity.IsPickup()) + else if (Entity.IsPickup()) { const auto & Pickup = static_cast(Entity); NumberOfEntities += static_cast(Pickup.GetItem().m_ItemCount); return false; } + NumberOfEntities++; return false; }); -- cgit v1.2.3