From f7175540f89f86fa36231fd4579a3fbefcf11bd6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 5 May 2022 20:36:11 -0400 Subject: [PATCH] Disable world processor rule --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/game/Rules.java | 2 ++ core/src/mindustry/ui/dialogs/CustomRulesDialog.java | 1 + core/src/mindustry/world/blocks/logic/LogicBlock.java | 2 ++ 4 files changed, 6 insertions(+) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index d111d6e6d0..1aa8c2e395 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1082,6 +1082,7 @@ rules.infiniteresources = Infinite Resources rules.onlydepositcore = Only Allow Core Depositing rules.reactorexplosions = Reactor Explosions rules.coreincinerates = Core Incinerates Overflow +rules.disableworldprocessors = Disable World Processors rules.schematic = Schematics Allowed rules.wavetimer = Wave Timer rules.waves = Waves diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index 5d58e63a57..02e038ad3e 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -62,6 +62,8 @@ public class Rules{ public float unitDamageMultiplier = 1f; /** Whether to allow units to build with logic. */ public boolean logicUnitBuild = true; + /** If true, world processors no longer update. Used for testing. */ + public boolean disableWorldProcessors = false; /** How much health blocks start with. */ public float blockHealthMultiplier = 1f; /** How much damage blocks (turrets) deal. */ diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 3cbff45c3c..e331b04382 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -155,6 +155,7 @@ public class CustomRulesDialog extends BaseDialog{ check("@rules.schematic", b -> rules.schematicsAllowed = b, () -> rules.schematicsAllowed); check("@rules.coreincinerates", b -> rules.coreIncinerates = b, () -> rules.coreIncinerates); check("@rules.cleanupdeadteams", b -> rules.cleanupDeadTeams = b, () -> rules.cleanupDeadTeams, () -> rules.pvp); + check("@rules.disableworldprocessors", b -> rules.disableWorldProcessors = b, () -> rules.disableWorldProcessors); number("@rules.buildcostmultiplier", false, f -> rules.buildCostMultiplier = f, () -> rules.buildCostMultiplier, () -> !rules.infiniteResources); number("@rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier, 0.001f, 50f); number("@rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources); diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index 3e9ea65641..52c23a3256 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -494,6 +494,8 @@ public class LogicBlock extends Block{ ipt = instructionsPerTick; } + if(state.rules.disableWorldProcessors && privileged) return; + if(enabled && executor.initialized()){ accumulator += edelta() * ipt * efficiency;