Partial power usage / Drill ID priority / Liquid source deselect
This commit is contained in:
@@ -19,8 +19,12 @@ public class Version{
|
||||
public static int build = 0;
|
||||
/** Revision number. Used for hotfixes. Does not affect server compatibility. */
|
||||
public static int revision = 0;
|
||||
/** Whether version loading is enabled. */
|
||||
public static boolean enabled = true;
|
||||
|
||||
public static void init(){
|
||||
if(!enabled) return;
|
||||
|
||||
try{
|
||||
FileHandle file = Core.files.internal("version.properties");
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@ public class BundleLoader{
|
||||
|
||||
Locale locale = getLocale();
|
||||
Locale.setDefault(locale);
|
||||
if(!headless) Log.info("Got locale: {0}", locale);
|
||||
Core.bundle = I18NBundle.createBundle(handle, locale);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Item extends UnlockableContent implements Comparable<Item>{
|
||||
* base material cost of this item, used for calculating place times
|
||||
* 1 cost = 1 tick added to build time
|
||||
*/
|
||||
public float cost = 3f;
|
||||
public float cost = 1f;
|
||||
/** If true, item is always unlocked. */
|
||||
public boolean alwaysUnlocked = false;
|
||||
|
||||
|
||||
@@ -180,8 +180,6 @@ public class Drill extends Block{
|
||||
itemArray.sort((item1, item2) -> {
|
||||
int type = Boolean.compare(item1.type == ItemType.material, item2.type == ItemType.material);
|
||||
if(type != 0) return type;
|
||||
int count = Integer.compare(oreCount.get(item1, 0), oreCount.get(item2, 0));
|
||||
if(count != 0) return count;
|
||||
return Integer.compare(item1.id, item2.id);
|
||||
});
|
||||
|
||||
|
||||
@@ -51,8 +51,12 @@ public class LiquidSource extends Block{
|
||||
public void update(Tile tile){
|
||||
LiquidSourceEntity entity = tile.entity();
|
||||
|
||||
tile.entity.liquids.add(entity.source, liquidCapacity);
|
||||
tryDumpLiquid(tile, entity.source);
|
||||
if(entity.source == null){
|
||||
tile.entity.liquids.clear();
|
||||
}else{
|
||||
tile.entity.liquids.add(entity.source, liquidCapacity);
|
||||
tryDumpLiquid(tile, entity.source);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,9 +65,11 @@ public class LiquidSource extends Block{
|
||||
|
||||
LiquidSourceEntity entity = tile.entity();
|
||||
|
||||
Draw.color(entity.source.color);
|
||||
Draw.rect("blank", tile.worldx(), tile.worldy(), 4f, 4f);
|
||||
Draw.color();
|
||||
if(entity.source != null){
|
||||
Draw.color(entity.source.color);
|
||||
Draw.rect("blank", tile.worldx(), tile.worldy(), 4f, 4f);
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,17 +79,19 @@ public class LiquidSource extends Block{
|
||||
Array<Liquid> items = content.liquids();
|
||||
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
group.setMinCheckCount(0);
|
||||
Table cont = new Table();
|
||||
|
||||
for(int i = 0; i < items.size; i++){
|
||||
final int f = i;
|
||||
ImageButton button = cont.addImageButton("clear", "clear-toggle", 24, () -> {
|
||||
Call.setLiquidSourceLiquid(null, tile, items.get(f));
|
||||
ImageButton button = cont.addImageButton("clear", "clear-toggle", 24, () -> control.input().frag.config.hideConfig()).size(38).group(group).get();
|
||||
button.changed(() -> {
|
||||
Call.setLiquidSourceLiquid(null, tile, button.isChecked() ? items.get(f) : null);
|
||||
control.input().frag.config.hideConfig();
|
||||
lastLiquid = items.get(f);
|
||||
}).size(38).group(group).get();
|
||||
});
|
||||
button.getStyle().imageUp = new TextureRegionDrawable(items.get(i).iconRegion);
|
||||
button.setChecked(entity.source.id == f);
|
||||
button.setChecked(entity.source == items.get(i));
|
||||
|
||||
if(i % 4 == 3){
|
||||
cont.row();
|
||||
@@ -105,16 +113,17 @@ public class LiquidSource extends Block{
|
||||
}
|
||||
|
||||
class LiquidSourceEntity extends TileEntity{
|
||||
public Liquid source = Liquids.water;
|
||||
public Liquid source = null;
|
||||
|
||||
@Override
|
||||
public void writeConfig(DataOutput stream) throws IOException{
|
||||
stream.writeByte(source.id);
|
||||
stream.writeByte(source == null ? -1 : source.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readConfig(DataInput stream) throws IOException{
|
||||
source = content.liquid(stream.readByte());
|
||||
byte id = stream.readByte();
|
||||
source = id == -1 ? null : content.liquid(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ConsumePower extends Consume{
|
||||
if(isBuffered){
|
||||
return true;
|
||||
}else{
|
||||
return entity.power.satisfaction >= 0.9999f;
|
||||
return entity.power.satisfaction > 0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.modules;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
|
||||
@@ -38,6 +39,11 @@ public class LiquidModule extends BlockModule{
|
||||
return liquids[liquid.id];
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
total = 0;
|
||||
Arrays.fill(liquids, 0);
|
||||
}
|
||||
|
||||
public void add(Liquid liquid, float amount){
|
||||
liquids[liquid.id] += amount;
|
||||
total += amount;
|
||||
|
||||
Reference in New Issue
Block a user