Merge branch 'master' of https://github.com/Anuken/Mindustry into baltitenger

This commit is contained in:
Timmeey86
2018-12-07 19:40:10 +01:00
14 changed files with 120 additions and 108 deletions
@@ -48,10 +48,10 @@ public class LiquidBlocks extends BlockList implements ContentList{
}}; }};
liquidRouter = new LiquidRouter("liquid-router"){{ liquidRouter = new LiquidRouter("liquid-router"){{
liquidCapacity = 40f; liquidCapacity = 20f;
}}; }};
liquidtank = new LiquidRouter("liquid-tank"){{ liquidtank = new LiquidTank("liquid-tank"){{
size = 3; size = 3;
liquidCapacity = 1500f; liquidCapacity = 1500f;
health = 500; health = 500;
@@ -375,7 +375,7 @@ public class Control extends Module{
} }
} }
if(Inputs.keyTap("screenshot") && !ui.chatfrag.chatOpen()){ if(!mobile && Inputs.keyTap("screenshot") && !ui.chatfrag.chatOpen()){
renderer.takeMapScreenshot(); renderer.takeMapScreenshot();
} }
+1 -9
View File
@@ -127,6 +127,7 @@ public class Saves{
saveMap.put(slot.index, slot); saveMap.put(slot.index, slot);
slot.meta = SaveIO.getData(slot.index); slot.meta = SaveIO.getData(slot.index);
current = slot; current = slot;
slot.meta.sector = invalidSector;
saveSlots(); saveSlots();
return slot; return slot;
} }
@@ -164,14 +165,7 @@ public class Saves{
public void save(){ public void save(){
long time = totalPlaytime; long time = totalPlaytime;
threads.runGraphics(() -> {
//Renderer fog needs to be written on graphics thread, but save() can run on logic thread
//thus, runGraphics is required here
renderer.fog.writeFog(); renderer.fog.writeFog();
//save on the logic thread
threads.run(() -> {
long prev = totalPlaytime; long prev = totalPlaytime;
totalPlaytime = time; totalPlaytime = time;
@@ -182,8 +176,6 @@ public class Saves{
} }
totalPlaytime = prev; totalPlaytime = prev;
});
});
} }
public boolean isHidden(){ public boolean isHidden(){
@@ -203,7 +203,7 @@ public class OverlayRenderer{
if(finion > 0.9f) finion = 1f; //fixes precision errors if(finion > 0.9f) finion = 1f; //fixes precision errors
finion = Mathf.clamp(finion); finion = Mathf.clamp(finion);
if(finion > 0) finion = Mathf.clamp(finion, 0.24f, 1f); if(finion > 0.001f) finion = Mathf.clamp(finion, 0.24f, 1f);
float len = 3; float len = 3;
@@ -198,7 +198,7 @@ public class FileChooser extends FloatingDialog{
//macs are confined to the Downloads/ directory //macs are confined to the Downloads/ directory
if(!OS.isMac){ if(!OS.isMac){
Image upimage = new Image("icon-folder-parent"); Image upimage = new Image("icon-folder-parent");
TextButton upbutton = new TextButton(".." + directory.toString(), "clear"); TextButton upbutton = new TextButton(".." + directory.toString(), "clear-toggle");
upbutton.clicked(() -> { upbutton.clicked(() -> {
directory = directory.parent(); directory = directory.parent();
updateFiles(true); updateFiles(true);
@@ -220,7 +220,7 @@ public class FileChooser extends FloatingDialog{
String filename = file.name(); String filename = file.name();
TextButton button = new TextButton(shorten(filename), "clear"); TextButton button = new TextButton(shorten(filename), "clear-toggle");
group.add(button); group.add(button);
button.clicked(() -> { button.clicked(() -> {
@@ -161,6 +161,7 @@ public class LoadDialog extends FloatingDialog{
control.saves.importSave(file); control.saves.importSave(file);
setup(); setup();
}catch(IOException e){ }catch(IOException e){
e.printStackTrace();
ui.showError(Bundles.format("text.save.import.fail", Strings.parseException(e, false))); ui.showError(Bundles.format("text.save.import.fail", Strings.parseException(e, false)));
} }
}else{ }else{
@@ -184,7 +184,7 @@ public class PlacementFragment extends Fragment{
categories.addImageButton("icon-" + cat.name(), "clear-toggle", 16*2, () -> { categories.addImageButton("icon-" + cat.name(), "clear-toggle", 16*2, () -> {
currentCategory = cat; currentCategory = cat;
rebuildCategory.run(); rebuildCategory.run();
}).group(group).update(i -> i.setChecked(group.getChecked() == i)); }).group(group).update(i -> i.setChecked(currentCategory == cat));
if(cat.ordinal() %2 == 1) categories.row(); if(cat.ordinal() %2 == 1) categories.row();
} }
@@ -0,0 +1,16 @@
package io.anuke.mindustry.world.blocks.distribution;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.Tile;
public class LiquidTank extends LiquidRouter{
public LiquidTank(String name){
super(name);
}
@Override
public boolean canDumpLiquid(Tile tile, Tile to, Liquid liquid){
return super.canDumpLiquid(tile, to, liquid) && !(to.block() instanceof LiquidTank);
}
}
+5 -2
View File
@@ -139,7 +139,8 @@ public class KryoServer implements ServerProvider {
try{ try{
if(!UPnP.isMappedTCP(port)) UPnP.openPortTCP(port); if(!UPnP.isMappedTCP(port)) UPnP.openPortTCP(port);
if(!UPnP.isMappedUDP(port)) UPnP.openPortUDP(port); if(!UPnP.isMappedUDP(port)) UPnP.openPortUDP(port);
}catch(Throwable ignored){} }catch(Throwable ignored){
}
}); });
} }
@@ -251,7 +252,9 @@ public class KryoServer implements ServerProvider {
} }
private void handleException(Throwable e){ private void handleException(Throwable e){
Timers.run(0f, () -> { throw new RuntimeException(e);}); Timers.run(0f, () -> {
throw new RuntimeException(e);
});
} }
KryoConnection getByKryoID(int id){ KryoConnection getByKryoID(int id){