Fixed some junction issues / Improved server crash reporting
This commit is contained in:
@@ -73,7 +73,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
private Tile mining;
|
||||
private CarriableTrait carrying;
|
||||
private Trail trail = new Trail(12);
|
||||
private Vector2 movement = new Vector2();
|
||||
private Vector2 movement = new Translator();
|
||||
private boolean moved;
|
||||
|
||||
public Player(){
|
||||
|
||||
@@ -101,9 +101,7 @@ public abstract class BaseBlock{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how much power is accepted.
|
||||
*/
|
||||
/**Returns how much power is accepted.*/
|
||||
public float addPower(Tile tile, float amount){
|
||||
float canAccept = Math.min(powerCapacity - tile.entity.power.amount, amount);
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@ package io.anuke.mindustry.world.blocks.distribution;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.BarType;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.LiquidBlock;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
|
||||
//TODO fix
|
||||
public class LiquidJunction extends LiquidBlock{
|
||||
|
||||
public LiquidJunction(String name){
|
||||
@@ -14,6 +15,18 @@ public class LiquidJunction extends LiquidBlock{
|
||||
hasLiquids = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
bars.remove(BarType.liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
stats.remove(BlockStat.liquidCapacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
Draw.rect(name(), tile.worldx(), tile.worldy());
|
||||
@@ -30,8 +43,9 @@ public class LiquidJunction extends LiquidBlock{
|
||||
dir = (dir + 4) % 4;
|
||||
Tile to = tile.getNearby(dir);
|
||||
|
||||
if(to.block().hasLiquids && to.block().acceptLiquid(to, tile, liquid, amount))
|
||||
to.block().handleLiquid(to, tile, liquid, amount);
|
||||
if(to.block().hasLiquids && to.block().acceptLiquid(to, tile, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount))){
|
||||
to.block().handleLiquid(to, tile, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +53,6 @@ public class LiquidJunction extends LiquidBlock{
|
||||
int dir = source.relativeTo(dest.x, dest.y);
|
||||
dir = (dir + 4) % 4;
|
||||
Tile to = dest.getNearby(dir);
|
||||
return to != null && to.block().hasLiquids &&
|
||||
to.block().acceptLiquid(to, dest, liquid, amount);
|
||||
return to != null && to.block().hasLiquids && to.block().acceptLiquid(to, dest, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,20 +11,25 @@ public class LiquidModule extends BlockModule{
|
||||
private float total;
|
||||
private Liquid current = Liquid.getByID(0);
|
||||
|
||||
/**
|
||||
* Returns total amount of liquids.
|
||||
*/
|
||||
/**Returns total amount of liquids.*/
|
||||
public float total(){
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last recieved or loaded liquid. Only valid for liquid modules with 1 type of liquid.
|
||||
*/
|
||||
/**Last recieved or loaded liquid. Only valid for liquid modules with 1 type of liquid.*/
|
||||
public Liquid current(){
|
||||
return current;
|
||||
}
|
||||
|
||||
public void reset(Liquid liquid, float amount){
|
||||
for(int i = 0; i < liquids.length; i++){
|
||||
liquids[i] = 0f;
|
||||
}
|
||||
liquids[liquid.id] = amount;
|
||||
total = amount;
|
||||
current = liquid;
|
||||
}
|
||||
|
||||
public float currentAmount(){
|
||||
return liquids[current.id];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user