Merge branch 'master' into formatting
This commit is contained in:
@@ -187,7 +187,7 @@ public class Vars implements Loadable{
|
||||
public static ContentLoader content;
|
||||
public static GameState state;
|
||||
public static EntityCollisions collisions;
|
||||
public static DefaultWaves defaultWaves;
|
||||
public static Waves waves;
|
||||
public static LoopControl loops;
|
||||
public static Platform platform = new Platform(){};
|
||||
public static Mods mods;
|
||||
@@ -256,7 +256,7 @@ public class Vars implements Loadable{
|
||||
|
||||
content = new ContentLoader();
|
||||
loops = new LoopControl();
|
||||
defaultWaves = new DefaultWaves();
|
||||
waves = new Waves();
|
||||
collisions = new EntityCollisions();
|
||||
world = new World();
|
||||
universe = new Universe();
|
||||
|
||||
@@ -1191,7 +1191,7 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.power, with(Items.lead, 100, Items.silicon, 75, Items.phaseFabric, 25, Items.plastanium, 75, Items.thorium, 50));
|
||||
size = 2;
|
||||
powerProduction = 4.5f;
|
||||
itemDuration = 60 * 18f;
|
||||
itemDuration = 60 * 15f;
|
||||
}};
|
||||
|
||||
solarPanel = new SolarGenerator("solar-panel"){{
|
||||
@@ -1543,10 +1543,10 @@ public class Blocks implements ContentList{
|
||||
|
||||
hasPower = true;
|
||||
size = 2;
|
||||
force = 5f;
|
||||
scaledForce = 5.5f;
|
||||
range = 160f;
|
||||
damage = 0.4f;
|
||||
force = 7f;
|
||||
scaledForce = 7f;
|
||||
range = 220f;
|
||||
damage = 0.3f;
|
||||
health = 160 * size * size;
|
||||
rotateSpeed = 10;
|
||||
|
||||
@@ -1991,8 +1991,8 @@ public class Blocks implements ContentList{
|
||||
|
||||
illuminator = new LightBlock("illuminator"){{
|
||||
requirements(Category.effect, BuildVisibility.lightingOnly, with(Items.graphite, 12, Items.silicon, 8));
|
||||
brightness = 0.67f;
|
||||
radius = 140f;
|
||||
brightness = 0.75f;
|
||||
radius = 160f;
|
||||
consumes.power(0.06f);
|
||||
}};
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ public class Bullets implements ContentList{
|
||||
status = StatusEffects.burning;
|
||||
frontColor = Pal.lightishOrange;
|
||||
backColor = Pal.lightOrange;
|
||||
makeFire = true;
|
||||
trailEffect = Fx.incendTrail;
|
||||
}};
|
||||
|
||||
@@ -265,6 +266,7 @@ public class Bullets implements ContentList{
|
||||
homingPower = 0.08f;
|
||||
splashDamageRadius = 20f;
|
||||
splashDamage = 20f;
|
||||
makeFire = true;
|
||||
hitEffect = Fx.blastExplosion;
|
||||
status = StatusEffects.burning;
|
||||
}};
|
||||
@@ -323,6 +325,7 @@ public class Bullets implements ContentList{
|
||||
frontColor = Pal.lightishOrange;
|
||||
backColor = Pal.lightOrange;
|
||||
status = StatusEffects.burning;
|
||||
makeFire = true;
|
||||
inaccuracy = 3f;
|
||||
lifetime = 60f;
|
||||
}};
|
||||
@@ -348,6 +351,7 @@ public class Bullets implements ContentList{
|
||||
backColor = Pal.lightOrange;
|
||||
status = StatusEffects.burning;
|
||||
shootEffect = Fx.shootBig;
|
||||
makeFire = true;
|
||||
pierceCap = 2;
|
||||
pierceBuilding = true;
|
||||
}};
|
||||
|
||||
@@ -257,33 +257,33 @@ public class Fx{
|
||||
randLenVectors(e.id, 9, 3 + 20f * e.finpow(), (x, y) -> {
|
||||
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.4f);
|
||||
});
|
||||
}).ground(),
|
||||
}).layer(Layer.debris),
|
||||
|
||||
unitLand = new Effect(30, e -> {
|
||||
color(Tmp.c1.set(e.color).mul(1.1f));
|
||||
randLenVectors(e.id, 6, 17f * e.finpow(), (x, y) -> {
|
||||
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.3f);
|
||||
});
|
||||
}).ground(),
|
||||
}).layer(Layer.debris),
|
||||
|
||||
unitLandSmall = new Effect(30, e -> {
|
||||
color(Tmp.c1.set(e.color).mul(1.1f));
|
||||
randLenVectors(e.id, (int)(6 * e.rotation), 12f * e.finpow() * e.rotation, (x, y) -> {
|
||||
Fill.circle(e.x + x, e.y + y, e.fout() * 3f + 0.1f);
|
||||
});
|
||||
}).ground(),
|
||||
}).layer(Layer.debris),
|
||||
|
||||
unitPickup = new Effect(18, e -> {
|
||||
color(Pal.lightishGray);
|
||||
stroke(e.fin() * 2f);
|
||||
Lines.poly(e.x, e.y, 4, 13f * e.fout());
|
||||
}).ground(),
|
||||
}).layer(Layer.debris),
|
||||
|
||||
landShock = new Effect(12, e -> {
|
||||
color(Pal.lancerLaser);
|
||||
stroke(e.fout() * 3f);
|
||||
Lines.poly(e.x, e.y, 12, 20f * e.fout());
|
||||
}).ground(),
|
||||
}).layer(Layer.debris),
|
||||
|
||||
pickup = new Effect(18, e -> {
|
||||
color(Pal.lightishGray);
|
||||
@@ -1076,7 +1076,7 @@ public class Fx{
|
||||
e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
|
||||
1f, 2f, rot + e.fin() * 50f * i);
|
||||
|
||||
}).ground(400f),
|
||||
}).layer(Layer.debris, 400f),
|
||||
|
||||
shellEjectMedium = new Effect(34f, e -> {
|
||||
color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin());
|
||||
@@ -1099,7 +1099,7 @@ public class Fx{
|
||||
});
|
||||
}
|
||||
|
||||
}).ground(400f),
|
||||
}).layer(Layer.debris, 400f),
|
||||
|
||||
shellEjectBig = new Effect(22f, e -> {
|
||||
color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin());
|
||||
@@ -1123,7 +1123,7 @@ public class Fx{
|
||||
});
|
||||
}
|
||||
|
||||
}).ground(400f),
|
||||
}).layer(Layer.debris, 400f),
|
||||
|
||||
railShoot = new Effect(24f, e -> {
|
||||
e.scaled(10f, b -> {
|
||||
@@ -1500,7 +1500,7 @@ public class Fx{
|
||||
color(Tmp.c1.set(e.color).mul(1.5f));
|
||||
stroke(e.fout() * 1.4f);
|
||||
Lines.circle(e.x, e.y, (2f + e.fin() * 4f) * e.rotation);
|
||||
}).ground(),
|
||||
}).layer(Layer.debris),
|
||||
|
||||
bubble = new Effect(20, e -> {
|
||||
color(Tmp.c1.set(e.color).shiftValue(0.1f));
|
||||
|
||||
@@ -875,6 +875,7 @@ public class UnitTypes implements ContentList{
|
||||
health = 75;
|
||||
engineOffset = 5.5f;
|
||||
range = 140f;
|
||||
targetAir = false;
|
||||
|
||||
weapons.add(new Weapon(){{
|
||||
y = 0f;
|
||||
@@ -1290,7 +1291,7 @@ public class UnitTypes implements ContentList{
|
||||
collides = false;
|
||||
|
||||
healPercent = 15f;
|
||||
splashDamage = 320f;
|
||||
splashDamage = 240f;
|
||||
splashDamageRadius = 120f;
|
||||
}};
|
||||
}});
|
||||
|
||||
@@ -363,7 +363,7 @@ public class NetClient implements ApplicationListener{
|
||||
});
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.one)
|
||||
@Remote(variants = Variant.one, called = Loc.server)
|
||||
public static void setPosition(float x, float y){
|
||||
player.unit().set(x, y);
|
||||
player.set(x, y);
|
||||
|
||||
@@ -50,9 +50,19 @@ public class EditorTile extends Tile{
|
||||
return;
|
||||
}
|
||||
|
||||
op(OpType.block, block.id);
|
||||
if(rotation != 0) op(OpType.rotation, (byte)rotation);
|
||||
if(team != Team.derelict) op(OpType.team, (byte)team.id);
|
||||
if(!isCenter()){
|
||||
EditorTile cen = (EditorTile)build.tile;
|
||||
cen.op(OpType.rotation, (byte)build.rotation);
|
||||
cen.op(OpType.team, (byte)build.team.id);
|
||||
cen.op(OpType.block, block.id);
|
||||
update();
|
||||
}else{
|
||||
if(build != null) op(OpType.rotation, (byte)build.rotation);
|
||||
if(build != null) op(OpType.team, (byte)build.team.id);
|
||||
op(OpType.block, block.id);
|
||||
|
||||
}
|
||||
|
||||
super.setBlock(type, team, rotation);
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ public class MapEditor{
|
||||
|
||||
if(isFloor){
|
||||
tile.setFloor(drawBlock.asFloor());
|
||||
}else{
|
||||
}else if(!(tile.block().isMultiblock() && !drawBlock.isMultiblock())){
|
||||
if(drawBlock.rotate && tile.build != null && tile.build.rotation != rotation){
|
||||
addTileOp(TileOp.get(tile.x, tile.y, (byte)OpType.rotation.ordinal(), (byte)rotation));
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class MapEditor{
|
||||
boolean hasOverlap(int x, int y){
|
||||
Tile tile = world.tile(x, y);
|
||||
//allow direct replacement of blocks of the same size
|
||||
if(tile != null && tile.isCenter() && tile.block() != drawBlock && tile.block().size == drawBlock.size){
|
||||
if(tile != null && tile.isCenter() && tile.block() != drawBlock && tile.block().size == drawBlock.size && tile.x == x && tile.y == y){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -168,12 +168,10 @@ public class MapEditor{
|
||||
for(int dy = 0; dy < drawBlock.size; dy++){
|
||||
int worldx = dx + offsetx + x;
|
||||
int worldy = dy + offsety + y;
|
||||
if(!(worldx == x && worldy == y)){
|
||||
Tile other = world.tile(worldx, worldy);
|
||||
Tile other = world.tile(worldx, worldy);
|
||||
|
||||
if(other != null && other.block().isMultiblock()){
|
||||
return true;
|
||||
}
|
||||
if(other != null && other.block().isMultiblock()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class WaveGraph extends Table{
|
||||
for(int i = 0; i < values.length; i++){
|
||||
float sum = 0;
|
||||
for(UnitType type : used.orderedItems()){
|
||||
sum += type.health * values[i][type.id];
|
||||
sum += (type.health) * values[i][type.id];
|
||||
}
|
||||
|
||||
float cx = graphX + i*spacing, cy = 2f + graphY + sum * (graphH - 4f) / maxHealth;
|
||||
@@ -160,7 +160,7 @@ public class WaveGraph extends Table{
|
||||
used.add(spawn.type);
|
||||
}
|
||||
max = Math.max(max, values[index][spawn.type.id]);
|
||||
healthsum += spawned * spawn.type.health;
|
||||
healthsum += spawned * (spawn.type.health);
|
||||
sum += spawned;
|
||||
}
|
||||
maxTotal = Math.max(maxTotal, sum);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class WaveInfoDialog extends BaseDialog{
|
||||
}).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty());
|
||||
dialog.cont.row();
|
||||
dialog.cont.button("@settings.reset", () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
||||
groups = JsonIO.copy(defaultWaves.get());
|
||||
groups = JsonIO.copy(waves.get());
|
||||
buildGroups();
|
||||
dialog.hide();
|
||||
}));
|
||||
@@ -98,7 +98,7 @@ public class WaveInfoDialog extends BaseDialog{
|
||||
if(experimental){
|
||||
buttons.button("Random", Icon.refresh, () -> {
|
||||
groups.clear();
|
||||
groups = DefaultWaves.generate(1f / 10f);
|
||||
groups = Waves.generate(1f / 10f);
|
||||
updateWaves();
|
||||
}).width(200f);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class WaveInfoDialog extends BaseDialog{
|
||||
}
|
||||
|
||||
void setup(){
|
||||
groups = JsonIO.copy(state.rules.spawns.isEmpty() ? defaultWaves.get() : state.rules.spawns);
|
||||
groups = JsonIO.copy(state.rules.spawns.isEmpty() ? waves.get() : state.rules.spawns);
|
||||
|
||||
cont.clear();
|
||||
cont.stack(new Table(Tex.clear, main -> {
|
||||
|
||||
@@ -27,8 +27,8 @@ public class Effect{
|
||||
/** Clip size. */
|
||||
public float size;
|
||||
|
||||
public boolean ground;
|
||||
public float groundDuration;
|
||||
public float layer = Layer.effect;
|
||||
public float layerDuration;
|
||||
|
||||
public Effect(float life, float clipsize, Cons<EffectContainer> renderer){
|
||||
this.id = all.size;
|
||||
@@ -42,14 +42,14 @@ public class Effect{
|
||||
this(life,50f, renderer);
|
||||
}
|
||||
|
||||
public Effect ground(){
|
||||
ground = true;
|
||||
public Effect layer(float l){
|
||||
layer = l;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Effect ground(float duration){
|
||||
ground = true;
|
||||
this.groundDuration = duration;
|
||||
public Effect layer(float l, float duration){
|
||||
layer = l;
|
||||
this.layerDuration = duration;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class Effect{
|
||||
|
||||
public float render(int id, Color color, float life, float lifetime, float rotation, float x, float y, Object data){
|
||||
container.set(id, color, life, lifetime, rotation, x, y, data);
|
||||
Draw.z(ground ? Layer.debris : Layer.effect);
|
||||
Draw.z(layer);
|
||||
Draw.reset();
|
||||
renderer.get(container);
|
||||
Draw.reset();
|
||||
|
||||
@@ -79,8 +79,10 @@ public abstract class BulletType extends Content{
|
||||
public boolean backMove = true;
|
||||
/** Bullet range override. */
|
||||
public float range = -1f;
|
||||
/** Heal Bullet Percent **/
|
||||
/** % of block health healed **/
|
||||
public float healPercent = 0f;
|
||||
/** whether to make fire on impact */
|
||||
public boolean makeFire = false;
|
||||
|
||||
//additional effects
|
||||
|
||||
@@ -158,7 +160,7 @@ public abstract class BulletType extends Content{
|
||||
}
|
||||
|
||||
public void hitTile(Bullet b, Building tile, float initialHealth){
|
||||
if(status == StatusEffects.burning){
|
||||
if(makeFire){
|
||||
Fires.create(tile.tile);
|
||||
}
|
||||
hit(b);
|
||||
@@ -216,7 +218,7 @@ public abstract class BulletType extends Content{
|
||||
});
|
||||
}
|
||||
|
||||
if(status == StatusEffects.burning){
|
||||
if(makeFire){
|
||||
indexer.eachBlock(null, x, y, splashDamageRadius, other -> other.team != b.team, other -> {
|
||||
Fires.create(other.tile);
|
||||
});
|
||||
|
||||
@@ -22,9 +22,9 @@ abstract class ShieldComp implements Healthc, Posc{
|
||||
@Replace
|
||||
@Override
|
||||
public void damage(float amount){
|
||||
amount /= healthMultiplier;
|
||||
//apply armor
|
||||
amount = Math.max(amount - armor, minArmorDamage * amount);
|
||||
amount /= healthMultiplier;
|
||||
|
||||
hitTime = 1f;
|
||||
|
||||
|
||||
@@ -237,12 +237,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
|
||||
@Override
|
||||
public void add(){
|
||||
team.data().updateCount(type, 1);
|
||||
|
||||
//check if over unit cap
|
||||
if(count() > cap() && !spawnedByCore && !dead){
|
||||
Call.unitCapDeath(self());
|
||||
team.data().updateCount(type, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,6 +33,7 @@ import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.blocks.sandbox.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.zip.*;
|
||||
@@ -295,9 +296,11 @@ public class Schematics implements Loadable{
|
||||
/** Checks a schematic for deployment validity and adds it to the cache. */
|
||||
private void checkLoadout(Schematic s, boolean validate){
|
||||
Stile core = s.tiles.find(t -> t.block instanceof CoreBlock);
|
||||
int cores = s.tiles.count(t -> t.block instanceof CoreBlock);
|
||||
|
||||
//make sure a core exists, and that the schematic is small enough.
|
||||
if(core == null || (validate && (s.width > core.block.size + maxLoadoutSchematicPad *2 || s.height > core.block.size + maxLoadoutSchematicPad *2))) return;
|
||||
if(core == null || (validate && (s.width > core.block.size + maxLoadoutSchematicPad *2 || s.height > core.block.size + maxLoadoutSchematicPad *2
|
||||
|| s.tiles.contains(t -> t.block.buildVisibility == BuildVisibility.sandboxOnly || !t.block.unlocked()) || cores > 1))) return;
|
||||
|
||||
//place in the cache
|
||||
loadouts.get((CoreBlock)core.block, Seq::new).add(s);
|
||||
|
||||
@@ -57,6 +57,8 @@ public class SectorInfo{
|
||||
public float secondsPassed;
|
||||
/** Display name. */
|
||||
public @Nullable String name;
|
||||
/** Version of generated waves. When it doesn't match, new waves are generated. */
|
||||
public int waveVersion = -1;
|
||||
|
||||
/** Special variables for simulation. */
|
||||
public float sumHealth, sumRps, sumDps, waveHealthBase, waveHealthSlope, waveDpsBase, waveDpsSlope;
|
||||
@@ -118,12 +120,17 @@ public class SectorInfo{
|
||||
state.rules.winWave = winWave;
|
||||
state.rules.attackMode = attack;
|
||||
|
||||
//assign new wave patterns when the version changes
|
||||
if(waveVersion != Waves.waveVersion && state.rules.sector.preset == null){
|
||||
state.rules.spawns = Waves.generate(state.rules.sector.baseCoverage);
|
||||
}
|
||||
|
||||
CoreBuild entity = state.rules.defaultTeam.core();
|
||||
if(entity != null){
|
||||
entity.items.clear();
|
||||
entity.items.add(items);
|
||||
//ensure capacity.
|
||||
entity.items.each((i, a) -> entity.items.set(i, Math.min(a, entity.storageCapacity)));
|
||||
entity.items.each((i, a) -> entity.items.set(i, Mathf.clamp(a, 0, entity.storageCapacity)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +150,7 @@ public class SectorInfo{
|
||||
spawnPosition = entity.pos();
|
||||
}
|
||||
|
||||
waveVersion = Waves.waveVersion;
|
||||
waveSpacing = state.rules.waveSpacing;
|
||||
wave = state.wave;
|
||||
winWave = state.rules.winWave;
|
||||
@@ -200,8 +208,7 @@ public class SectorInfo{
|
||||
}
|
||||
|
||||
//get item delta
|
||||
//TODO is preventing negative production a good idea?
|
||||
int delta = Math.max(ent == null ? 0 : coreItemCounts[item.id], 0);
|
||||
int delta = coreItemCounts[item.id];
|
||||
|
||||
//store means
|
||||
stat.means.add(delta);
|
||||
|
||||
@@ -261,11 +261,12 @@ public class Teams{
|
||||
}
|
||||
|
||||
public void updateCount(UnitType type, int amount){
|
||||
if(type == null) return;
|
||||
unitCount = Math.max(amount + unitCount, 0);
|
||||
if(typeCounts == null || typeCounts.length <= type.id){
|
||||
typeCounts = new int[Vars.content.units().size];
|
||||
}
|
||||
typeCounts [type.id] = Math.max(amount + typeCounts [type.id], 0);
|
||||
typeCounts[type.id] = Math.max(amount + typeCounts[type.id], 0);
|
||||
}
|
||||
|
||||
public QuadTree<Unit> tree(){
|
||||
|
||||
@@ -9,7 +9,9 @@ import mindustry.type.*;
|
||||
|
||||
import static mindustry.content.UnitTypes.*;
|
||||
|
||||
public class DefaultWaves{
|
||||
public class Waves{
|
||||
public static final int waveVersion = 1;
|
||||
|
||||
private Seq<SpawnGroup> spawns;
|
||||
|
||||
public Seq<SpawnGroup> get(){
|
||||
@@ -337,7 +339,7 @@ public class DefaultWaves{
|
||||
step += (int)(rand.random(15, 30) * Mathf.lerp(1f, 0.5f, difficulty));
|
||||
}
|
||||
|
||||
int bossWave = (int)(rand.random(30, 60) * Mathf.lerp(1f, 0.7f, difficulty));
|
||||
int bossWave = (int)(rand.random(50, 70) * Mathf.lerp(1f, 0.6f, difficulty));
|
||||
int bossSpacing = (int)(rand.random(25, 40) * Mathf.lerp(1f, 0.6f, difficulty));
|
||||
|
||||
//main boss progression
|
||||
@@ -244,7 +244,7 @@ public class MenuRenderer implements Disposable{
|
||||
float size = Math.max(icon.width, icon.height) * Draw.scl * 1.6f;
|
||||
|
||||
flyers((x, y) -> {
|
||||
Draw.rect(flyerType.region, x - 12f, y - 13f, flyerRot - 90);
|
||||
Draw.rect(icon, x - 12f, y - 13f, flyerRot - 90);
|
||||
});
|
||||
|
||||
flyers((x, y) -> {
|
||||
@@ -264,7 +264,7 @@ public class MenuRenderer implements Disposable{
|
||||
(engineSize + Mathf.absin(Time.time(), 2f, engineSize / 4f)) / 2f);
|
||||
Draw.color();
|
||||
|
||||
Draw.rect(flyerType.region, x, y, flyerRot - 90);
|
||||
Draw.rect(icon, x, y, flyerRot - 90);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.io;
|
||||
|
||||
import arc.struct.*;
|
||||
import arc.struct.ObjectMap.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
@@ -60,9 +61,11 @@ public abstract class SaveFileReader{
|
||||
protected final DataOutputStream dataBytesSmall = new DataOutputStream(byteOutputSmall);
|
||||
|
||||
protected int lastRegionLength;
|
||||
protected @Nullable CounterInputStream currCounter;
|
||||
|
||||
protected void region(String name, DataInput stream, CounterInputStream counter, IORunner<DataInput> cons) throws IOException{
|
||||
counter.resetCount();
|
||||
this.currCounter = counter;
|
||||
int length;
|
||||
try{
|
||||
length = readChunk(stream, cons);
|
||||
@@ -70,8 +73,8 @@ public abstract class SaveFileReader{
|
||||
throw new IOException("Error reading region \"" + name + "\".", e);
|
||||
}
|
||||
|
||||
if(length != counter.count() - 4){
|
||||
throw new IOException("Error reading region \"" + name + "\": read length mismatch. Expected: " + length + "; Actual: " + (counter.count() - 4));
|
||||
if(length != counter.count - 4){
|
||||
throw new IOException("Error reading region \"" + name + "\": read length mismatch. Expected: " + length + "; Actual: " + (counter.count - 4));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
state.wavetime = map.getFloat("wavetime", state.rules.waveSpacing);
|
||||
state.stats = JsonIO.read(GameStats.class, map.get("stats", "{}"));
|
||||
state.rules = JsonIO.read(Rules.class, map.get("rules", "{}"));
|
||||
if(state.rules.spawns.isEmpty()) state.rules.spawns = defaultWaves.get();
|
||||
if(state.rules.spawns.isEmpty()) state.rules.spawns = waves.get();
|
||||
lastReadBuild = map.getInt("build", -1);
|
||||
|
||||
if(!headless){
|
||||
|
||||
@@ -101,7 +101,7 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
//this replacement is a MASSIVE hack but it fixes some incorrect overwriting of team-specific rules.
|
||||
//may need to be tweaked later
|
||||
Rules result = JsonIO.read(Rules.class, base, tags.get("rules", "{}").replace("teams:{2:{infiniteAmmo:true}},", ""));
|
||||
if(result.spawns.isEmpty()) result.spawns = Vars.defaultWaves.get();
|
||||
if(result.spawns.isEmpty()) result.spawns = Vars.waves.get();
|
||||
return result;
|
||||
}catch(Exception e){
|
||||
//error reading rules. ignore?
|
||||
|
||||
@@ -420,7 +420,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
state.rules.waves = sector.info.waves = true;
|
||||
|
||||
//TODO better waves
|
||||
state.rules.spawns = DefaultWaves.generate(difficulty);
|
||||
state.rules.spawns = Waves.generate(difficulty);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -295,7 +295,7 @@ public class ContentParser{
|
||||
group.type = unit;
|
||||
}
|
||||
|
||||
Vars.defaultWaves.get().addAll(groups);
|
||||
Vars.waves.get().addAll(groups);
|
||||
}
|
||||
|
||||
readFields(unit, value, true);
|
||||
|
||||
@@ -21,6 +21,12 @@ public class ItemSeq implements Iterable<ItemStack>, Serializable{
|
||||
stacks.each(this::add);
|
||||
}
|
||||
|
||||
public void checkNegative(){
|
||||
for(int i = 0; i < values.length; i++){
|
||||
if(values[i] < 0) values[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemSeq copy(){
|
||||
ItemSeq out = new ItemSeq();
|
||||
out.total = total;
|
||||
|
||||
@@ -170,6 +170,7 @@ public class Sector{
|
||||
}
|
||||
}else if(hasBase()){
|
||||
items.each((item, amount) -> info.items.add(item, Math.min(info.storageCapacity - info.items.get(item), amount)));
|
||||
info.items.checkNegative();
|
||||
saveInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,6 +217,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
//assign entity and type to blocks, so they act as proxies for this one
|
||||
other.build = entity;
|
||||
other.block = block;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ public class LiquidTurret extends Turret{
|
||||
public ObjectMap<Liquid, BulletType> ammoTypes = new ObjectMap<>();
|
||||
public @Load("@-liquid") TextureRegion liquidRegion;
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
public boolean extinguish = true;
|
||||
|
||||
public LiquidTurret(String name){
|
||||
super(name);
|
||||
@@ -86,7 +87,7 @@ public class LiquidTurret extends Turret{
|
||||
|
||||
@Override
|
||||
protected void findTarget(){
|
||||
if(liquids.current().canExtinguish()){
|
||||
if(extinguish && liquids.current().canExtinguish()){
|
||||
int tr = (int)(range / tilesize);
|
||||
for(int x = -tr; x <= tr; x++){
|
||||
for(int y = -tr; y <= tr; y++){
|
||||
@@ -144,7 +145,7 @@ public class LiquidTurret extends Turret{
|
||||
@Override
|
||||
public boolean acceptLiquid(Building source, Liquid liquid){
|
||||
return ammoTypes.get(liquid) != null
|
||||
&& (liquids.current() == liquid || (ammoTypes.containsKey(liquids.current())
|
||||
&& (liquids.current() == liquid || (ammoTypes.containsKey(liquid)
|
||||
&& liquids.get(liquids.current()) <= 1f / ammoTypes.get(liquids.current()).ammoMultiplier + 0.001f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.payloads.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -24,7 +25,7 @@ public class PayloadConveyor extends Block{
|
||||
|
||||
public PayloadConveyor(String name){
|
||||
super(name);
|
||||
|
||||
group = BlockGroup.transportation;
|
||||
size = 3;
|
||||
rotate = true;
|
||||
update = true;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MessageBlock extends Block{
|
||||
int count = 0;
|
||||
for(int i = 0; i < text.length(); i++){
|
||||
char c = text.charAt(i);
|
||||
if(c == '\n' || c == '\r'){
|
||||
if(c == '\n'){
|
||||
count ++;
|
||||
if(count <= maxNewlines){
|
||||
tile.message.append('\n');
|
||||
@@ -95,12 +95,12 @@ public class MessageBlock extends Block{
|
||||
}else{
|
||||
BaseDialog dialog = new BaseDialog("@editmessage");
|
||||
dialog.setFillParent(false);
|
||||
TextArea a = dialog.cont.add(new TextArea(message.toString().replace("\n", "\r"))).size(380f, 160f).get();
|
||||
TextArea a = dialog.cont.add(new TextArea(message.toString().replace("\r", "\n"))).size(380f, 160f).get();
|
||||
a.setFilter((textField, c) -> {
|
||||
if(c == '\n' || c == '\r'){
|
||||
if(c == '\n'){
|
||||
int count = 0;
|
||||
for(int i = 0; i < textField.getText().length(); i++){
|
||||
if(textField.getText().charAt(i) == '\n' || textField.getText().charAt(i) == '\r'){
|
||||
if(textField.getText().charAt(i) == '\n'){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,8 +280,8 @@ public class PowerNode extends PowerBlock{
|
||||
public void placed(){
|
||||
if(net.client()) return;
|
||||
|
||||
Boolf<Building> valid = other -> other != null && other != this && ((!other.block.outputsPower && other.block.consumesPower) ||
|
||||
(other.block.outputsPower && !other.block.consumesPower) || other.block instanceof PowerNode) && linkValid(this, other)
|
||||
Boolf<Building> valid = other -> other != null && other != this &&
|
||||
(other.block.outputsPower || other.block.consumesPower || other.block instanceof PowerNode) && linkValid(this, other)
|
||||
&& !other.proximity().contains(this) && other.power.graph != power.graph;
|
||||
|
||||
tempTileEnts.clear();
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ItemModule extends BlockModule{
|
||||
|
||||
public void each(ItemConsumer cons){
|
||||
for(int i = 0; i < items.length; i++){
|
||||
if(items[i] > 0){
|
||||
if(items[i] != 0){
|
||||
cons.accept(content.item(i), items[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user