mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-22 20:41:58 -08:00
Merge branch 'master' of https://github.com/Anuken/Mindustry into save-rewrite
This commit is contained in:
commit
eb4f6f2e9f
6 changed files with 31 additions and 11 deletions
|
|
@ -66,7 +66,7 @@ public class Pathfinder{
|
|||
if(other == null) continue;
|
||||
|
||||
if(values[dx][dy] < value && (target == null || values[dx][dy] < tl) &&
|
||||
!other.solid() &&
|
||||
!other.solid() && other.floor().drownTime <= 0 &&
|
||||
!(point.x != 0 && point.y != 0 && (world.solid(tile.x + point.x, tile.y) || world.solid(tile.x, tile.y + point.y)))){ //diagonal corner trap
|
||||
target = other;
|
||||
tl = values[dx][dy];
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class Net{
|
|||
}else if(error.equals("alreadyconnected")){
|
||||
error = Core.bundle.get("error.alreadyconnected");
|
||||
}else if(!error.isEmpty()){
|
||||
error = Core.bundle.get("error.any");
|
||||
error = Core.bundle.get("error.any") + "\n" + t.getClass().getSimpleName() + "\n" + (t.getMessage() == null ? "" : t.getMessage());
|
||||
}
|
||||
|
||||
ui.showText("", Core.bundle.format("connectfail", error));
|
||||
|
|
|
|||
|
|
@ -433,15 +433,17 @@ public class Block extends BlockStorage{
|
|||
}else{
|
||||
current = entity -> entity.liquids.current();
|
||||
}
|
||||
bars.add("liquid", entity -> new Bar(() -> entity.liquids.get(current.get(entity)) <= 0.001f ? Core.bundle.get("bar.liquid") : current.get(entity).localizedName(), () -> current.get(entity).color, () -> entity.liquids.get(current.get(entity)) / liquidCapacity));
|
||||
bars.add("liquid", entity -> new Bar(() -> entity.liquids.get(current.get(entity)) <= 0.001f ? Core.bundle.get("bar.liquid") : current.get(entity).localizedName(),
|
||||
() -> current.get(entity).color, () -> entity.liquids.get(current.get(entity)) / liquidCapacity));
|
||||
}
|
||||
|
||||
if(hasPower && consumes.hasPower()){
|
||||
boolean buffered = consumes.getPower().buffered;
|
||||
float capacity = consumes.getPower().capacity;
|
||||
ConsumePower cons = consumes.getPower();
|
||||
boolean buffered = cons.buffered;
|
||||
float capacity = cons.capacity;
|
||||
|
||||
bars.add("power", entity -> new Bar(() -> buffered ? Core.bundle.format("bar.poweramount", Float.isNaN(entity.power.satisfaction * capacity) ? "<ERROR>" : (int)(entity.power.satisfaction * capacity)) :
|
||||
Core.bundle.get("bar.power"), () -> Pal.powerBar, () -> entity.power.satisfaction));
|
||||
Core.bundle.get("bar.power"), () -> Pal.powerBar, () -> Mathf.isZero(cons.requestedPower(entity)) && entity.power.graph.getPowerProduced() + entity.power.graph.getBatteryStored() > 0f ? 1f : entity.power.satisfaction));
|
||||
}
|
||||
|
||||
if(hasItems && configurable){
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ public class Tile implements Position, TargetTrait{
|
|||
Point2 point = Geometry.d8[i];
|
||||
Tile tile = world.tile(x + point.x, y + point.y);
|
||||
if(tile != null && tile.floor.isLiquid){
|
||||
cost += 3;
|
||||
cost += 4;
|
||||
}
|
||||
if(tile != null && tile.solid()){
|
||||
occluded = true;
|
||||
|
|
@ -392,17 +392,35 @@ public class Tile implements Position, TargetTrait{
|
|||
}
|
||||
}
|
||||
|
||||
//+24
|
||||
|
||||
if(occluded){
|
||||
cost += 2;
|
||||
}
|
||||
|
||||
//+26
|
||||
|
||||
if(target().synthetic()){
|
||||
cost += Mathf.clamp(target().block().health / 10f, 0, 20);
|
||||
}
|
||||
|
||||
//+46
|
||||
|
||||
if(floor.isLiquid){
|
||||
cost += 10;
|
||||
}
|
||||
|
||||
//+56
|
||||
|
||||
if(floor.drownTime > 0){
|
||||
cost += 70;
|
||||
}
|
||||
|
||||
//+126
|
||||
|
||||
if(cost < 0){
|
||||
cost = Byte.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
protected void preChanged(){
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ public abstract class PowerTurret extends CooledTurret{
|
|||
|
||||
@Override
|
||||
public boolean hasAmmo(Tile tile){
|
||||
//only shoot if there's power
|
||||
return tile.entity.cons.valid();
|
||||
//you can always rotate, but never shoot if there's no power
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -37,6 +37,6 @@ public abstract class PowerTurret extends CooledTurret{
|
|||
|
||||
@Override
|
||||
protected float baseReloadSpeed(Tile tile){
|
||||
return tile.entity.power.satisfaction;
|
||||
return tile.isEnemyCheat() ? 1f : tile.entity.power.satisfaction;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ public class UnitFactory extends Block{
|
|||
entity.cons.trigger();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Tile tile, Item item){
|
||||
return capacities[item.id];
|
||||
|
|
@ -199,6 +198,7 @@ public class UnitFactory extends Block{
|
|||
public void write(DataOutput stream) throws IOException{
|
||||
super.write(stream);
|
||||
stream.writeFloat(buildTime);
|
||||
stream.writeFloat(0f);
|
||||
stream.writeInt(spawned);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue