diff --git a/annotations/src/main/resources/classids.properties b/annotations/src/main/resources/classids.properties index 86ca440e1c..974e2d7e70 100644 --- a/annotations/src/main/resources/classids.properties +++ b/annotations/src/main/resources/classids.properties @@ -26,4 +26,4 @@ pulsar=19 quad=23 risso=20 spiroct=21 -vela=25 \ No newline at end of file +vela=25 diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index e9d5db6823..483d2474fc 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -55,6 +55,7 @@ schematic.saved = Schematic saved. schematic.delete.confirm = This schematic will be utterly eradicated. schematic.rename = Rename Schematic schematic.info = {0}x{1}, {2} blocks +schematic.disabled = [scarlet]Schematics disabled[]\nYou are not allowed to use schematics on this [accent]map[] or [accent]server. stat.wave = Waves Defeated:[accent] {0} stat.enemiesDestroyed = Enemies Destroyed:[accent] {0} @@ -831,6 +832,7 @@ mode.custom = Custom Rules rules.infiniteresources = Infinite Resources rules.reactorexplosions = Reactor Explosions +rules.schematic = Schematics Allowed rules.wavetimer = Wave Timer rules.waves = Waves rules.attack = Attack Mode diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index 824671dd8c..0b56b2e3ca 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -38,6 +38,8 @@ public class Rules{ public boolean canGameOver = true; /** Whether reactors can explode and damage other blocks. */ public boolean reactorExplosions = true; + /** Whether schematics are allowed */ + public boolean schematicAllowed = true; /** Whether friendly explosions can occur and set fire/damage other blocks. */ public boolean damageExplosions = true; /** Whether fire is enabled. */ diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 294e547510..176e7cc49e 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -140,6 +140,7 @@ public class CustomRulesDialog extends BaseDialog{ title("@rules.title.resourcesbuilding"); check("@rules.infiniteresources", b -> rules.infiniteResources = b, () -> rules.infiniteResources); check("@rules.reactorexplosions", b -> rules.reactorExplosions = b, () -> rules.reactorExplosions); + check("@rules.schematic", b-> rules.schematicAllowed = b, () -> rules.schematicAllowed); number("@rules.buildcostmultiplier", false, f -> rules.buildCostMultiplier = f, () -> rules.buildCostMultiplier, () -> !rules.infiniteResources); number("@rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier); number("@rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources); diff --git a/core/src/mindustry/ui/dialogs/SchematicsDialog.java b/core/src/mindustry/ui/dialogs/SchematicsDialog.java index 2aa5ef3595..3501ae1873 100644 --- a/core/src/mindustry/ui/dialogs/SchematicsDialog.java +++ b/core/src/mindustry/ui/dialogs/SchematicsDialog.java @@ -11,6 +11,7 @@ import arc.scene.ui.ImageButton.*; import arc.scene.ui.TextButton.*; import arc.scene.ui.layout.*; import arc.util.*; +import mindustry.Vars; import mindustry.game.*; import mindustry.gen.*; import mindustry.graphics.*; @@ -63,8 +64,12 @@ public class SchematicsDialog extends BaseDialog{ t.update(() -> { if(Core.input.keyTap(Binding.chat) && Core.scene.getKeyboardFocus() == searchField && firstSchematic != null){ - control.input.useSchematic(firstSchematic); - hide(); + if(!Vars.state.rules.schematicAllowed){ + ui.showInfo("@schematic.disabled"); + }else{ + control.input.useSchematic(firstSchematic); + hide(); + } } }); @@ -145,8 +150,12 @@ public class SchematicsDialog extends BaseDialog{ if(state.isMenu()){ showInfo(s); }else{ - control.input.useSchematic(s); - hide(); + if(!Vars.state.rules.schematicAllowed){ + ui.showInfo("@schematic.disabled"); + }else{ + control.input.useSchematic(s); + hide(); + } } }).pad(4).style(Styles.cleari).get();