mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-10 18:57:39 +07:00
Fixed some junction issues / Improved server crash reporting
This commit is contained in:
parent
5e29115c2e
commit
3b63f60462
Binary file not shown.
Before Width: | Height: | Size: 113 B After Width: | Height: | Size: 183 B |
@ -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];
|
||||
}
|
||||
|
@ -39,8 +39,9 @@ public class CrashHandler{
|
||||
|
||||
//add all relevant info, ignoring exceptions
|
||||
ex(() -> value.addChild("build", new JsonValue(Version.build)));
|
||||
ex(() -> value.addChild("mode", new JsonValue(Vars.state.mode.toString())));
|
||||
ex(() -> value.addChild("difficulty", new JsonValue(Vars.state.difficulty.toString())));
|
||||
ex(() -> value.addChild("mode", new JsonValue(Vars.state.mode.name())));
|
||||
ex(() -> value.addChild("state", new JsonValue(Vars.state.getState().name())));
|
||||
ex(() -> value.addChild("difficulty", new JsonValue(Vars.state.difficulty.name())));
|
||||
ex(() -> value.addChild("players", new JsonValue(Vars.playerGroup.size())));
|
||||
ex(() -> value.addChild("os", new JsonValue(System.getProperty("os.name"))));
|
||||
ex(() -> value.addChild("trace", new JsonValue(parseException(e))));
|
||||
|
Loading…
Reference in New Issue
Block a user