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

 Conflicts:
	core/assets/icons/icons.properties
	core/assets/logicids.dat
	core/src/mindustry/ui/dialogs/PlanetDialog.java
	core/src/mindustry/world/blocks/distribution/ItemBridge.java
	core/src/mindustry/world/blocks/liquid/LiquidExtendingBridge.java
	core/src/mindustry/world/blocks/storage/StorageBlock.java
	gradle.properties
This commit is contained in:
Anuken
2021-08-10 15:15:07 -04:00
196 changed files with 2485 additions and 1664 deletions
+7 -1
View File
@@ -68,6 +68,10 @@ public class Bar extends Element{
return this;
}
public void flash(){
blink = 1f;
}
public Bar blink(Color color){
blinkColor.set(color);
return this;
@@ -107,8 +111,10 @@ public class Bar extends Element{
}
Draw.colorl(0.1f);
Draw.alpha(parentAlpha);
bar.draw(x, y, width, height);
Draw.color(color, blinkColor, blink);
Draw.alpha(parentAlpha);
Drawable top = Tex.barTop;
float topWidth = width * value;
@@ -128,7 +134,7 @@ public class Bar extends Element{
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
lay.setText(font, name);
font.setColor(Color.white);
font.setColor(1f, 1f, 1f, parentAlpha);
font.draw(name, x + width / 2f - lay.width / 2f, y + height / 2f + lay.height / 2f + 1);
Pools.free(lay);
+7
View File
@@ -21,6 +21,7 @@ import arc.util.*;
import mindustry.*;
import mindustry.core.*;
import mindustry.ctype.*;
import mindustry.game.*;
import mindustry.gen.*;
import java.util.*;
@@ -155,6 +156,12 @@ public class Fonts{
}
}
});
for(Team team : Team.baseTeams){
if(Core.atlas.has("team-" + team.name)){
team.emoji = stringIcons.get(team.name, "");
}
}
}
/** Called from a static context for use in the loading screen.*/
@@ -28,87 +28,93 @@ public class CustomRulesDialog extends BaseDialog{
private Table main;
private Prov<Rules> resetter;
private LoadoutDialog loadoutDialog;
private BaseDialog banDialog;
public CustomRulesDialog(){
super("@mode.custom");
loadoutDialog = new LoadoutDialog();
banDialog = new BaseDialog("@bannedblocks");
banDialog.addCloseButton();
banDialog.shown(this::rebuildBanned);
banDialog.buttons.button("@addall", Icon.add, () -> {
rules.bannedBlocks.addAll(content.blocks().select(Block::canBeBuilt));
rebuildBanned();
}).size(180, 64f);
banDialog.buttons.button("@clear", Icon.trash, () -> {
rules.bannedBlocks.clear();
rebuildBanned();
}).size(180, 64f);
setFillParent(true);
shown(this::setup);
addCloseButton();
}
private void rebuildBanned(){
float previousScroll = banDialog.cont.getChildren().isEmpty() ? 0f : ((ScrollPane)banDialog.cont.getChildren().first()).getScrollY();
banDialog.cont.clear();
banDialog.cont.pane(t -> {
t.margin(10f);
private <T extends UnlockableContent> void showBanned(String title, ContentType type, ObjectSet<T> set, Boolf<T> pred){
BaseDialog bd = new BaseDialog(title);
bd.addCloseButton();
if(rules.bannedBlocks.isEmpty()){
t.add("@empty");
}
Runnable[] rebuild = {null};
Seq<Block> array = Seq.with(rules.bannedBlocks);
array.sort();
rebuild[0] = () -> {
float previousScroll = bd.cont.getChildren().isEmpty() ? 0f : ((ScrollPane)bd.cont.getChildren().first()).getScrollY();
bd.cont.clear();
bd.cont.pane(t -> {
t.margin(10f);
int cols = mobile && Core.graphics.isPortrait() ? 1 : mobile ? 2 : 3;
int i = 0;
for(Block block : array){
t.table(Tex.underline, b -> {
b.left().margin(4f);
b.image(block.uiIcon).size(iconMed).padRight(3);
b.add(block.localizedName).color(Color.lightGray).padLeft(3).growX().left().wrap();
b.button(Icon.cancel, Styles.clearPartiali, () -> {
rules.bannedBlocks.remove(block);
rebuildBanned();
}).size(70f).pad(-4f).padLeft(0f);
}).size(300f, 70f).padRight(5);
if(++i % cols == 0){
t.row();
if(set.isEmpty()){
t.add("@empty");
}
}
}).get().setScrollYForce(previousScroll);
banDialog.cont.row();
banDialog.cont.button("@add", Icon.add, () -> {
BaseDialog dialog = new BaseDialog("@add");
dialog.cont.pane(t -> {
t.left().margin(14f);
int[] i = {0};
content.blocks().each(b -> !rules.bannedBlocks.contains(b) && b.canBeBuilt(), b -> {
int cols = mobile && Core.graphics.isPortrait() ? 4 : 12;
t.button(new TextureRegionDrawable(b.uiIcon), Styles.cleari, iconMed, () -> {
rules.bannedBlocks.add(b);
rebuildBanned();
dialog.hide();
}).size(60f);
if(++i[0] % cols == 0){
Seq<T> array = set.asArray();
array.sort();
int cols = mobile && Core.graphics.isPortrait() ? 1 : mobile ? 2 : 3;
int i = 0;
for(T con : array){
t.table(Tex.underline, b -> {
b.left().margin(4f);
b.image(con.uiIcon).size(iconMed).padRight(3);
b.add(con.localizedName).color(Color.lightGray).padLeft(3).growX().left().wrap();
b.button(Icon.cancel, Styles.clearPartiali, () -> {
set.remove(con);
rebuild[0].run();
}).size(70f).pad(-4f).padLeft(0f);
}).size(300f, 70f).padRight(5);
if(++i % cols == 0){
t.row();
}
});
});
}
}).get().setScrollYForce(previousScroll);
bd.cont.row();
bd.cont.button("@add", Icon.add, () -> {
BaseDialog dialog = new BaseDialog("@add");
dialog.cont.pane(t -> {
t.left().margin(14f);
int[] i = {0};
content.<T>getBy(type).each(b -> !set.contains(b) && pred.get(b), b -> {
int cols = mobile && Core.graphics.isPortrait() ? 4 : 12;
t.button(new TextureRegionDrawable(b.uiIcon), Styles.cleari, iconMed, () -> {
set.add(b);
rebuild[0].run();
dialog.hide();
}).size(60f);
dialog.addCloseButton();
dialog.show();
}).size(300f, 64f);
if(++i[0] % cols == 0){
t.row();
}
});
});
dialog.addCloseButton();
dialog.show();
}).size(300f, 64f);
};
bd.shown(rebuild[0]);
bd.buttons.button("@addall", Icon.add, () -> {
set.addAll(content.<T>getBy(type).select(pred));
rebuild[0].run();
}).size(180, 64f);
bd.buttons.button("@clear", Icon.trash, () -> {
set.clear();
rebuild[0].run();
}).size(180, 64f);
bd.show();
}
public void show(Rules rules, Prov<Rules> resetter){
@@ -157,7 +163,7 @@ public class CustomRulesDialog extends BaseDialog{
)).left().width(300f);
main.row();
main.button("@bannedblocks", banDialog::show).left().width(300f);
main.button("@bannedblocks", () -> showBanned("@bannedblocks", ContentType.block, rules.bannedBlocks, Block::canBeBuilt)).left().width(300f);
main.row();
title("@rules.title.unit");
@@ -167,6 +173,9 @@ public class CustomRulesDialog extends BaseDialog{
number("@rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
number("@rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier, 0.001f, 50f);
main.button("@bannedunits", () -> showBanned("@bannedunits", ContentType.unit, rules.bannedUnits, u -> !u.isHidden())).left().width(300f);
main.row();
title("@rules.title.enemy");
check("@rules.attack", b -> rules.attackMode = b, () -> rules.attackMode);
check("@rules.buildai", b -> rules.teams.get(rules.waveTeam).ai = rules.teams.get(rules.waveTeam).infiniteResources = b, () -> rules.teams.get(rules.waveTeam).ai);
@@ -13,7 +13,9 @@ import mindustry.*;
import mindustry.ctype.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*;
import static mindustry.Vars.*;
@@ -50,14 +52,24 @@ public class DatabaseDialog extends BaseDialog{
table.table(list -> {
list.left();
int cols = Mathf.clamp((Core.graphics.getWidth() - 30) / (32 + 10), 1, 18);
int cols = (int)Mathf.clamp((Core.graphics.getWidth() - Scl.scl(30)) / Scl.scl(32 + 10), 1, 22);
int count = 0;
for(int i = 0; i < array.size; i++){
UnlockableContent unlock = (UnlockableContent)array.get(i);
Image image = unlocked(unlock) ? new Image(unlock.uiIcon).setScaling(Scaling.fit) : new Image(Icon.lock, Pal.gray);
list.add(image).size(8 * 4).pad(3);
//banned cross
if(state.isGame() && (unlock instanceof UnitType u && u.isBanned() || unlock instanceof Block b && state.rules.bannedBlocks.contains(b))){
list.stack(image, new Image(Icon.cancel){{
setColor(Color.scarlet);
touchable = Touchable.disabled;
}}).size(8 * 4).pad(3);
}else{
list.add(image).size(8 * 4).pad(3);
}
ClickListener listener = new ClickListener();
image.addListener(listener);
if(!mobile && unlocked(unlock)){
@@ -39,6 +39,7 @@ public class FileChooser extends BaseDialog{
if(!lastDirectory.exists()){
lastDirectory = homeDirectory;
directory = lastDirectory;
}
onResize(() -> {
@@ -271,7 +271,7 @@ public class JoinDialog extends BaseDialog{
hosts.clear();
section("@servers.local", local, false);
section(steam ? "@servers.local.steam" : "@servers.local", local, false);
section("@servers.remote", remote, false);
section("@servers.global", global, true);
@@ -13,6 +13,7 @@ import arc.struct.*;
import arc.util.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.ui.*;
import static arc.Core.*;
@@ -72,7 +73,7 @@ public class KeybindDialog extends Dialog{
}
if(sections.length != 1){
TextButton button = new TextButton(bundle.get("section." + section.name + ".name", Strings.capitalize(section.name))/*, "toggle"*/);
TextButton button = new TextButton(bundle.get("section." + section.name + ".name", Strings.capitalize(section.name)));
if(section.equals(this.section))
button.toggle();
@@ -115,9 +116,9 @@ public class KeybindDialog extends Dialog{
}
}).disabled(sectionControls.get(section, 0) + 1 >= devices.size).size(40);
table.add(stable).colspan(4);
//no alternate devices until further notice
//table.add(stable).colspan(4).row();
table.row();
table.add().height(10);
table.row();
if(section.device.type() == DeviceType.controller){
@@ -127,6 +128,7 @@ public class KeybindDialog extends Dialog{
table.row();
String lastCategory = null;
var tstyle = Styles.defaultt;
for(KeyBind keybind : keybinds.getKeybinds()){
if(lastCategory != keybind.category() && keybind.category() != null){
@@ -149,7 +151,7 @@ public class KeybindDialog extends Dialog{
table.add(axt).left().minWidth(90).padRight(20);
}
table.button(bundle.get("settings.rebind", "Rebind"), () -> {
table.button("@settings.rebind", tstyle, () -> {
rebindAxis = true;
rebindMin = true;
openDialog(section, keybind);
@@ -160,13 +162,13 @@ public class KeybindDialog extends Dialog{
table.add(keybinds.get(section, keybind).key.toString(),
style.keyColor).left().minWidth(90).padRight(20);
table.button(bundle.get("settings.rebind", "Rebind"), () -> {
table.button("@settings.rebind", tstyle, () -> {
rebindAxis = false;
rebindMin = false;
openDialog(section, keybind);
}).width(130f);
}
table.button(bundle.get("settings.resetKey", "Reset"), () -> {
table.button("@settings.resetKey", tstyle, () -> {
keybinds.resetToDefault(section, keybind);
setup();
}).width(130f);
@@ -175,7 +177,7 @@ public class KeybindDialog extends Dialog{
table.visible(() -> this.section.equals(section));
table.button(bundle.get("settings.reset", "Reset to Defaults"), () -> {
table.button("@settings.reset", () -> {
keybinds.resetToDefaults();
setup();
}).colspan(4).padTop(4).fill();
+11 -2
View File
@@ -36,6 +36,7 @@ import static mindustry.Vars.*;
public class ModsDialog extends BaseDialog{
private ObjectMap<String, TextureRegion> textureCache = new ObjectMap<>();
private float modImportProgress;
private String searchtxt = "";
private @Nullable Seq<ModListing> modList;
private boolean orderDate = false;
@@ -488,11 +489,16 @@ public class ModsDialog extends BaseDialog{
private void handleMod(String repo, HttpResponse result){
try{
Fi file = tmpDirectory.child(repo.replace("/", "") + ".zip");
Streams.copy(result.getResultAsStream(), file.write(false));
long len = result.getContentLength();
Floatc cons = len <= 0 ? f -> {} : p -> modImportProgress = p;
Streams.copyProgress(result.getResultAsStream(), file.write(false), len, 4096, cons);
var mod = mods.importMod(file);
mod.setRepo(repo);
file.delete();
Core.app.post(() -> {
try{
setup();
ui.loadfrag.hide();
@@ -510,10 +516,13 @@ public class ModsDialog extends BaseDialog{
}
private void githubImportMod(String repo, boolean isJava){
modImportProgress = 0f;
ui.loadfrag.show("@downloading");
ui.loadfrag.setProgress(() -> modImportProgress);
if(isJava){
githubImportJavaMod(repo);
}else{
ui.loadfrag.show();
Http.get(ghApi + "/repos/" + repo, res -> {
var json = Jval.read(res.getResultAsString());
String mainBranch = json.getString("default_branch");
+70 -11
View File
@@ -33,6 +33,7 @@ import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.blocks.storage.*;
import static arc.Core.*;
import static mindustry.Vars.*;
import static mindustry.graphics.g3d.PlanetRenderer.*;
import static mindustry.ui.dialogs.PlanetDialog.Mode.*;
@@ -373,6 +374,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}
if(selectAlpha > 0.001f){
for(Sector sec : planet.sectors){
if(sec.hasBase()){
for(Sector enemy : sec.near()){
@@ -380,6 +383,18 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
planets.drawArc(planet, enemy.tile.v, sec.tile.v, Team.crux.color.write(Tmp.c2).a(selectAlpha), Color.clear, 0.24f, 110f, 25);
}
}
if(selected != null && selected != sec && selected.hasBase()){
//imports
if(sec.info.getRealDestination() == selected && sec.info.anyExports()){
planets.drawArc(planet, sec.tile.v, selected.tile.v, Color.gray.write(Tmp.c2).a(selectAlpha), Pal.accent.write(Tmp.c3).a(selectAlpha), 0.4f, 90f, 25);
}
//exports
if(selected.info.getRealDestination() == sec && selected.info.anyExports()){
planets.drawArc(planet, selected.tile.v, sec.tile.v, Pal.place.write(Tmp.c2).a(selectAlpha), Pal.accent.write(Tmp.c3).a(selectAlpha), 0.4f, 90f, 25);
}
}
}
}
}
@@ -617,6 +632,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}
void displayItems(Table c, float scl, ObjectMap<Item, ExportStat> stats, String name){
displayItems(c, scl, stats, name, t -> {});
}
void displayItems(Table c, float scl, ObjectMap<Item, ExportStat> stats, String name, Cons<Table> builder){
Table t = new Table().left();
int i = 0;
@@ -634,8 +653,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}
if(t.getChildren().any()){
c.add(name).left().row();
c.add(t).padLeft(10f).left().row();
c.defaults().left();
c.add(name).row();
builder.get(c);
c.add(t).padLeft(10f).row();
}
}
@@ -645,6 +666,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
dialog.cont.pane(c -> {
c.defaults().padBottom(5);
if(sector.preset != null && sector.preset.description != null){
c.add(sector.preset.displayDescription()).left().row();
}
c.add(Core.bundle.get("sectors.time") + " [accent]" + sector.save.getPlayTime()).left().row();
if(sector.info.waves && sector.hasBase()){
@@ -668,11 +693,21 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
displayItems(c, sector.getProductionScale(), sector.info.production, "@sectors.production");
//export
displayItems(c, sector.getProductionScale(), sector.info.export, "@sectors.export");
displayItems(c, sector.getProductionScale(), sector.info.export, "@sectors.export", t -> {
if(sector.info.destination != null){
String ic = sector.info.destination.iconChar();
t.add(Iconc.rightOpen + " " + (ic == null || ic.isEmpty() ? "" : ic + " ") + sector.info.destination.name()).padLeft(10f).row();
}
});
//import
if(sector.hasBase()){
displayItems(c, 1f, sector.info.importStats(), "@sectors.import");
displayItems(c, 1f, sector.info.importStats(sector.planet), "@sectors.import", t -> {
sector.info.eachImport(sector.planet, other -> {
String ic = other.iconChar();
t.add(Iconc.rightOpen + " " + (ic == null || ic.isEmpty() ? "" : ic + " ") + other.name()).padLeft(10f).row();
});
});
}
ItemSeq items = sector.items();
@@ -747,10 +782,11 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
t.button(Icon.none, Styles.clearTogglei, () -> {
sector.info.icon = null;
sector.info.contentIcon = null;
sector.saveInfo();
hide();
updateSelected();
}).checked(sector.info.icon == null);
}).checked(sector.info.icon == null && sector.info.contentIcon == null);
int cols = (int)Math.min(20, Core.graphics.getWidth() / Scl.scl(52f));
@@ -758,7 +794,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
for(var key : defaultIcons){
var value = Icon.icons.get(key);
t.button(value, Styles.cleari, () -> {
t.button(value, Styles.clearTogglei, () -> {
sector.info.icon = key;
sector.info.contentIcon = null;
sector.saveInfo();
@@ -777,7 +813,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
i = 0;
for(UnlockableContent u : content.getBy(ctype).<UnlockableContent>as()){
if(!u.isHidden() && u.unlocked()){
t.button(new TextureRegionDrawable(u.uiIcon), Styles.cleari, iconMed, () -> {
t.button(new TextureRegionDrawable(u.uiIcon), Styles.clearTogglei, iconMed, () -> {
sector.info.icon = null;
sector.info.contentIcon = u;
sector.saveInfo();
@@ -931,14 +967,37 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
CoreBlock block = from.info.bestCoreType instanceof CoreBlock b ? b : (CoreBlock)Blocks.coreShard;
loadouts.show(block, from, () -> {
var schemCore = universe.getLastLoadout().findCore();
from.removeItems(universe.getLastLoadout().requirements());
from.removeItems(universe.getLaunchResources());
launching = true;
zoom = planets.planet.minZoom;
if(settings.getBool("skipcoreanimation")){
//just... go there
control.playSector(from, sector);
//hide only after load screen is shown
Time.runTask(8f, this::hide);
}else{
//hide immediately so launch sector is visible
hide();
ui.hudfrag.showLaunchDirect();
Time.runTask(launchDuration, () -> control.playSector(from, sector));
//allow planet dialog to finish hiding before actually launching
Time.runTask(5f, () -> {
Runnable doLaunch = () -> {
renderer.showLaunch(schemCore);
//run with less delay, as the loading animation is delayed by several frames
Time.runTask(coreLandDuration - 8f, () -> control.playSector(from, sector));
};
//load launchFrom sector right before launching so animation is correct
if(!from.isBeingPlayed()){
//run *after* the loading animation is done
Time.runTask(9f, doLaunch);
control.playSector(from);
}else{
doLaunch.run();
}
});
}
});
}
}else if(mode == select){
@@ -292,13 +292,15 @@ public class SettingsMenuDialog extends Dialog{
if(mobile){
game.checkPref("autotarget", true);
game.checkPref("keyboard", false, val -> {
control.setInput(val ? new DesktopInput() : new MobileInput());
input.setUseKeyboard(val);
});
if(Core.settings.getBool("keyboard")){
control.setInput(new DesktopInput());
input.setUseKeyboard(true);
if(!ios){
game.checkPref("keyboard", false, val -> {
control.setInput(val ? new DesktopInput() : new MobileInput());
input.setUseKeyboard(val);
});
if(Core.settings.getBool("keyboard")){
control.setInput(new DesktopInput());
input.setUseKeyboard(true);
}
}
}
//the issue with touchscreen support on desktop is that:
@@ -354,7 +356,7 @@ public class SettingsMenuDialog extends Dialog{
});
graphics.sliderPref("screenshake", 4, 0, 8, i -> (i / 4f) + "x");
graphics.sliderPref("fpscap", 240, 15, 245, 5, s -> (s > 240 ? Core.bundle.get("setting.fpscap.none") : Core.bundle.format("setting.fpscap.text", s)));
graphics.sliderPref("fpscap", 240, 10, 245, 5, s -> (s > 240 ? Core.bundle.get("setting.fpscap.none") : Core.bundle.format("setting.fpscap.text", s)));
graphics.sliderPref("chatopacity", 100, 0, 100, 5, s -> s + "%");
graphics.sliderPref("lasersopacity", 100, 0, 100, 5, s -> {
if(ui.settings != null){
@@ -367,6 +369,12 @@ public class SettingsMenuDialog extends Dialog{
if(!mobile){
graphics.checkPref("vsync", true, b -> Core.graphics.setVSync(b));
graphics.checkPref("fullscreen", false, b -> {
if(b && settings.getBool("borderlesswindow")){
Core.graphics.setWindowedMode(Core.graphics.getWidth(), Core.graphics.getHeight());
settings.put("borderlesswindow", false);
graphics.rebuild();
}
if(b){
Core.graphics.setFullscreenMode(Core.graphics.getDisplayMode());
}else{
@@ -374,15 +382,23 @@ public class SettingsMenuDialog extends Dialog{
}
});
graphics.checkPref("borderlesswindow", false, b -> Core.graphics.setUndecorated(b));
graphics.checkPref("borderlesswindow", false, b -> {
if(b && settings.getBool("fullscreen")){
Core.graphics.setWindowedMode(Core.graphics.getWidth(), Core.graphics.getHeight());
settings.put("fullscreen", false);
graphics.rebuild();
}
Core.graphics.setBorderless(b);
});
Core.graphics.setVSync(Core.settings.getBool("vsync"));
if(Core.settings.getBool("fullscreen")){
Core.app.post(() -> Core.graphics.setFullscreenMode(Core.graphics.getDisplayMode()));
}
if(Core.settings.getBool("borderlesswindow")){
Core.app.post(() -> Core.graphics.setUndecorated(true));
Core.app.post(() -> Core.graphics.setBorderless(true));
}
}else if(!ios){
graphics.checkPref("landscape", false, b -> {
@@ -446,11 +462,11 @@ public class SettingsMenuDialog extends Dialog{
}
}
graphics.checkPref("skipcoreanimation", false);
if(!mobile){
Core.settings.put("swapdiagonal", false);
}
graphics.checkPref("flow", true);
}
public void exportData(Fi file) throws IOException{
@@ -610,7 +626,8 @@ public class SettingsMenuDialog extends Dialog{
Setting(String name){
this.name = name;
title = bundle.get("setting." + name + ".name");
String winkey = "setting." + name + ".name.windows";
title = OS.isWindows && bundle.has(winkey) ? bundle.get(winkey) : bundle.get("setting." + name + ".name");
description = bundle.getOrNull("setting." + name + ".description");
}
@@ -32,7 +32,7 @@ public class ChatFragment extends Table{
private Font font;
private GlyphLayout layout = new GlyphLayout();
private float offsetx = Scl.scl(4), offsety = Scl.scl(4), fontoffsetx = Scl.scl(2), chatspace = Scl.scl(50);
private Color shadowColor = new Color(0, 0, 0, 0.4f);
private Color shadowColor = new Color(0, 0, 0, 0.5f);
private float textspacing = Scl.scl(10);
private Seq<String> history = new Seq<>();
private int historyPos = 0;
@@ -12,6 +12,7 @@ import arc.struct.*;
import arc.util.*;
import mindustry.*;
import mindustry.content.*;
import mindustry.game.*;
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.input.*;
@@ -54,6 +55,12 @@ public class HintsFragment extends Fragment{
hints.remove(hint);
}else if(hint != null){
display(hint);
}else{
//moused over a derelict structure
var build = world.buildWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY());
if(build != null && build.team == Team.derelict){
events.add("derelictmouse");
}
}
}
});
@@ -157,6 +164,7 @@ public class HintsFragment extends Fragment{
conveyorPathfind(() -> control.input.block == Blocks.titaniumConveyor, () -> Core.input.keyRelease(Binding.diagonal_placement) || (mobile && Core.settings.getBool("swapdiagonal"))),
boost(visibleDesktop, () -> !player.dead() && player.unit().type.canBoost, () -> Core.input.keyDown(Binding.boost)),
blockInfo(() -> true, () -> ui.content.isShown()),
derelict(() -> ui.hints.events.contains("derelictmouse"), () -> false),
command(() -> state.rules.defaultTeam.data().units.size > 3 && !net.active(), () -> player.unit().isCommanding()),
payloadPickup(() -> !player.unit().dead && player.unit() instanceof Payloadc p && p.payloads().isEmpty(), () -> player.unit() instanceof Payloadc p && p.payloads().any()),
payloadDrop(() -> !player.unit().dead && player.unit() instanceof Payloadc p && p.payloads().any(), () -> player.unit() instanceof Payloadc p && p.payloads().isEmpty()),
@@ -545,20 +545,17 @@ public class HudFragment extends Fragment{
}
}
public void showLaunchDirect(){
Image image = new Image();
image.color.a = 0f;
image.setFillParent(true);
image.actions(Actions.fadeIn(launchDuration / 60f, Interp.pow2In), Actions.delay(8f / 60f), Actions.remove());
Core.scene.add(image);
}
public void showLaunch(){
float margin = 30f;
Image image = new Image();
image.color.a = 0f;
image.touchable = Touchable.disabled;
image.setFillParent(true);
image.actions(Actions.fadeIn(40f / 60f));
image.actions(Actions.delay((coreLandDuration - margin) / 60f), Actions.fadeIn(margin / 60f, Interp.pow2In), Actions.delay(6f / 60f), Actions.remove());
image.update(() -> {
image.toFront();
ui.loadfrag.toFront();
if(state.isMenu()){
image.remove();
}
@@ -571,9 +568,10 @@ public class HudFragment extends Fragment{
image.color.a = 1f;
image.touchable = Touchable.disabled;
image.setFillParent(true);
image.actions(Actions.fadeOut(0.8f), Actions.remove());
image.actions(Actions.fadeOut(35f / 60f), Actions.remove());
image.update(() -> {
image.toFront();
ui.loadfrag.toFront();
if(state.isMenu()){
image.remove();
}
@@ -726,7 +724,7 @@ public class HudFragment extends Fragment{
t.add(new SideBar(() -> player.unit().healthf(), () -> true, true)).width(bw).growY().padRight(pad);
t.image(() -> player.icon()).scaling(Scaling.bounded).grow().maxWidth(54f);
t.add(new SideBar(() -> player.dead() ? 0f : player.displayAmmo() ? player.unit().ammof() : player.unit().healthf(), () -> !player.displayAmmo(), false)).width(bw).growY().padLeft(pad).update(b -> {
b.color.set(player.displayAmmo() ? player.dead() || player.unit() instanceof BlockUnitc ? Pal.ammo : player.unit().type.ammoType.color : Pal.health);
b.color.set(player.displayAmmo() ? player.dead() || player.unit() instanceof BlockUnitc ? Pal.ammo : player.unit().type.ammoType.color() : Pal.health);
});
t.getChildren().get(1).toFront();
@@ -38,13 +38,17 @@ public class LoadingFragment extends Fragment{
text("@loading");
bar = t.add(new Bar()).pad(3).size(500f, 40f).visible(false).get();
bar = t.add(new Bar()).pad(3).padTop(6).size(500f, 40f).visible(false).get();
t.row();
button = t.button("@cancel", () -> {}).pad(20).size(250f, 70f).visible(false).get();
table = t;
});
}
public void toFront(){
table.toFront();
}
public void setProgress(Floatp progress){
bar.reset(0f);
bar.visible = true;
@@ -120,7 +120,6 @@ public class MenuFragment extends Fragment{
table.add(tools);
table.add(mods);
//if(platform.canDonate()) table.add(donate);
if(!ios) table.add(exit);
}).colspan(4);
}else{
@@ -139,7 +138,6 @@ public class MenuFragment extends Fragment{
table.defaults().set(container.defaults());
table.add(mods);
//if(platform.canDonate()) table.add(donate);
if(!ios) table.add(exit);
}).colspan(2);
}
@@ -15,6 +15,7 @@ import mindustry.core.*;
import mindustry.entities.*;
import mindustry.entities.units.*;
import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.input.*;
@@ -38,6 +39,7 @@ public class PlacementFragment extends Fragment{
Block menuHoverBlock;
Displayable hover;
Object lastDisplayState;
Team lastTeam;
boolean wasHovered;
Table blockTable, toggler, topTable;
ScrollPane blockPane;
@@ -283,13 +285,14 @@ public class PlacementFragment extends Fragment{
//don't refresh unnecessarily
//refresh only when the hover state changes, or the displayed block changes
if(wasHovered == isHovered && lastDisplayState == displayState) return;
if(wasHovered == isHovered && lastDisplayState == displayState && lastTeam == player.team()) return;
topTable.clear();
topTable.top().left().margin(5);
lastDisplayState = displayState;
wasHovered = isHovered;
lastTeam = player.team();
//show details of selected block, with costs
if(displayBlock != null){