Fixed power bug
|
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 107 B After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 941 B |
|
Before Width: | Height: | Size: 141 B After Width: | Height: | Size: 961 B |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
@@ -685,7 +685,7 @@ public class Bullets implements ContentList{
|
|||||||
lifetime = 23f;
|
lifetime = 23f;
|
||||||
speed = 1f;
|
speed = 1f;
|
||||||
splashDamageRadius = 50f;
|
splashDamageRadius = 50f;
|
||||||
splashDamage = 30f;
|
splashDamage = 20f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -363,7 +363,11 @@ public class Block extends BlockStorage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(hasPower && consumes.has(ConsumePower.class)){
|
if(hasPower && consumes.has(ConsumePower.class)){
|
||||||
bars.add("power", entity -> new Bar(consumes.get(ConsumePower.class).isBuffered ? "blocks.power" : "blocks.power.satisfaction", Pal.powerBar, () -> entity.power.satisfaction));
|
boolean buffered = consumes.get(ConsumePower.class).isBuffered;
|
||||||
|
float capacity = consumes.get(ConsumePower.class).powerCapacity;
|
||||||
|
|
||||||
|
bars.add("power", entity -> new Bar(() -> buffered ? Core.bundle.format("blocks.powerbalance", Float.isNaN(entity.power.satisfaction * capacity) ? "<BUGGED>" : (int)(entity.power.satisfaction * capacity)) :
|
||||||
|
Core.bundle.get("blocks.power"), () -> Pal.powerBar, () -> entity.power.satisfaction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class MassDriver extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureRegion[] generateIcons(){
|
public TextureRegion[] generateIcons(){
|
||||||
return new TextureRegion[]{Core.atlas.find(name + "-base"), Core.atlas.find(name + "-turret")};
|
return new TextureRegion[]{Core.atlas.find(name + "-base"), Core.atlas.find(name)};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class PowerGraph{
|
|||||||
|
|
||||||
public void distributePower(float needed, float produced){
|
public void distributePower(float needed, float produced){
|
||||||
//distribute even if not needed. this is because some might be requiring power but not requesting it; it updates consumers
|
//distribute even if not needed. this is because some might be requiring power but not requesting it; it updates consumers
|
||||||
float coverage = Math.min(1, produced / needed);
|
float coverage = Math.min(1, produced / (Mathf.isZero(needed) ? 1f : needed));
|
||||||
for(Tile consumer : consumers){
|
for(Tile consumer : consumers){
|
||||||
Consumers consumes = consumer.block().consumes;
|
Consumers consumes = consumer.block().consumes;
|
||||||
if(consumes.has(ConsumePower.class)){
|
if(consumes.has(ConsumePower.class)){
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class Unloader extends Block implements SelectionTrait{
|
|||||||
|
|
||||||
SortedUnloaderEntity entity = tile.entity();
|
SortedUnloaderEntity entity = tile.entity();
|
||||||
|
|
||||||
Draw.color(entity.sortItem == null ? Color.WHITE : entity.sortItem.color);
|
Draw.color(entity.sortItem == null ? Color.CLEAR : entity.sortItem.color);
|
||||||
Draw.rect("blank", tile.worldx(), tile.worldy(), 2f, 2f);
|
Draw.rect("blank", tile.worldx(), tile.worldy(), 2f, 2f);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import io.anuke.arc.scene.ui.layout.Table;
|
|||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
import io.anuke.mindustry.entities.type.TileEntity;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.Item.Icon;
|
import io.anuke.mindustry.type.Item.Icon;
|
||||||
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.ui.ItemImage;
|
import io.anuke.mindustry.ui.ItemImage;
|
||||||
import io.anuke.mindustry.ui.ReqImage;
|
import io.anuke.mindustry.ui.ReqImage;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
@@ -60,6 +61,6 @@ public class ConsumeItem extends Consume{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void display(BlockStats stats){
|
public void display(BlockStats stats){
|
||||||
stats.add(boost ? BlockStat.boostItem : BlockStat.inputItem, item);
|
stats.add(boost ? BlockStat.boostItem : BlockStat.inputItem, new ItemStack(item, amount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,5 +34,6 @@ public class PowerModule extends BlockModule{
|
|||||||
links.add(stream.readInt());
|
links.add(stream.readInt());
|
||||||
}
|
}
|
||||||
satisfaction = stream.readFloat();
|
satisfaction = stream.readFloat();
|
||||||
|
if(Float.isNaN(satisfaction) || Float.isInfinite(satisfaction)) satisfaction = 0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||