Merge branch 'master' of https://github.com/Anuken/Mindustry into new-pathfinding

This commit is contained in:
Anuken
2023-11-19 18:32:14 -05:00
29 changed files with 244 additions and 189 deletions
@@ -28,6 +28,7 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
private int index;
public static int nextId(){
if(lastId >= Integer.MAX_VALUE - 2) lastId = 0;
return lastId++;
}
@@ -93,7 +93,8 @@ public class ShieldArcAbility extends Ability{
paramField = this;
paramPos.set(x, y).rotate(unit.rotation - 90f).add(unit);
Groups.bullet.intersect(unit.x - radius, unit.y - radius, radius * 2f, radius * 2f, shieldConsumer);
float reach = radius + width / 2f;
Groups.bullet.intersect(paramPos.x - reach, paramPos.y - reach, reach * 2f, reach * 2f, shieldConsumer);
}else{
widthScale = Mathf.lerpDelta(widthScale, 0f, 0.11f);
}
@@ -160,6 +160,8 @@ public class BulletType extends Content implements Cloneable{
/** Bullet type that is created when this bullet expires. */
public @Nullable BulletType fragBullet = null;
/** If true, frag bullets are delayed to the next frame. Fixes obscure bugs with piercing bullet types spawning frags immediately and screwing up the Damage temporary variables. */
public boolean delayFrags = false;
/** Degree spread range of fragmentation bullets. */
public float fragRandomSpread = 360f;
/** Uniform spread between each frag bullet in degrees. */
@@ -446,7 +448,11 @@ public class BulletType extends Content implements Cloneable{
Effect.shake(hitShake, hitShake, b);
if(fragOnHit){
createFrags(b, x, y);
if(delayFrags && fragBullet != null && fragBullet.delayFrags){
Core.app.post(() -> createFrags(b, x, y));
}else{
createFrags(b, x, y);
}
}
createPuddles(b, x, y);
createIncend(b, x, y);
@@ -11,6 +11,8 @@ public class ContinuousBulletType extends BulletType{
public float damageInterval = 5f;
public boolean largeHit = false;
public boolean continuous = true;
/** If a building fired this, whether to multiply damage by its timescale. */
public boolean timescaleDamage = false;
{
removeAfterPierce = false;
@@ -79,7 +81,12 @@ public class ContinuousBulletType extends BulletType{
}
public void applyDamage(Bullet b){
float damage = b.damage;
if(timescaleDamage && b.owner instanceof Building build){
b.damage *= build.timeScale();
}
Damage.collideLine(b, b.team, hitEffect, b.x, b.y, b.rotation(), currentLength(b), largeHit, laserAbsorb, pierceCap);
b.damage = damage;
}
public float currentLength(Bullet b){
@@ -38,6 +38,7 @@ public class LaserBulletType extends BulletType{
hittable = false;
absorbable = false;
removeAfterPierce = false;
delayFrags = true;
}
public LaserBulletType(){
@@ -24,6 +24,7 @@ public class RailBulletType extends BulletType{
collides = false;
keepVelocity = false;
lifetime = 1f;
delayFrags = true;
}
@Override
@@ -60,7 +61,7 @@ public class RailBulletType extends BulletType{
super.init(b);
b.fdata = length;
Damage.collideLine(b, b.team, b.type.hitEffect, b.x, b.y, b.rotation(), length, false, false);
Damage.collideLine(b, b.team, b.type.hitEffect, b.x, b.y, b.rotation(), length, false, false, pierceCap);
float resultLen = b.fdata;
Vec2 nor = Tmp.v1.trns(b.rotation(), 1f).nor();