mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-03 13:30:25 +07:00
Status bar cleanup / Fixed power distribution / Fixed adjacency updates
This commit is contained in:
parent
3d9c9e639d
commit
f3cc881930
@ -67,7 +67,7 @@ public class Annotations {
|
||||
client(false, true),
|
||||
/**Method can be invoked from anywhere*/
|
||||
both(true, true),
|
||||
/**Neither server no client.*/
|
||||
/**Neither server nor client.*/
|
||||
none(false, false);
|
||||
|
||||
/**If true, this method can be invoked ON clients FROM servers.*/
|
||||
|
@ -175,8 +175,8 @@ public class CraftingBlocks extends BlockList implements ContentList {
|
||||
itemCapacity = 40;
|
||||
health = 50;
|
||||
|
||||
consumes.item(Items.stone);
|
||||
consumes.liquid(Liquids.water, 0.2f);
|
||||
consumes.item(Items.stone, 2);
|
||||
consumes.liquid(Liquids.water, 0.3f);
|
||||
}};
|
||||
|
||||
centrifuge = new Separator("centrifuge") {{
|
||||
@ -201,9 +201,9 @@ public class CraftingBlocks extends BlockList implements ContentList {
|
||||
spinnerSpeed = 3f;
|
||||
size = 2;
|
||||
|
||||
consumes.item(Items.stone);
|
||||
consumes.item(Items.stone, 2);
|
||||
consumes.power(0.2f);
|
||||
consumes.liquid(Liquids.water, 0.35f);
|
||||
consumes.liquid(Liquids.water, 0.5f);
|
||||
}};
|
||||
|
||||
biomatterCompressor = new Compressor("biomattercompressor") {{
|
||||
|
@ -151,6 +151,7 @@ public class TileEntity extends BaseEntity implements TargetTrait {
|
||||
for (GridPoint2 point : nearby) {
|
||||
Tile other = world.tile(tile.x + point.x, tile.y + point.y);
|
||||
//remove this tile from all nearby tile's proximities
|
||||
if(other != null) other = other.target();
|
||||
if(other != null && other.entity != null){
|
||||
other.entity.proximity.removeValue(tile, true);
|
||||
}
|
||||
@ -164,6 +165,7 @@ public class TileEntity extends BaseEntity implements TargetTrait {
|
||||
GridPoint2[] nearby = Edges.getEdges(tile.block().size);
|
||||
for (GridPoint2 point : nearby) {
|
||||
Tile other = world.tile(tile.x + point.x, tile.y + point.y);
|
||||
if(other != null) other = other.target();
|
||||
if(other != null && other.entity != null){
|
||||
tmpTiles.add(other);
|
||||
|
||||
|
@ -12,6 +12,7 @@ import io.anuke.mindustry.game.TeamInfo.TeamData;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.consumers.Consume;
|
||||
import io.anuke.mindustry.world.meta.BlockBar;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
@ -129,6 +130,18 @@ public class OverlayRenderer {
|
||||
drawEncloser(target.drawx(), target.drawy() - block.size * tilesize/2f - 2f - values[1], values[1]);
|
||||
}
|
||||
|
||||
Draw.color(Palette.bar);
|
||||
|
||||
int idx = 0;
|
||||
for(Consume cons : block.consumes.all()){
|
||||
if(!cons.valid(block, entity)){
|
||||
Fill.crect(entity.x - block.size/2f + idx*4 - 3, entity.y + block.size/2f + values[0] + 11, 3, 3);
|
||||
idx ++;
|
||||
}
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
|
||||
doDraw[0] = true;
|
||||
values[0] = 0;
|
||||
values[1] = 1;
|
||||
@ -193,25 +206,23 @@ public class OverlayRenderer {
|
||||
|
||||
float len = 3;
|
||||
|
||||
float w = (int) (len * 2 * finion) + 0.5f;
|
||||
|
||||
x -= 0.5f;
|
||||
y += 0.5f;
|
||||
float w = (int) (len * 2 * finion);
|
||||
|
||||
Draw.color(Color.BLACK);
|
||||
Lines.line(x - len + 1, y, x + len + 0.5f, y);
|
||||
Draw.color(color);
|
||||
if(w >= 1)
|
||||
Lines.line(x - len + 1, y, x - len + w, y);
|
||||
Draw.reset();
|
||||
Fill.crect(x - len, y, len*2f, 1);
|
||||
if(finion > 0){
|
||||
Draw.color(color);
|
||||
Fill.crect(x - len, y, Math.max(1, w), 1);
|
||||
}
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
void drawEncloser(float x, float y, float height){
|
||||
|
||||
float len = 3;
|
||||
float len = 4;
|
||||
|
||||
Draw.color(Palette.bar);
|
||||
Fill.crect(x - len - 1, y - 1, len*2f + 2f, height + 2f);
|
||||
Fill.crect(x - len, y - 1, len*2f, height + 2f);
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,9 @@ public class DebugFragment extends Fragment {
|
||||
new table("pane"){{
|
||||
defaults().fillX().width(100f);
|
||||
|
||||
new label(() -> Gdx.app.getJavaHeap() / 1024 / 1024 + "MB");
|
||||
row();
|
||||
|
||||
new label("Debug");
|
||||
row();
|
||||
new button("noclip", "toggle", () -> noclip = !noclip);
|
||||
|
@ -184,9 +184,12 @@ public class PowerNode extends PowerBlock{
|
||||
entity.powerRecieved = 0f;
|
||||
}
|
||||
|
||||
float added = super.addPower(tile, amount);
|
||||
entity.powerRecieved += added;
|
||||
return added;
|
||||
float canAccept = Math.min(powerCapacity * Timers.delta() - tile.entity.power.amount, amount);
|
||||
|
||||
tile.entity.power.amount += canAccept;
|
||||
entity.powerRecieved += canAccept;
|
||||
|
||||
return canAccept;
|
||||
}
|
||||
|
||||
protected boolean shouldDistribute(Tile tile, Tile other) {
|
||||
@ -226,7 +229,7 @@ public class PowerNode extends PowerBlock{
|
||||
Tile target = world.tile(entity.links.get(i));
|
||||
if(shouldDistribute(tile, target)) {
|
||||
|
||||
float transmit = Math.min(result * Timers.delta(), entity.power.amount);
|
||||
float transmit = Math.min(result, entity.power.amount);
|
||||
if (target.block().acceptPower(target, tile, transmit)) {
|
||||
entity.power.amount -= target.block().addPower(target, transmit);
|
||||
}
|
||||
|
@ -90,11 +90,11 @@ public class PowerSmelter extends PowerBlock {
|
||||
|
||||
//heat it up if there's enough power
|
||||
if(entity.cons.valid()){
|
||||
entity.heat += 1f / heatUpTime;
|
||||
entity.heat += 1f / heatUpTime * Timers.delta();
|
||||
if(Mathf.chance(Timers.delta() * burnEffectChance))
|
||||
Effects.effect(burnEffect, entity.x + Mathf.range(size*4f), entity.y + Mathf.range(size*4));
|
||||
}else{
|
||||
entity.heat -= 1f / heatUpTime;
|
||||
entity.heat -= 1f / heatUpTime * Timers.delta();
|
||||
}
|
||||
|
||||
entity.heat = Mathf.clamp(entity.heat);
|
||||
|
@ -94,7 +94,7 @@ public class Separator extends Block {
|
||||
if(entity.progress >= 1f){
|
||||
entity.progress = 0f;
|
||||
Item item = Mathf.select(results);
|
||||
entity.items.remove(consumes.item(), 1);
|
||||
entity.items.remove(consumes.item(), consumes.itemAmount());
|
||||
if(item != null){
|
||||
offloading = true;
|
||||
offloadNear(tile, item);
|
||||
|
@ -26,6 +26,10 @@ public abstract class Consume {
|
||||
return update;
|
||||
}
|
||||
|
||||
public void draw(TileEntity entity){
|
||||
|
||||
}
|
||||
|
||||
public abstract void update(Block block, TileEntity entity);
|
||||
public abstract boolean valid(Block block, TileEntity entity);
|
||||
public abstract void display(BlockStats stats);
|
||||
|
Loading…
Reference in New Issue
Block a user