diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index eba495d38a..a9b2287157 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -53,8 +53,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 are not allowed! -schematic.copydisabled = [scarlet]Copying isn't allowed! +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} @@ -799,6 +798,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 9efdc32944..8c277977fb 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -40,8 +40,6 @@ public class Rules{ public boolean reactorExplosions = true; /** Whether schematics are allowed */ public boolean schematicAllowed = true; - /** Whether copying is allowed */ - public boolean copyAllowed = true; /** Whether units use and require ammo. */ public boolean unitAmmo = false; /** How fast unit pads build units. */ diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index a4eb342f0a..82cea19de6 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -329,7 +329,7 @@ public class DesktopInput extends InputHandler{ table.button(Icon.paste, Styles.clearPartiali, () -> { ui.schematics.show(); - }).tooltip("Schematics").disabled(d -> !state.rules.schematicAllowed); + }).tooltip("Schematics"); table.button(Icon.tree, Styles.clearPartiali, () -> { ui.research.show(); @@ -387,8 +387,6 @@ public class DesktopInput extends InputHandler{ if(Core.input.keyTap(Binding.schematic_menu) && !Core.scene.hasKeyboard()){ if(ui.schematics.isShown()){ ui.schematics.hide(); - }else if(!state.rules.schematicAllowed) { - ui.showInfoToast("@schematic.disabled", 3f); }else{ ui.schematics.show(); ui.schematics.focusSearchField(); @@ -401,14 +399,10 @@ public class DesktopInput extends InputHandler{ } if(Core.input.keyRelease(Binding.schematic_select) && !Core.scene.hasKeyboard()){ - if(!state.rules.copyAllowed){ - ui.showInfoToast("@schematic.copydisabled", 3f); - }else { - lastSchematic = schematics.create(schemX, schemY, rawCursorX, rawCursorY); - useSchematic(lastSchematic); - if (selectRequests.isEmpty()) { - lastSchematic = null; - } + lastSchematic = schematics.create(schemX, schemY, rawCursorX, rawCursorY); + useSchematic(lastSchematic); + if (selectRequests.isEmpty()) { + lastSchematic = null; } } diff --git a/core/src/mindustry/input/MobileInput.java b/core/src/mindustry/input/MobileInput.java index a78ffdd0c0..6b4de9b93f 100644 --- a/core/src/mindustry/input/MobileInput.java +++ b/core/src/mindustry/input/MobileInput.java @@ -485,15 +485,11 @@ public class MobileInput extends InputHandler implements GestureListener{ lineMode = false; }else if(mode == schematicSelect){ - if(!state.rules.copyAllowed){ - ui.showInfoToast("@schematic.copydisabled", 3f); - }else { - selectRequests.clear(); - lastSchematic = schematics.create(lineStartX, lineStartY, lastLineX, lastLineY); - useSchematic(lastSchematic); - if (selectRequests.isEmpty()) { - lastSchematic = null; - } + selectRequests.clear(); + lastSchematic = schematics.create(lineStartX, lineStartY, lastLineX, lastLineY); + useSchematic(lastSchematic); + if (selectRequests.isEmpty()) { + lastSchematic = null; } schematicMode = false; mode = none; diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 74e0730f68..b6fa18f0c4 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -135,6 +135,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 6cd110f4b7..0510abde3b 100644 --- a/core/src/mindustry/ui/dialogs/SchematicsDialog.java +++ b/core/src/mindustry/ui/dialogs/SchematicsDialog.java @@ -12,6 +12,7 @@ import arc.scene.ui.TextButton.*; import arc.scene.ui.layout.*; import arc.struct.*; import arc.util.*; +import mindustry.Vars; import mindustry.game.*; import mindustry.gen.*; import mindustry.graphics.*; @@ -64,8 +65,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(); + } } }); @@ -146,8 +151,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(); diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index b0f06a2ff8..d1eae438a2 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -90,7 +90,7 @@ public class HudFragment extends Fragment{ select.button(Icon.menu, style, ui.paused::show); flip = select.button(Icon.upOpen, style, this::toggleMenus).get(); - select.button(Icon.paste, style, ui.schematics::show).disabled(d -> !state.rules.schematicAllowed); + select.button(Icon.paste, style, ui.schematics::show); select.button(Icon.pause, style, () -> { if(net.active()){