Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	core/src/mindustry/content/Blocks.java
	core/src/mindustry/net/CrashSender.java
	core/src/mindustry/ui/Links.java
	core/src/mindustry/ui/dialogs/SchematicsDialog.java
	core/src/mindustry/world/blocks/power/LightBlock.java
	gradle.properties
This commit is contained in:
Anuken
2021-07-23 17:58:02 -04:00
90 changed files with 690 additions and 389 deletions

View File

@@ -55,30 +55,30 @@ public class Links{
private static String report(){
return "https://github.com/Anuken/Mindustry/issues/new?assignees=&labels=bug&body=" +
Strings.encode(Strings.format(
"""
**Platform**: `@`
**Build**: `@`
**Issue**: *Explain your issue in detail.*
**Steps to reproduce**: *How you happened across the issue, and what exactly you did to make the bug happen.*
**Link(s) to mod(s) used**: `@`
**Save file**: *The (zipped) save file you were playing on when the bug happened. THIS IS REQUIRED FOR ANY ISSUE HAPPENING IN-GAME, REGARDLESS OF WHETHER YOU THINK IT HAPPENS EVERYWHERE. DO NOT DELETE OR OMIT THIS LINE UNLESS YOU ARE SURE THAT THE ISSUE DOES NOT HAPPEN IN-GAME.*
**Crash report**: *The contents of relevant crash report files. REQUIRED if you are reporting a crash.*
---
*Place an X (no spaces) between the brackets to confirm that you have read the line below.*
- [ ] **I have updated to the latest release (https://github.com/Anuken/Mindustry/releases) to make sure my issue has not been fixed.**
- [ ] **I have searched the closed and open issues to make sure that this problem has not already been reported.**
""",
OS.isAndroid ? "Android " + Core.app.getVersion() : (OS.osName + " x" + OS.osArchBits),
Version.combined(),
Vars.mods.list().any() ? Vars.mods.list().select(LoadedMod::enabled).map(l -> l.meta.author + "/" + l.name + ":" + l.meta.version) : "none"));
Strings.encode(Strings.format(
"""
**Platform**: `@`
**Build**: `@`
**Issue**: *Explain your issue in detail.*
**Steps to reproduce**: *How you happened across the issue, and what exactly you did to make the bug happen.*
**Link(s) to mod(s) used**: `@`
**Save file**: *The (zipped) save file you were playing on when the bug happened. THIS IS REQUIRED FOR ANY ISSUE HAPPENING IN-GAME, REGARDLESS OF WHETHER YOU THINK IT HAPPENS EVERYWHERE. DO NOT DELETE OR OMIT THIS LINE UNLESS YOU ARE SURE THAT THE ISSUE DOES NOT HAPPEN IN-GAME.*
**Crash report**: *The contents of relevant crash report files. REQUIRED if you are reporting a crash.*
---
*Place an X (no spaces) between the brackets to confirm that you have read the line below.*
- [ ] **I have updated to the latest release (https://github.com/Anuken/Mindustry/releases) to make sure my issue has not been fixed.**
- [ ] **I have searched the closed and open issues to make sure that this problem has not already been reported.**
""",
OS.isAndroid ? "Android " + Core.app.getVersion() : (OS.osName + " x" + OS.osArchBits),
Version.combined(),
Vars.mods.list().any() ? Vars.mods.list().select(LoadedMod::enabled).map(l -> l.meta.author + "/" + l.name + ":" + l.meta.version) : "none"));
}
}

View File

@@ -142,6 +142,7 @@ public class CustomRulesDialog extends BaseDialog{
check("@rules.reactorexplosions", b -> rules.reactorExplosions = b, () -> rules.reactorExplosions);
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);
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);
@@ -262,7 +263,7 @@ public class CustomRulesDialog extends BaseDialog{
rebuild[0] = () -> {
base.clearChildren();
int cols = Math.max(1, Core.graphics.getWidth() / 460);
int cols = Math.max(1, (int)(Core.graphics.getWidth() / Scl.scl(450)));
int idx = 0;
for(WeatherEntry entry : rules.weather){

View File

@@ -616,34 +616,33 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
selectAlpha = Mathf.lerpDelta(selectAlpha, Mathf.num(planets.zoom < 1.9f), 0.1f);
}
void displayItems(Table c, float scl, ObjectMap<Item, ExportStat> stats, String name){
Table t = new Table().left();
int i = 0;
for(var item : content.items()){
var stat = stats.get(item);
if(stat == null) continue;
int total = (int)(stat.mean * 60 * scl);
if(total > 1){
t.image(item.uiIcon).padRight(3);
t.add(UI.formatAmount(total) + " " + Core.bundle.get("unit.perminute")).color(Color.lightGray).padRight(3);
if(++i % 3 == 0){
t.row();
}
}
}
if(t.getChildren().any()){
c.add(name).left().row();
c.add(t).padLeft(10f).left().row();
}
}
void showStats(Sector sector){
BaseDialog dialog = new BaseDialog(sector.name());
dialog.cont.pane(c -> {
Cons2<ObjectMap<Item, ExportStat>, String> display = (stats, name) -> {
Table t = new Table().left();
float scl = sector.getProductionScale();
int[] i = {0};
stats.each((item, stat) -> {
int total = (int)(stat.mean * 60 * scl);
if(total > 1){
t.image(item.uiIcon).padRight(3);
t.add(UI.formatAmount(total) + " " + Core.bundle.get("unit.perminute")).color(Color.lightGray).padRight(3);
if(++i[0] % 3 == 0){
t.row();
}
}
});
if(t.getChildren().any()){
c.add(name).left().row();
c.add(t).padLeft(10f).left().row();
}
};
c.defaults().padBottom(5);
c.add(Core.bundle.get("sectors.time") + " [accent]" + sector.save.getPlayTime()).left().row();
@@ -666,10 +665,15 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}
//production
display.get(sector.info.production, "@sectors.production");
displayItems(c, sector.getProductionScale(), sector.info.production, "@sectors.production");
//export
display.get(sector.info.export, "@sectors.export");
displayItems(c, sector.getProductionScale(), sector.info.export, "@sectors.export");
//import
if(sector.hasBase()){
displayItems(c, 1f, sector.info.importStats(), "@sectors.import");
}
ItemSeq items = sector.items();
@@ -748,7 +752,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
updateSelected();
}).checked(sector.info.icon == null);
int cols = (int)Math.min(20, Core.graphics.getWidth() / 52f);
int cols = (int)Math.min(20, Core.graphics.getWidth() / Scl.scl(52f));
int i = 1;
for(var key : defaultIcons){

View File

@@ -415,16 +415,14 @@ public class SchematicsDialog extends BaseDialog{
t.marginRight(19f);
t.defaults().size(48f);
int cols = (int)Math.min(20, Core.graphics.getWidth() / 52f);
int i;
int cols = (int)Math.min(20, Core.graphics.getWidth() / Scl.scl(52f));
for(ContentType ctype : defaultContentIcons){
t.row();
t.image().colspan(cols).growX().width(Float.NEGATIVE_INFINITY).height(3f).color(Pal.accent);
t.row();
i = 0;
int i = 0;
for(UnlockableContent u : content.getBy(ctype).<UnlockableContent>as()){
if(!u.isHidden() && u.unlockedNow() && u.hasEmoji() && !tags.contains(u.emoji())){
t.button(new TextureRegionDrawable(u.uiIcon), Styles.cleari, iconMed, () -> {

View File

@@ -6,6 +6,8 @@ import arc.func.*;
import arc.graphics.*;
import arc.graphics.Texture.*;
import arc.input.*;
import arc.math.geom.*;
import arc.scene.*;
import arc.scene.event.*;
import arc.scene.ui.*;
import arc.scene.ui.TextButton.*;
@@ -28,7 +30,6 @@ import java.io.*;
import java.util.zip.*;
import static arc.Core.*;
import static mindustry.Vars.net;
import static mindustry.Vars.*;
public class SettingsMenuDialog extends Dialog{
@@ -283,9 +284,9 @@ public class SettingsMenuDialog extends Dialog{
}
void addSettings(){
sound.sliderPref("musicvol", bundle.get("setting.musicvol.name", "Music Volume"), 100, 0, 100, 1, i -> i + "%");
sound.sliderPref("sfxvol", bundle.get("setting.sfxvol.name", "SFX Volume"), 100, 0, 100, 1, i -> i + "%");
sound.sliderPref("ambientvol", bundle.get("setting.ambientvol.name", "Ambient Volume"), 100, 0, 100, 1, i -> i + "%");
sound.sliderPref("musicvol", 100, 0, 100, 1, i -> i + "%");
sound.sliderPref("sfxvol", 100, 0, 100, 1, i -> i + "%");
sound.sliderPref("ambientvol", 100, 0, 100, 1, i -> i + "%");
game.sliderPref("saveinterval", 60, 10, 5 * 120, 10, i -> Core.bundle.format("setting.seconds", i));
@@ -562,52 +563,26 @@ public class SettingsMenuDialog extends Dialog{
rebuild();
}
public SliderSetting sliderPref(String name, String title, int def, int min, int max, StringProcessor s){
return sliderPref(name, title, def, min, max, 1, s);
}
public SliderSetting sliderPref(String name, String title, int def, int min, int max, int step, StringProcessor s){
SliderSetting res;
list.add(res = new SliderSetting(name, title, def, min, max, step, s));
settings.defaults(name, def);
rebuild();
return res;
}
public SliderSetting sliderPref(String name, int def, int min, int max, StringProcessor s){
return sliderPref(name, def, min, max, 1, s);
}
public SliderSetting sliderPref(String name, int def, int min, int max, int step, StringProcessor s){
SliderSetting res;
list.add(res = new SliderSetting(name, bundle.get("setting." + name + ".name"), def, min, max, step, s));
list.add(res = new SliderSetting(name, def, min, max, step, s));
settings.defaults(name, def);
rebuild();
return res;
}
public void checkPref(String name, String title, boolean def){
list.add(new CheckSetting(name, title, def, null));
settings.defaults(name, def);
rebuild();
}
public void checkPref(String name, String title, boolean def, Boolc changed){
list.add(new CheckSetting(name, title, def, changed));
settings.defaults(name, def);
rebuild();
}
/** Localized title. */
public void checkPref(String name, boolean def){
list.add(new CheckSetting(name, bundle.get("setting." + name + ".name"), def, null));
list.add(new CheckSetting(name, def, null));
settings.defaults(name, def);
rebuild();
}
/** Localized title. */
public void checkPref(String name, boolean def, Boolc changed){
list.add(new CheckSetting(name, bundle.get("setting." + name + ".name"), def, changed));
list.add(new CheckSetting(name, def, changed));
settings.defaults(name, def);
rebuild();
}
@@ -631,17 +606,41 @@ public class SettingsMenuDialog extends Dialog{
public abstract static class Setting{
public String name;
public String title;
public @Nullable String description;
Setting(String name){
this.name = name;
title = bundle.get("setting." + name + ".name");
description = bundle.getOrNull("setting." + name + ".description");
}
public abstract void add(SettingsTable table);
public void addDesc(Element elem){
if(description == null) return;
elem.addListener(new Tooltip(t -> t.background(Styles.black8).margin(4f).add(description).color(Color.lightGray)){
{
allowMobile = true;
}
@Override
protected void setContainerPosition(Element element, float x, float y){
this.targetActor = element;
Vec2 pos = element.localToStageCoordinates(Tmp.v1.set(0, 0));
container.pack();
container.setPosition(pos.x, pos.y, Align.topLeft);
container.setOrigin(0, element.getHeight());
}
});
}
}
public static class CheckSetting extends Setting{
boolean def;
Boolc changed;
CheckSetting(String name, String title, boolean def, Boolc changed){
this.name = name;
this.title = title;
CheckSetting(String name, boolean def, Boolc changed){
super(name);
this.def = def;
this.changed = changed;
}
@@ -660,7 +659,7 @@ public class SettingsMenuDialog extends Dialog{
});
box.left();
table.add(box).left().padTop(3f);
addDesc(table.add(box).left().padTop(3f).get());
table.row();
}
}
@@ -669,9 +668,8 @@ public class SettingsMenuDialog extends Dialog{
int def, min, max, step;
StringProcessor sp;
SliderSetting(String name, String title, int def, int min, int max, int step, StringProcessor s){
this.name = name;
this.title = title;
SliderSetting(String name, int def, int min, int max, int step, StringProcessor s){
super(name);
this.def = def;
this.min = min;
this.max = max;
@@ -685,21 +683,21 @@ public class SettingsMenuDialog extends Dialog{
slider.setValue(settings.getInt(name));
Label value = new Label("");
value.setStyle(Styles.outlineLabel);
value.touchable = Touchable.disabled;
Label value = new Label("", Styles.outlineLabel);
Table content = new Table();
content.add(title, Styles.outlineLabel).left().growX().wrap();
content.add(value).padLeft(10f).right();
content.margin(3f, 33f, 3f, 33f);
content.touchable = Touchable.disabled;
slider.changed(() -> {
settings.put(name, (int)slider.getValue());
value.setText(title + ": " + sp.get((int)slider.getValue()));
value.setText(sp.get((int)slider.getValue()));
});
value.setAlignment(Align.center);
value.setWrap(true);
slider.change();
table.stack(slider, value).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).left().padTop(4);
addDesc(table.stack(slider, content).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).left().padTop(4f).get());
table.row();
}
}