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

View File

@@ -48,10 +48,10 @@ public class LiquidBlocks extends BlockList implements ContentList{
}};
liquidRouter = new LiquidRouter("liquid-router"){{
liquidCapacity = 40f;
liquidCapacity = 20f;
}};
liquidtank = new LiquidRouter("liquid-tank"){{
liquidtank = new LiquidTank("liquid-tank"){{
size = 3;
liquidCapacity = 1500f;
health = 500;

View File

@@ -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();
}

View File

@@ -127,6 +127,7 @@ public class Saves{
saveMap.put(slot.index, slot);
slot.meta = SaveIO.getData(slot.index);
current = slot;
slot.meta.sector = invalidSector;
saveSlots();
return slot;
}
@@ -164,26 +165,17 @@ public class Saves{
public void save(){
long time = totalPlaytime;
renderer.fog.writeFog();
long prev = totalPlaytime;
totalPlaytime = time;
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();
SaveIO.saveToSlot(index);
meta = SaveIO.getData(index);
if(!state.is(State.menu)){
current = this;
}
//save on the logic thread
threads.run(() -> {
long prev = totalPlaytime;
totalPlaytime = time;
SaveIO.saveToSlot(index);
meta = SaveIO.getData(index);
if(!state.is(State.menu)){
current = this;
}
totalPlaytime = prev;
});
});
totalPlaytime = prev;
}
public boolean isHidden(){

View File

@@ -203,7 +203,7 @@ public class OverlayRenderer{
if(finion > 0.9f) finion = 1f; //fixes precision errors
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;

View File

@@ -198,7 +198,7 @@ public class FileChooser extends FloatingDialog{
//macs are confined to the Downloads/ directory
if(!OS.isMac){
Image upimage = new Image("icon-folder-parent");
TextButton upbutton = new TextButton(".." + directory.toString(), "clear");
TextButton upbutton = new TextButton(".." + directory.toString(), "clear-toggle");
upbutton.clicked(() -> {
directory = directory.parent();
updateFiles(true);
@@ -220,7 +220,7 @@ public class FileChooser extends FloatingDialog{
String filename = file.name();
TextButton button = new TextButton(shorten(filename), "clear");
TextButton button = new TextButton(shorten(filename), "clear-toggle");
group.add(button);
button.clicked(() -> {

View File

@@ -161,6 +161,7 @@ public class LoadDialog extends FloatingDialog{
control.saves.importSave(file);
setup();
}catch(IOException e){
e.printStackTrace();
ui.showError(Bundles.format("text.save.import.fail", Strings.parseException(e, false)));
}
}else{

View File

@@ -184,7 +184,7 @@ public class PlacementFragment extends Fragment{
categories.addImageButton("icon-" + cat.name(), "clear-toggle", 16*2, () -> {
currentCategory = cat;
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();
}

View File

@@ -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);
}
}