Fixed #3834 / Fixed #3835 / Fixed #3837

This commit is contained in:
Anuken 2020-12-07 11:10:19 -05:00
parent 5e0ba2f4af
commit 557cb1c532
6 changed files with 25 additions and 4 deletions

View file

@ -45,6 +45,16 @@ public class BuilderAI extends AIController{
//approach request if building
BuildPlan req = unit.buildPlan();
//clear break plan if another player is breaking something.
if(!req.breaking && timer.get(timerTarget2, 40f)){
for(Player player : Groups.player){
if(player.isBuilder() && player.unit().activelyBuilding() && player.unit().buildPlan().samePos(req) && player.unit().buildPlan().breaking){
unit.plans.removeFirst();
return;
}
}
}
boolean valid =
(req.tile() != null && req.tile().build instanceof ConstructBuild && req.tile().<ConstructBuild>bc().cblock == req.block) ||
(req.breaking ?

View file

@ -61,6 +61,10 @@ public class BuildPlan implements Position{
}
public boolean samePos(BuildPlan other){
return x == other.x && y == other.y;
}
/** Transforms the internal position of this config using the specified function, and return the result. */
public static Object pointConfig(Block block, Object config, Cons<Point2> cons){
if(config instanceof Point2){

View file

@ -278,8 +278,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
throw new ValidateException(player, "Player cannot drop an item.");
}
Fx.dropItem.at(player.x, player.y, angle, Color.white, player.unit().item());
player.unit().clearItem();
player.unit().eachGroup(unit -> {
Fx.dropItem.at(unit.x, unit.y, angle, Color.white, unit.item());
unit.clearItem();
});
}
@Remote(targets = Loc.both, called = Loc.server, forward = true, unreliable = true)

View file

@ -82,6 +82,10 @@ public class Bar extends Element{
lastValue = computed;
}
if(Float.isNaN(lastValue)) lastValue = 0;
if(Float.isInfinite(lastValue)) lastValue = 1f;
if(Float.isNaN(value)) value = 0;
if(Float.isInfinite(value)) value = 1f;
if(Float.isNaN(computed)) computed = 0;
if(Float.isInfinite(computed)) computed = 1f;

View file

@ -287,7 +287,7 @@ public class Block extends UnlockableContent{
Tile tile = world.tile(x, y);
if(tile == null) return 0;
return tile.getLinkedTilesAs(this, tempTiles)
.sumf(other -> other.floor().attributes.get(attr));
.sumf(other -> !floating && other.floor().isDeep() ? 0 : other.floor().attributes.get(attr));
}
public TextureRegion getDisplayIcon(Tile tile){

View file

@ -21,7 +21,7 @@ public class Accelerator extends Block{
public @Load("launch-arrow") TextureRegion arrowRegion;
public Block launching = Blocks.coreNucleus;
public int[] capacities = new int[content.items().size];
public int[] capacities;
public Accelerator(String name){
super(name);
@ -35,6 +35,7 @@ public class Accelerator extends Block{
@Override
public void init(){
itemCapacity = 0;
capacities = new int[content.items().size];
for(ItemStack stack : launching.requirements){
capacities[stack.item.id] = stack.amount;
itemCapacity += stack.amount;