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