mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-09 07:17:36 +07:00
Merge pull request #2660 from J-VdS/schematic
Server disable schematic option (fix #2382)
This commit is contained in:
@ -26,4 +26,4 @@ pulsar=19
|
||||
quad=23
|
||||
risso=20
|
||||
spiroct=21
|
||||
vela=25
|
||||
vela=25
|
||||
|
@ -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
|
||||
|
@ -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. */
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user