Merged with master
This commit is contained in:
@@ -58,7 +58,7 @@ public class Blocks implements ContentList{
|
||||
//transport
|
||||
conveyor, titaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router, overflowGate, underflowGate, massDriver,
|
||||
|
||||
//liquids
|
||||
//liquid
|
||||
mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, platedConduit, liquidRouter, liquidTank, liquidJunction, bridgeConduit, phaseConduit,
|
||||
|
||||
//power
|
||||
|
||||
@@ -130,4 +130,4 @@ public interface Platform{
|
||||
/** Stops forcing the app into landscape orientation.*/
|
||||
default void endForceLandscape(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,4 +337,4 @@ public class MapEditor{
|
||||
world.endMapLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ public enum UnitCommand{
|
||||
public String localized(){
|
||||
return localized;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,8 @@ public class MusicControl{
|
||||
/** Plays and fades in a music track. This must be called every frame.
|
||||
* If something is already playing, fades out that track and fades in this new music.*/
|
||||
private void play(@Nullable Music music){
|
||||
if(!shouldPlay()) return;
|
||||
|
||||
//update volume of current track
|
||||
if(current != null){
|
||||
current.setVolume(fade * Core.settings.getInt("musicvol") / 100f);
|
||||
@@ -143,7 +145,7 @@ public class MusicControl{
|
||||
|
||||
/** Plays a music track once and only once. If something is already playing, does nothing.*/
|
||||
private void playOnce(Music music){
|
||||
if(current != null || music == null) return; //do not interrupt already-playing tracks
|
||||
if(current != null || music == null || !shouldPlay()) return; //do not interrupt already-playing tracks
|
||||
|
||||
//save last random track played to prevent duplicates
|
||||
lastRandomPlayed = music;
|
||||
@@ -162,6 +164,10 @@ public class MusicControl{
|
||||
current.play();
|
||||
}
|
||||
|
||||
private boolean shouldPlay(){
|
||||
return Core.settings.getInt("musicvol") > 0;
|
||||
}
|
||||
|
||||
/** Fades out the current track, unless it has already been silenced. */
|
||||
private void silence(){
|
||||
play(null);
|
||||
|
||||
@@ -375,7 +375,7 @@ public class Schematics implements Loadable{
|
||||
/** Loads a schematic from base64. May throw an exception. */
|
||||
public static Schematic readBase64(String schematic){
|
||||
try{
|
||||
return read(new ByteArrayInputStream(Base64Coder.decode(schematic)));
|
||||
return read(new ByteArrayInputStream(Base64Coder.decode(schematic.trim())));
|
||||
}catch(IOException e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -175,4 +175,4 @@ public class MapIO{
|
||||
interface TileProvider{
|
||||
Tile get(int x, int y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,4 +501,4 @@ public class Maps{
|
||||
return provider.next(previous);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,4 @@ public class TerrainFilter extends GenerateFilter{
|
||||
in.block = Blocks.air;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ public class Mods implements Loadable{
|
||||
|
||||
Fi metaf = zip.child("mod.json").exists() ? zip.child("mod.json") : zip.child("mod.hjson").exists() ? zip.child("mod.hjson") : zip.child("plugin.json");
|
||||
if(!metaf.exists()){
|
||||
Log.warn("Mod {0} doesn't have a 'mod.json'/'plugin.json'/'mod.js' file, skipping.", sourceFile);
|
||||
Log.warn("Mod {0} doesn't have a 'mod.json'/'mod.hjson'/'plugin.json' file, skipping.", sourceFile);
|
||||
throw new IllegalArgumentException("No mod.json found.");
|
||||
}
|
||||
|
||||
|
||||
@@ -418,4 +418,4 @@ public class ArcNetProvider implements NetProvider{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +65,4 @@ public class Interpolator{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ItemsDisplay extends Table{
|
||||
t.setText(state.is(State.menu) ? "$launcheditems" : "$launchinfo");
|
||||
t.setChecked(col.isCollapsed());
|
||||
((Image)t.getChildren().get(1)).setDrawable(col.isCollapsed() ? Icon.upOpen : Icon.downOpen);
|
||||
}).padBottom(4).left().fillX().margin(12f);
|
||||
}).padBottom(4).left().fillX().margin(12f).minWidth(200f);
|
||||
c.row();
|
||||
c.add(col);
|
||||
});
|
||||
|
||||
@@ -91,4 +91,4 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
|
||||
cont.add(pane).uniformX();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import arc.util.serialization.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.net.*;
|
||||
import mindustry.net.Packets.*;
|
||||
import mindustry.ui.*;
|
||||
@@ -25,6 +26,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
Server renaming;
|
||||
Table local = new Table();
|
||||
Table remote = new Table();
|
||||
Table global = new Table();
|
||||
Table hosts = new Table();
|
||||
int totalHosts;
|
||||
|
||||
@@ -80,15 +82,11 @@ public class JoinDialog extends FloatingDialog{
|
||||
}
|
||||
});
|
||||
|
||||
keyDown(KeyCode.F5, () -> {
|
||||
refreshLocal();
|
||||
refreshRemote();
|
||||
});
|
||||
keyDown(KeyCode.F5, this::refreshAll);
|
||||
|
||||
shown(() -> {
|
||||
setup();
|
||||
refreshLocal();
|
||||
refreshRemote();
|
||||
refreshAll();
|
||||
|
||||
if(!steam){
|
||||
Core.app.post(() -> Core.settings.getBoolOnce("joininfo", () -> ui.showInfo("$join.info")));
|
||||
@@ -97,11 +95,16 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
onResize(() -> {
|
||||
setup();
|
||||
refreshLocal();
|
||||
refreshRemote();
|
||||
refreshAll();
|
||||
});
|
||||
}
|
||||
|
||||
void refreshAll(){
|
||||
refreshLocal();
|
||||
refreshRemote();
|
||||
refreshGlobal();
|
||||
}
|
||||
|
||||
void setupRemote(){
|
||||
remote.clear();
|
||||
|
||||
@@ -128,21 +131,12 @@ public class JoinDialog extends FloatingDialog{
|
||||
inner.add(button.getLabel()).growX();
|
||||
|
||||
inner.addImageButton(Icon.upOpen, Styles.emptyi, () -> {
|
||||
int index = servers.indexOf(server);
|
||||
if(index > 0){
|
||||
servers.remove(index);
|
||||
servers.insert(0, server);
|
||||
moveRemote(server, -1);
|
||||
|
||||
saveServers();
|
||||
setupRemote();
|
||||
for(Server other : servers){
|
||||
if(other.lastHost != null){
|
||||
setupServer(other, other.lastHost);
|
||||
}else{
|
||||
refreshServer(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).margin(3f).padTop(6f).top().right();
|
||||
|
||||
inner.addImageButton(Icon.downOpen, Styles.emptyi, () -> {
|
||||
moveRemote(server, +1);
|
||||
|
||||
}).margin(3f).pad(2).padTop(6f).top().right();
|
||||
|
||||
@@ -172,6 +166,26 @@ public class JoinDialog extends FloatingDialog{
|
||||
}
|
||||
}
|
||||
|
||||
void moveRemote(Server server, int sign){
|
||||
int index = servers.indexOf(server);
|
||||
|
||||
if(index + sign < 0) return;
|
||||
if(index + sign > servers.size - 1) return;
|
||||
|
||||
servers.remove(index);
|
||||
servers.insert(index + sign, server);
|
||||
|
||||
saveServers();
|
||||
setupRemote();
|
||||
for(Server other : servers){
|
||||
if(other.lastHost != null){
|
||||
setupServer(other, other.lastHost);
|
||||
}else{
|
||||
refreshServer(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void refreshRemote(){
|
||||
for(Server server : servers){
|
||||
refreshServer(server);
|
||||
@@ -232,9 +246,9 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
hosts.clear();
|
||||
|
||||
hosts.add(remote).growX();
|
||||
hosts.row();
|
||||
hosts.add(local).width(w);
|
||||
section("$servers.local", local);
|
||||
section("$servers.remote", remote);
|
||||
section("$servers.global", global);
|
||||
|
||||
ScrollPane pane = new ScrollPane(hosts);
|
||||
pane.setFadeScrollBars(false);
|
||||
@@ -289,6 +303,24 @@ public class JoinDialog extends FloatingDialog{
|
||||
});
|
||||
}
|
||||
|
||||
void section(String label, Table servers){
|
||||
Collapser coll = new Collapser(servers, Core.settings.getBool("collapsed-" + label, false));
|
||||
coll.setDuration(0.1f);
|
||||
|
||||
hosts.table(name -> {
|
||||
name.add(label).pad(10).growX().left().color(Pal.accent);
|
||||
name.addImageButton(Icon.downOpen, Styles.emptyi, () -> {
|
||||
coll.toggle(false);
|
||||
Core.settings.putSave("collapsed-" + label, coll.isCollapsed());
|
||||
}).update(i -> i.getStyle().imageUp = (!coll.isCollapsed() ? Icon.upOpen : Icon.downOpen)).size(40f).right().padRight(10f);
|
||||
}).growX();
|
||||
hosts.row();
|
||||
hosts.addImage().growX().pad(5).padLeft(10).padRight(10).height(3).color(Pal.accent);
|
||||
hosts.row();
|
||||
hosts.add(coll).width(targetWidth());
|
||||
hosts.row();
|
||||
}
|
||||
|
||||
void refreshLocal(){
|
||||
totalHosts = 0;
|
||||
|
||||
@@ -296,12 +328,17 @@ public class JoinDialog extends FloatingDialog{
|
||||
local.background(null);
|
||||
local.table(Tex.button, t -> t.label(() -> "[accent]" + Core.bundle.get("hosts.discovering.any") + Strings.animated(Time.time(), 4, 10f, ".")).pad(10f)).growX();
|
||||
net.discoverServers(this::addLocalHost, this::finishLocalHosts);
|
||||
}
|
||||
|
||||
void refreshGlobal(){
|
||||
global.clear();
|
||||
global.background(null);
|
||||
for(String host : defaultServers){
|
||||
String resaddress = host.contains(":") ? host.split(":")[0] : host;
|
||||
int resport = host.contains(":") ? Strings.parseInt(host.split(":")[1]) : port;
|
||||
net.pingHost(resaddress, resport, res -> {
|
||||
res.port = resport;
|
||||
addLocalHost(res);
|
||||
addGlobalHost(res);
|
||||
}, e -> {});
|
||||
}
|
||||
}
|
||||
@@ -334,6 +371,18 @@ public class JoinDialog extends FloatingDialog{
|
||||
buildServer(host, button);
|
||||
}
|
||||
|
||||
void addGlobalHost(Host host){
|
||||
global.background(null);
|
||||
float w = targetWidth();
|
||||
|
||||
global.row();
|
||||
|
||||
TextButton button = global.addButton("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
|
||||
.width(w).pad(5f).get();
|
||||
button.clearChildren();
|
||||
buildServer(host, button);
|
||||
}
|
||||
|
||||
public void connect(String ip, int port){
|
||||
if(player.name().trim().isEmpty()){
|
||||
ui.showInfo("$noname");
|
||||
@@ -428,4 +477,4 @@ public class JoinDialog extends FloatingDialog{
|
||||
public Server(){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,4 +288,4 @@ public class BranchTreeLayout implements TreeLayout{
|
||||
public enum TreeAlignment{
|
||||
center, towardsRoot, awayFromRoot
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,4 +222,4 @@ public class Floor extends Block{
|
||||
return block.edges()[x][2 - y];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,4 +378,4 @@ public class Conveyor extends Block implements Autotiler{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ public class Junction extends Block{
|
||||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
instantTransfer = true;
|
||||
group = BlockGroup.transportation;
|
||||
unloadable = false;
|
||||
entityType = JunctionEntity::new;
|
||||
|
||||
@@ -39,7 +39,6 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
||||
}
|
||||
|
||||
if(entity.uptime >= 0.5f){
|
||||
|
||||
if(tryMoveLiquid(tile, other, false, entity.liquids().current()) > 0.1f){
|
||||
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 4f, 0.05f);
|
||||
}else{
|
||||
|
||||
@@ -137,7 +137,7 @@ public class GenericCrafter extends Block{
|
||||
if(outputItem != null && tile.entity.items().get(outputItem.item) >= itemCapacity){
|
||||
return false;
|
||||
}
|
||||
return outputLiquid == null || !(tile.entity.liquids().get(outputLiquid.liquid) >= liquidCapacity);
|
||||
return outputLiquid == null || !(tile.entity.liquids().get(outputLiquid.liquid) >= liquidCapacity - 0.001f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,4 +18,4 @@ public class FloorValue implements StatValue{
|
||||
table.add(new Image(floor.icon(Cicon.small))).padRight(3);
|
||||
table.add(floor.localizedName).padRight(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user