Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	gradle.properties
This commit is contained in:
Anuken
2021-11-10 14:36:45 -05:00
19 changed files with 57 additions and 31 deletions

View File

@@ -29,6 +29,7 @@ import mindustry.world.blocks.*;
import mindustry.world.blocks.environment.*;
import mindustry.world.blocks.power.*;
import mindustry.world.consumers.*;
import mindustry.entities.bullet.*;
import mindustry.world.meta.*;
import java.lang.reflect.*;
@@ -133,6 +134,8 @@ public class Block extends UnlockableContent{
public int health = -1;
/** base block explosiveness */
public float baseExplosiveness = 0f;
/** bullet that this block spawns when destroyed */
public @Nullable BulletType destroyBullet = null;
/** whether this block can be placed on edges of liquids. */
public boolean floating = false;
/** multiblock size */

View File

@@ -56,6 +56,10 @@ public class Attributes implements JsonSerializable{
}
private void check(){
if(arr.length != Attribute.all.length) arr = new float[Attribute.all.length];
if(arr.length != Attribute.all.length){
var last = arr;
arr = new float[Attribute.all.length];
System.arraycopy(last, 0, arr, 0, Math.min(last.length, arr.length));
}
}
}

View File

@@ -76,7 +76,7 @@ public class OverdriveProjector extends Block{
@Override
public void setBars(){
super.setBars();
bars.add("boost", (OverdriveBuild entity) -> new Bar(() -> Core.bundle.format("bar.boost", Math.max((int)(entity.realBoost() * 100 - 100), 0)), () -> Pal.accent, () -> entity.realBoost() / (hasBoost ? speedBoost + speedBoostPhase : speedBoost)));
bars.add("boost", (OverdriveBuild entity) -> new Bar(() -> Core.bundle.format("bar.boost", Mathf.round(Math.max((entity.realBoost() * 100 - 100), 0))), () -> Pal.accent, () -> entity.realBoost() / (hasBoost ? speedBoost + speedBoostPhase : speedBoost)));
}
public class OverdriveBuild extends Building implements Ranged{

View File

@@ -430,9 +430,6 @@ public class Turret extends ReloadTurret{
int ii = i;
Time.run(burstSpacing * i, () -> {
if(dead || !hasAmmo()) return;
recoil = recoilAmount;
tr.trns(rotation, shootLength, Mathf.range(xRand));
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (ii - (int)(shots / 2f)) * spread);
effects();
@@ -519,4 +516,4 @@ public class Turret extends ReloadTurret{
return 1;
}
}
}
}

View File

@@ -252,6 +252,7 @@ public class MassDriver extends Block{
@Override
public boolean onConfigureTileTapped(Building other){
if(this == other){
if(link == -1) deselect();
configure(-1);
return false;
}

View File

@@ -432,6 +432,7 @@ public class PayloadMassDriver extends PayloadBlock{
@Override
public boolean onConfigureTileTapped(Building other){
if(this == other){
if(link == -1) deselect();
configure(-1);
return false;
}

View File

@@ -20,6 +20,7 @@ public class Battery extends PowerDistributor{
super(name);
outputsPower = true;
consumesPower = true;
canOverdrive = false;
flags = EnumSet.of(BlockFlag.battery);
//TODO could be supported everywhere...
envEnabled |= Env.space;

View File

@@ -53,7 +53,6 @@ public class CoreBlock extends StorageBlock{
//support everything
envEnabled = Env.any;
drawDisabled = false;
replaceable = false;
rebuildable = false;
}

View File

@@ -118,6 +118,16 @@ public class CommandCenter extends Block{
table.label(() -> team.data().command.localized()).style(Styles.outlineLabel).center().growX().get().setAlignment(Align.center);
}
@Override
public boolean onConfigureTileTapped(Building other){
if(this == other){
deselect();
return false;
}
return true;
}
@Override
public void write(Writes write){
super.write(write);