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

This commit is contained in:
Anuken
2021-09-13 20:52:41 -04:00
82 changed files with 1517 additions and 1114 deletions

View File

@@ -26,7 +26,7 @@ public class EnergyFieldAbility extends Ability{
public Sound shootSound = Sounds.spark;
public float statusDuration = 60f * 6f;
public float x, y;
public boolean hitBuildings = true;
public boolean targetGround = true, targetAir = true, hitBuildings = true, hitUnits = true;
public int maxTargets = 25;
public float healPercent = 2.5f;
@@ -99,13 +99,15 @@ public class EnergyFieldAbility extends Ability{
all.clear();
Units.nearby(null, rx, ry, range, other -> {
if(other != unit){
all.add(other);
}
});
if(hitUnits){
Units.nearby(null, rx, ry, range, other -> {
if(other != unit && (other.isFlying() ? targetAir : targetGround)){
all.add(other);
}
});
}
if(hitBuildings){
if(hitBuildings && targetGround){
Units.nearbyBuildings(rx, ry, range, b -> {
if(b.team != Team.derelict || state.rules.coreCapture){
all.add(b);

View File

@@ -346,13 +346,7 @@ public class BulletType extends Content implements Cloneable{
}
public void update(Bullet b){
if(!headless && trailLength > 0){
if(b.trail == null){
b.trail = new Trail(trailLength);
}
b.trail.length = trailLength;
b.trail.update(b.x, b.y, trailInterp.apply(b.fin()));
}
updateTrail(b);
if(homingPower > 0.0001f && b.time >= homingDelay){
Teamc target;
@@ -386,6 +380,16 @@ public class BulletType extends Content implements Cloneable{
}
}
}
public void updateTrail(Bullet b){
if(!headless && trailLength > 0){
if(b.trail == null){
b.trail = new Trail(trailLength);
}
b.trail.length = trailLength;
b.trail.update(b.x, b.y, trailInterp.apply(b.fin()));
}
}
@Override
public void init(){

View File

@@ -94,6 +94,10 @@ abstract class BuilderComp implements Posc, Statusc, Teamc, Rotc{
if(!within(tile, finalPlaceDst)) return;
if(!headless){
Vars.control.sound.loop(Sounds.build, tile, 0.51f);
}
if(!(tile.build instanceof ConstructBuild cb)){
if(!current.initialized && !current.breaking && Build.validPlace(current.block, team, current.x, current.y, current.rotation)){
boolean hasAll = infinite || current.isRotation(team) || !Structs.contains(current.block.requirements, i -> core != null && !core.items.has(i.item, Math.min(Mathf.round(i.amount * state.rules.buildCostMultiplier), 1)));

View File

@@ -1509,6 +1509,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
}
if(cons != null){
cons.update();
}
if(enabled || !block.noUpdateDisabled){
updateTile();
}
@@ -1521,10 +1525,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
liquids.update(updateFlow);
}
if(cons != null){
cons.update();
}
if(power != null){
power.graph.update();
}

View File

@@ -11,7 +11,6 @@ import arc.util.*;
import mindustry.ai.*;
import mindustry.ai.types.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.ctype.*;
import mindustry.entities.*;
@@ -486,12 +485,13 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
if(!spawnedByCore){
Damage.dynamicExplosion(x, y, flammability, explosiveness, power, bounds() / 2f, state.rules.damageExplosions, item().flammability > 1, team, type.deathExplosionEffect);
}else{
type.deathExplosionEffect.at(x, y, bounds() / 2f / 8f);
}
float shake = hitSize / 3f;
Effect.scorch(x, y, (int)(hitSize / 5));
Fx.explosion.at(this);
Effect.shake(shake, shake, this);
type.deathSound.at(this);
@@ -503,7 +503,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
//if this unit crash landed (was flying), damage stuff in a radius
if(type.flying && !spawnedByCore){
Damage.damage(team,x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true);
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true);
}
if(!headless){

View File

@@ -18,6 +18,7 @@ public class MultiEffect extends Effect{
@Override
public void init(){
for(Effect f : effects){
f.init();
clip = Math.max(clip, f.clip);
lifetime = Math.max(lifetime, f.lifetime);
}

View File

@@ -20,6 +20,8 @@ public class ParticleEffect extends Effect{
public float cone = 180f, length = 20f, baseLength = 0f;
/** Particle size/length/radius interpolation. */
public Interp interp = Interp.linear;
/** Particle size interpolation. Null to use interp. */
public @Nullable Interp sizeInterp = null;
public float offsetX, offsetY;
public float lightScl = 2f, lightOpacity = 0.6f;
public @Nullable Color lightColor;
@@ -44,6 +46,7 @@ public class ParticleEffect extends Effect{
@Override
public void init(){
clip = Math.max(clip, length + Math.max(sizeFrom, sizeTo));
if(sizeInterp == null) sizeInterp = interp;
}
@Override
@@ -52,15 +55,15 @@ public class ParticleEffect extends Effect{
float rawfin = e.fin();
float fin = e.fin(interp);
float rad = interp.apply(sizeFrom, sizeTo, rawfin) * 2;
float rad = sizeInterp.apply(sizeFrom, sizeTo, rawfin) * 2;
float ox = e.x + Angles.trnsx(e.rotation, offsetX, offsetY), oy = e.y + Angles.trnsy(e.rotation, offsetX, offsetY);
Draw.color(colorFrom, colorTo, fin);
Color lightColor = this.lightColor == null ? Draw.getColor() : this.lightColor;
if(line){
Lines.stroke(interp.apply(strokeFrom, strokeTo, rawfin));
float len = interp.apply(lenFrom, lenTo, rawfin);
Lines.stroke(sizeInterp.apply(strokeFrom, strokeTo, rawfin));
float len = sizeInterp.apply(lenFrom, lenTo, rawfin);
rand.setSeed(e.id);
for(int i = 0; i < particles; i++){