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

@@ -576,11 +576,14 @@ public class NetClient implements ApplicationListener{
for(int i = 0; i < usedRequests; i++){ for(int i = 0; i < usedRequests; i++){
BuildPlan plan = player.unit().plans().get(i); BuildPlan plan = player.unit().plans().get(i);
if(plan.config instanceof byte[] b){ if(plan.config instanceof byte[] b){
int length = b.length; totalLength += b.length;
totalLength += length;
} }
if(totalLength > 1024){ if(plan.config instanceof String b){
totalLength += b.length();
}
if(totalLength > 500){
usedRequests = i + 1; usedRequests = i + 1;
break; break;
} }

View File

@@ -21,9 +21,7 @@ public class EmpBulletType extends BasicBulletType{
Vars.indexer.allBuildings(x, y, radius, other -> { Vars.indexer.allBuildings(x, y, radius, other -> {
if(other.team == b.team){ if(other.team == b.team){
if(other.block.hasPower && other.block.canOverdrive && other.timeScale < timeIncrease){ if(other.block.hasPower && other.block.canOverdrive && other.timeScale < timeIncrease){
if(timeIncrease >= other.timeScale){
other.timeScale = Math.max(other.timeScale, timeIncrease); other.timeScale = Math.max(other.timeScale, timeIncrease);
}
other.timeScaleDuration = Math.max(other.timeScaleDuration, timeDuration); other.timeScaleDuration = Math.max(other.timeScaleDuration, timeDuration);
chainEffect.at(x, y, 0, hitColor, other); chainEffect.at(x, y, 0, hitColor, other);
applyEffect.at(other, other.block.size * 7f); applyEffect.at(other, other.block.size * 7f);

View File

@@ -269,7 +269,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public void applyBoost(float intensity, float duration){ public void applyBoost(float intensity, float duration){
//do not refresh time scale when getting a weaker intensity //do not refresh time scale when getting a weaker intensity
if(intensity >= this.timeScale){ if(intensity >= this.timeScale - 0.001f){
timeScaleDuration = Math.max(timeScaleDuration, duration); timeScaleDuration = Math.max(timeScaleDuration, duration);
} }
timeScale = Math.max(timeScale, intensity); timeScale = Math.max(timeScale, intensity);
@@ -280,11 +280,13 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
} }
public Building nearby(int rotation){ public Building nearby(int rotation){
if(rotation == 0) return world.build(tile.x + 1, tile.y); return switch(rotation){
if(rotation == 1) return world.build(tile.x, tile.y + 1); case 0 -> world.build(tile.x + 1, tile.y);
if(rotation == 2) return world.build(tile.x - 1, tile.y); case 1 -> world.build(tile.x, tile.y + 1);
if(rotation == 3) return world.build(tile.x, tile.y - 1); case 2 -> world.build(tile.x - 1, tile.y);
return null; case 3 -> world.build(tile.x, tile.y - 1);
default -> null;
};
} }
public byte relativeTo(Tile tile){ public byte relativeTo(Tile tile){
@@ -1033,7 +1035,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
/** Called *after* the tile has been removed. */ /** Called *after* the tile has been removed. */
public void afterDestroyed(){ public void afterDestroyed(){
if(block.destroyBullet != null){
//I really do not like that the bullet will not destroy derelict
//but I can't do anything about it without using a random team
//which may or may not cause issues with servers and js
block.destroyBullet.create(this, Team.derelict, x, y, 0);
}
} }
/** @return the cap for item amount calculations, used when this block explodes. */ /** @return the cap for item amount calculations, used when this block explodes. */

View File

@@ -242,7 +242,8 @@ public class SectorInfo{
production.get(item).mean = Math.min(production.get(item).mean, rawProduction.get(item).mean); production.get(item).mean = Math.min(production.get(item).mean, rawProduction.get(item).mean);
if(export.containsKey(item)){ if(export.containsKey(item)){
export.get(item).mean = Math.min(export.get(item).mean, Math.max(rawProduction.get(item).mean, -production.get(item).mean)); //export can, at most, be the raw items being produced from factories + the items being taken from the core
export.get(item).mean = Math.min(export.get(item).mean, rawProduction.get(item).mean + Math.max(-production.get(item).mean, 0));
} }
} }

View File

@@ -182,6 +182,7 @@ public class LightRenderer{
public void draw(){ public void draw(){
if(!Vars.enableLight){ if(!Vars.enableLight){
lights.clear(); lights.clear();
circleIndex = 0;
return; return;
} }

View File

@@ -31,7 +31,7 @@ public class ContentInfoDialog extends BaseDialog{
table.table(title1 -> { table.table(title1 -> {
title1.image(content.uiIcon).size(iconXLarge).scaling(Scaling.fit); title1.image(content.uiIcon).size(iconXLarge).scaling(Scaling.fit);
title1.add("[accent]" + content.localizedName).padLeft(5); title1.add("[accent]" + content.localizedName + (enableConsole ? "\n[gray]" + content.name : "")).padLeft(5);
}); });
table.row(); table.row();

View File

@@ -98,7 +98,7 @@ public class DatabaseDialog extends BaseDialog{
ui.content.show(unlock); ui.content.show(unlock);
} }
}); });
image.addListener(new Tooltip(t -> t.background(Tex.button).add(unlock.localizedName))); image.addListener(new Tooltip(t -> t.background(Tex.button).add(unlock.localizedName + (enableConsole ? "\n[gray]" + unlock.name : ""))));
} }
if((++count) % cols == 0){ if((++count) % cols == 0){

View File

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

View File

@@ -56,6 +56,10 @@ public class Attributes implements JsonSerializable{
} }
private void check(){ 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 @Override
public void setBars(){ public void setBars(){
super.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{ public class OverdriveBuild extends Building implements Ranged{

View File

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

View File

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

View File

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

View File

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

View File

@@ -53,7 +53,6 @@ public class CoreBlock extends StorageBlock{
//support everything //support everything
envEnabled = Env.any; envEnabled = Env.any;
drawDisabled = false;
replaceable = false; replaceable = false;
rebuildable = 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); 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 @Override
public void write(Writes write){ public void write(Writes write){
super.write(write); super.write(write);

View File

@@ -1,12 +1,12 @@
[ [
{
"name": "Mindustry Central",
"address": ["n2.mindustry.me:4019", "mindustry.me:2034", "mindustry.me:2035"]
},
{ {
"name": "RCM", "name": "RCM",
"address": ["185.104.248.61", "easyplay.su"] "address": ["185.104.248.61", "easyplay.su"]
}, },
{
"name": "SkaarjDustry",
"address": ["skaarjproject.duckdns.org"]
},
{ {
"name": "{AA}", "name": "{AA}",
"address": ["aamindustry.play.ai", "aamindustry.play.ai:6571", "aamindustry.play.ai:6572", "aamindustry.play.ai:6573", "aamindustry.play.ai:6574"] "address": ["aamindustry.play.ai", "aamindustry.play.ai:6571", "aamindustry.play.ai:6572", "aamindustry.play.ai:6573", "aamindustry.play.ai:6574"]
@@ -104,8 +104,8 @@
"address": ["usfr2.forcehost.net:25578"] "address": ["usfr2.forcehost.net:25578"]
}, },
{ {
"name": "Español", "name": "Mindustry Español",
"address": ["168.119.36.188:41445"] "address": ["n2.mindustry.me:4019", "mindustry.me:2034", "mindustry.me:2035"]
}, },
{ {
"name": "CreateDustry", "name": "CreateDustry",

View File

@@ -33,7 +33,7 @@
}, },
{ {
"name": "XCore", "name": "XCore",
"address": ["35.202.253.94", "35.202.253.94:2000"] "address": ["skaarjproject.duckdns.org:2000"]
}, },
{ {
"name": "Obvilion Network", "name": "Obvilion Network",