mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-10 15:57:37 +07:00
Merge pull request #2660 from J-VdS/schematic
Server disable schematic option (fix #2382)
This commit is contained in:
@ -55,6 +55,7 @@ schematic.saved = Schematic saved.
|
|||||||
schematic.delete.confirm = This schematic will be utterly eradicated.
|
schematic.delete.confirm = This schematic will be utterly eradicated.
|
||||||
schematic.rename = Rename Schematic
|
schematic.rename = Rename Schematic
|
||||||
schematic.info = {0}x{1}, {2} blocks
|
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.wave = Waves Defeated:[accent] {0}
|
||||||
stat.enemiesDestroyed = Enemies Destroyed:[accent] {0}
|
stat.enemiesDestroyed = Enemies Destroyed:[accent] {0}
|
||||||
@ -831,6 +832,7 @@ mode.custom = Custom Rules
|
|||||||
|
|
||||||
rules.infiniteresources = Infinite Resources
|
rules.infiniteresources = Infinite Resources
|
||||||
rules.reactorexplosions = Reactor Explosions
|
rules.reactorexplosions = Reactor Explosions
|
||||||
|
rules.schematic = Schematics Allowed
|
||||||
rules.wavetimer = Wave Timer
|
rules.wavetimer = Wave Timer
|
||||||
rules.waves = Waves
|
rules.waves = Waves
|
||||||
rules.attack = Attack Mode
|
rules.attack = Attack Mode
|
||||||
|
@ -38,6 +38,8 @@ public class Rules{
|
|||||||
public boolean canGameOver = true;
|
public boolean canGameOver = true;
|
||||||
/** Whether reactors can explode and damage other blocks. */
|
/** Whether reactors can explode and damage other blocks. */
|
||||||
public boolean reactorExplosions = true;
|
public boolean reactorExplosions = true;
|
||||||
|
/** Whether schematics are allowed */
|
||||||
|
public boolean schematicAllowed = true;
|
||||||
/** Whether friendly explosions can occur and set fire/damage other blocks. */
|
/** Whether friendly explosions can occur and set fire/damage other blocks. */
|
||||||
public boolean damageExplosions = true;
|
public boolean damageExplosions = true;
|
||||||
/** Whether fire is enabled. */
|
/** Whether fire is enabled. */
|
||||||
|
@ -140,6 +140,7 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
title("@rules.title.resourcesbuilding");
|
title("@rules.title.resourcesbuilding");
|
||||||
check("@rules.infiniteresources", b -> rules.infiniteResources = b, () -> rules.infiniteResources);
|
check("@rules.infiniteresources", b -> rules.infiniteResources = b, () -> rules.infiniteResources);
|
||||||
check("@rules.reactorexplosions", b -> rules.reactorExplosions = b, () -> rules.reactorExplosions);
|
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.buildcostmultiplier", false, f -> rules.buildCostMultiplier = f, () -> rules.buildCostMultiplier, () -> !rules.infiniteResources);
|
||||||
number("@rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier);
|
number("@rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier);
|
||||||
number("@rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources);
|
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.TextButton.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import mindustry.Vars;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@ -63,8 +64,12 @@ public class SchematicsDialog extends BaseDialog{
|
|||||||
|
|
||||||
t.update(() -> {
|
t.update(() -> {
|
||||||
if(Core.input.keyTap(Binding.chat) && Core.scene.getKeyboardFocus() == searchField && firstSchematic != null){
|
if(Core.input.keyTap(Binding.chat) && Core.scene.getKeyboardFocus() == searchField && firstSchematic != null){
|
||||||
control.input.useSchematic(firstSchematic);
|
if(!Vars.state.rules.schematicAllowed){
|
||||||
hide();
|
ui.showInfo("@schematic.disabled");
|
||||||
|
}else{
|
||||||
|
control.input.useSchematic(firstSchematic);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -145,8 +150,12 @@ public class SchematicsDialog extends BaseDialog{
|
|||||||
if(state.isMenu()){
|
if(state.isMenu()){
|
||||||
showInfo(s);
|
showInfo(s);
|
||||||
}else{
|
}else{
|
||||||
control.input.useSchematic(s);
|
if(!Vars.state.rules.schematicAllowed){
|
||||||
hide();
|
ui.showInfo("@schematic.disabled");
|
||||||
|
}else{
|
||||||
|
control.input.useSchematic(s);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).pad(4).style(Styles.cleari).get();
|
}).pad(4).style(Styles.cleari).get();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user