ClassiCube / MCGalaxy

A Minecraft Classic / ClassiCube server software
GNU General Public License v3.0
172 stars 80 forks source link

Unflood does not need to turn off Physics, only pause it. #615

Closed rdebath closed 3 years ago

rdebath commented 3 years ago

AIUI we only need to freeze physics to stop new blocks being created during the ReplaceAll, a pause is sufficient to do this, and does not have the side effect of interrupting other, harmless, physics processes.

diff --git a/MCGalaxy/Commands/World/CmdUnflood.cs b/MCGalaxy/Commands/World/CmdUnflood.cs
index b0926dc39..c3907df26 100644
--- a/MCGalaxy/Commands/World/CmdUnflood.cs
+++ b/MCGalaxy/Commands/World/CmdUnflood.cs
@@ -33,15 +33,15 @@ namespace MCGalaxy.Commands.World {

             Level lvl = p.level;
             if (!LevelInfo.Check(p, data.Rank, lvl, "unflood this level")) return;
-            int phys  = lvl.physics;
-            CmdPhysics.SetPhysics(lvl, 0);
+            bool paused = lvl.PhysicsPaused;
+            lvl.PhysicsPaused = true;

             Command cmd = Command.Find("ReplaceAll");
             string args = !message.CaselessEq("all") ? message :
                 "8 10 lavafall waterfall lava_fast active_hot_lava active_cold_water fast_hot_lava magma geyser";
             cmd.Use(p, args + " air", data);

-            CmdPhysics.SetPhysics(lvl, phys);
+            lvl.PhysicsPaused = paused;
             lvl.Message("Unflooded!");
         }
UnknownShadow200 commented 3 years ago

Does 160d184a937dce1e171d5ecb6d0fd827c8201277 resolve this?