@@ -45,6 +45,16 @@ public class BuilderAI extends AIController{
|
|||||||
//approach request if building
|
//approach request if building
|
||||||
BuildPlan req = unit.buildPlan();
|
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 =
|
boolean valid =
|
||||||
(req.tile() != null && req.tile().build instanceof ConstructBuild && req.tile().<ConstructBuild>bc().cblock == req.block) ||
|
(req.tile() != null && req.tile().build instanceof ConstructBuild && req.tile().<ConstructBuild>bc().cblock == req.block) ||
|
||||||
(req.breaking ?
|
(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. */
|
/** 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){
|
public static Object pointConfig(Block block, Object config, Cons<Point2> cons){
|
||||||
if(config instanceof Point2){
|
if(config instanceof Point2){
|
||||||
|
|||||||
@@ -278,8 +278,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
throw new ValidateException(player, "Player cannot drop an item.");
|
throw new ValidateException(player, "Player cannot drop an item.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Fx.dropItem.at(player.x, player.y, angle, Color.white, player.unit().item());
|
player.unit().eachGroup(unit -> {
|
||||||
player.unit().clearItem();
|
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)
|
@Remote(targets = Loc.both, called = Loc.server, forward = true, unreliable = true)
|
||||||
|
|||||||
@@ -82,6 +82,10 @@ public class Bar extends Element{
|
|||||||
lastValue = computed;
|
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.isNaN(computed)) computed = 0;
|
||||||
if(Float.isInfinite(computed)) computed = 1f;
|
if(Float.isInfinite(computed)) computed = 1f;
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ public class Block extends UnlockableContent{
|
|||||||
Tile tile = world.tile(x, y);
|
Tile tile = world.tile(x, y);
|
||||||
if(tile == null) return 0;
|
if(tile == null) return 0;
|
||||||
return tile.getLinkedTilesAs(this, tempTiles)
|
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){
|
public TextureRegion getDisplayIcon(Tile tile){
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class Accelerator extends Block{
|
|||||||
public @Load("launch-arrow") TextureRegion arrowRegion;
|
public @Load("launch-arrow") TextureRegion arrowRegion;
|
||||||
|
|
||||||
public Block launching = Blocks.coreNucleus;
|
public Block launching = Blocks.coreNucleus;
|
||||||
public int[] capacities = new int[content.items().size];
|
public int[] capacities;
|
||||||
|
|
||||||
public Accelerator(String name){
|
public Accelerator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -35,6 +35,7 @@ public class Accelerator extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
itemCapacity = 0;
|
itemCapacity = 0;
|
||||||
|
capacities = new int[content.items().size];
|
||||||
for(ItemStack stack : launching.requirements){
|
for(ItemStack stack : launching.requirements){
|
||||||
capacities[stack.item.id] = stack.amount;
|
capacities[stack.item.id] = stack.amount;
|
||||||
itemCapacity += stack.amount;
|
itemCapacity += stack.amount;
|
||||||
|
|||||||
Reference in New Issue
Block a user