MCGalaxy
MCGalaxy copied to clipboard
Physics-5 Change Queue doesn't clear
If you have a physics-5 map DoorPhysics.Do
is placed as the handler for air blocks.
Deleting a block then places an item on the physics check queue, this block doesn't have Type1
set to Custom
so it is ignored every tick. The below change (for example) cleans up these items.
diff --git a/MCGalaxy/Blocks/Physics/DoorPhysics.cs b/MCGalaxy/Blocks/Physics/DoorPhysics.cs
index 79fd89bcc..7c64fe078 100644
--- a/MCGalaxy/Blocks/Physics/DoorPhysics.cs
+++ b/MCGalaxy/Blocks/Physics/DoorPhysics.cs
@@ -22,7 +22,11 @@ namespace MCGalaxy.Blocks.Physics {
public static class DoorPhysics {
public static void Do(Level lvl, ref PhysInfo C) {
- if (C.Data.Type1 != PhysicsArgs.Custom) return;
+ if (C.Data.Type1 != PhysicsArgs.Custom) {
+ if (lvl.physics == 5)
+ C.Data.Data = PhysicsArgs.RemoveFromChecks;
+ return;
+ }
if (C.Data.Data == 0) {
BlockID block = (BlockID)(C.Data.Value2 | (C.Data.ExtBlock << Block.ExtendedShift));
bool tdoor = lvl.Props[block].IsTDoor;
Probably better off changing HandlePhysics
delegate to instead return a bool for whether to remove the PhysicsCheck
entry from the checks list or not.
Trying to remember to do C.Data.Data = PhysicsArgs.RemoveFromChecks
everywhere seems to just be fraught with issues
Agreed, though, returning a bool would normally be taken as an indication of success not that you want to do it again. To me it doesn't seem to fit exactly.
Personally I thought it should just delete the timed physics task unless explicitly told that it's to be retriggered; do nothing and it's deleted. After all for performance reasons the primary method of triggering physics changes should be via events not a repeated poll.