Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -209,6 +209,7 @@ public class Block extends UnlockableContent{
|
||||
public @Load("@-team") TextureRegion teamRegion;
|
||||
public TextureRegion[] teamRegions;
|
||||
|
||||
//TODO make this not static
|
||||
public static TextureRegion[][] cracks;
|
||||
protected static final Seq<Tile> tempTiles = new Seq<>();
|
||||
protected static final Seq<Building> tempTileEnts = new Seq<>();
|
||||
@@ -499,7 +500,7 @@ public class Block extends UnlockableContent{
|
||||
return variantRegions;
|
||||
}
|
||||
|
||||
public boolean hasEntity(){
|
||||
public boolean hasBuilding(){
|
||||
return destructible || update;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,13 @@ public class Build{
|
||||
|
||||
/** Returns whether a tile can be placed at this location by this team. */
|
||||
public static boolean validPlace(Block type, Team team, int x, int y, int rotation){
|
||||
return validPlace(type, team, x, y, rotation, true);
|
||||
}
|
||||
|
||||
/** Returns whether a tile can be placed at this location by this team. */
|
||||
public static boolean validPlace(Block type, Team team, int x, int y, int rotation, boolean checkVisible){
|
||||
//the wave team can build whatever they want as long as it's visible - banned blocks are not applicable
|
||||
if(type == null || (!type.isPlaceable() && !(state.rules.waves && team == state.rules.waveTeam && type.isVisible()))){
|
||||
if(type == null || (checkVisible && (!type.isPlaceable() && !(state.rules.waves && team == state.rules.waveTeam && type.isVisible())))){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class CachedTile extends Tile{
|
||||
|
||||
Block block = block();
|
||||
|
||||
if(block.hasEntity()){
|
||||
if(block.hasBuilding()){
|
||||
Building n = entityprov.get();
|
||||
n.cons(new ConsumeModule(build));
|
||||
n.tile(this);
|
||||
|
||||
@@ -508,7 +508,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
}
|
||||
}
|
||||
|
||||
if(block.hasEntity()){
|
||||
if(block.hasBuilding()){
|
||||
build = entityprov.get().init(this, team, block.update && !state.isEditor(), rotation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,11 @@ public class LaunchPad extends Block{
|
||||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
if(!state.isCampaign()){
|
||||
deselect();
|
||||
return;
|
||||
}
|
||||
|
||||
table.button(Icon.upOpen, Styles.clearTransi, () -> {
|
||||
ui.planet.showSelect(state.rules.sector, other -> state.secinfo.destination = other);
|
||||
deselect();
|
||||
|
||||
@@ -14,6 +14,7 @@ import arc.util.io.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.Units.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
@@ -67,6 +68,7 @@ public abstract class Turret extends Block{
|
||||
public float coolantMultiplier = 5f;
|
||||
/** Effect displayed when coolant is used. */
|
||||
public Effect coolEffect = Fx.fuelburn;
|
||||
public Sortf unitSort = Unit::dst2;
|
||||
|
||||
protected Vec2 tr = new Vec2();
|
||||
protected Vec2 tr2 = new Vec2();
|
||||
@@ -306,9 +308,9 @@ public abstract class Turret extends Block{
|
||||
|
||||
protected void findTarget(){
|
||||
if(targetAir && !targetGround){
|
||||
target = Units.closestEnemy(team, x, y, range, e -> !e.dead() && !e.isGrounded());
|
||||
target = Units.bestEnemy(team, x, y, range, e -> !e.dead() && !e.isGrounded(), unitSort);
|
||||
}else{
|
||||
target = Units.closestTarget(team, x, y, range, e -> !e.dead() && (e.isGrounded() || targetAir) && (!e.isGrounded() || targetGround));
|
||||
target = Units.bestTarget(team, x, y, range, e -> !e.dead() && (e.isGrounded() || targetAir) && (!e.isGrounded() || targetGround), b -> true, unitSort);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +399,7 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
protected void bullet(BulletType type, float angle){
|
||||
float lifeScl = type.scaleVelocity ? Mathf.clamp(Mathf.dst(x, y, targetPos.x, targetPos.y) / type.range(), minRange / type.range(), range / type.range()) : 1f;
|
||||
float lifeScl = type.scaleVelocity ? Mathf.clamp(Mathf.dst(x + tr.x, y + tr.y, targetPos.x, targetPos.y) / type.range(), minRange / type.range(), range / type.range()) : 1f;
|
||||
|
||||
type.create(this, team, x + tr.x, y + tr.y, angle, 1f + Mathf.range(velocityInaccuracy), lifeScl);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
public PowerNode(String name){
|
||||
super(name);
|
||||
expanded = true;
|
||||
configurable = true;
|
||||
consumesPower = false;
|
||||
outputsPower = false;
|
||||
@@ -392,7 +391,7 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
if(!linkValid(this, link)) continue;
|
||||
|
||||
if(link.block instanceof PowerNode && !(link.pos() < tile.pos())) continue;
|
||||
if(link.block instanceof PowerNode && link.id >= id) continue;
|
||||
|
||||
drawLaser(team, x, y, link.x, link.y, size, link.block.size);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class CoreBlock extends StorageBlock{
|
||||
CoreBuild core = team.core();
|
||||
//must have all requirements
|
||||
if(core == null || (!state.rules.infiniteResources && !core.items.has(requirements))) return false;
|
||||
return canReplace(tile.block());
|
||||
return tile.block() instanceof CoreBlock && size > tile.block().size;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user