mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-25 22:12:16 -08:00
parent
5e0ba2f4af
commit
557cb1c532
6 changed files with 25 additions and 4 deletions
|
|
@ -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 ?
|
||||
|
|
|
|||
|
|
@ -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){
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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){
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue