diff --git a/core/src/mindustry/entities/abilities/StatusFieldAbility.java b/core/src/mindustry/entities/abilities/StatusFieldAbility.java index 73a9a614cb..ba90b7ae11 100644 --- a/core/src/mindustry/entities/abilities/StatusFieldAbility.java +++ b/core/src/mindustry/entities/abilities/StatusFieldAbility.java @@ -14,7 +14,7 @@ public class StatusFieldAbility extends Ability{ public Effect applyEffect = Fx.none; public Effect activeEffect = Fx.overdriveWave; public float effectX, effectY; - public boolean parentizeEffects; + public boolean parentizeEffects, effectSizeParam = true; protected float timer; @@ -43,7 +43,7 @@ public class StatusFieldAbility extends Ability{ }); float x = unit.x + Angles.trnsx(unit.rotation, effectY, effectX), y = unit.y + Angles.trnsy(unit.rotation, effectY, effectX); - activeEffect.at(x, y, unit.rotation, parentizeEffects ? unit : null); + activeEffect.at(x, y, effectSizeParam ? range : unit.rotation, parentizeEffects ? unit : null); timer = 0f; } diff --git a/core/src/mindustry/entities/bullet/ArtilleryBulletType.java b/core/src/mindustry/entities/bullet/ArtilleryBulletType.java index 08749c1803..43a1b49466 100644 --- a/core/src/mindustry/entities/bullet/ArtilleryBulletType.java +++ b/core/src/mindustry/entities/bullet/ArtilleryBulletType.java @@ -1,10 +1,9 @@ package mindustry.entities.bullet; -import arc.graphics.g2d.*; +import arc.math.*; import mindustry.content.*; import mindustry.gen.*; -//TODO scale velocity depending on fslope() public class ArtilleryBulletType extends BasicBulletType{ public float trailMult = 1f, trailSize = 4f; @@ -23,6 +22,7 @@ public class ArtilleryBulletType extends BasicBulletType{ //default settings: shrinkX = 0.15f; shrinkY = 0.63f; + shrinkInterp = Interp.slope; //for trail: @@ -55,16 +55,4 @@ public class ArtilleryBulletType extends BasicBulletType{ trailEffect.at(b.x, b.y, b.fslope() * trailSize, backColor); } } - - @Override - public void draw(Bullet b){ - drawTrail(b); - float xscale = (1f - shrinkX + b.fslope() * (shrinkX)), yscale = (1f - shrinkY + b.fslope() * (shrinkY)), rot = b.rotation(); - - Draw.color(backColor); - Draw.rect(backRegion, b.x, b.y, width * xscale, height * yscale, rot - 90); - Draw.color(frontColor); - Draw.rect(frontRegion, b.x, b.y, width * xscale, height * yscale, rot - 90); - Draw.color(); - } } diff --git a/core/src/mindustry/entities/bullet/BasicBulletType.java b/core/src/mindustry/entities/bullet/BasicBulletType.java index b053f6960a..102b8ecb1d 100644 --- a/core/src/mindustry/entities/bullet/BasicBulletType.java +++ b/core/src/mindustry/entities/bullet/BasicBulletType.java @@ -8,12 +8,13 @@ import arc.util.*; import mindustry.gen.*; import mindustry.graphics.*; -/** An extended BulletType for most ammo-based bullets shot from turrets and units. */ +/** An extended BulletType for most ammo-based bullets shot from turrets and units. Draws 1-2 sprites that can spin or shrink. */ public class BasicBulletType extends BulletType{ public Color backColor = Pal.bulletYellowBack, frontColor = Pal.bulletYellow; public Color mixColorFrom = new Color(1f, 1f, 1f, 0f), mixColorTo = new Color(1f, 1f, 1f, 0f); public float width = 5f, height = 7f; public float shrinkX = 0f, shrinkY = 0.5f; + public Interp shrinkInterp = Interp.linear; public float spin = 0, rotationOffset = 0f; public String sprite; public @Nullable String backSprite; @@ -44,8 +45,9 @@ public class BasicBulletType extends BulletType{ @Override public void draw(Bullet b){ super.draw(b); - float height = this.height * ((1f - shrinkY) + shrinkY * b.fout()); - float width = this.width * ((1f - shrinkX) + shrinkX * b.fout()); + float shrink = shrinkInterp.apply(b.fout()); + float height = this.height * ((1f - shrinkY) + shrinkY * shrink); + float width = this.width * ((1f - shrinkX) + shrinkX * shrink); float offset = -90 + (spin != 0 ? Mathf.randomSeed(b.id, 360f) + b.time * spin : 0f) + rotationOffset; Color mix = Tmp.c1.set(mixColorFrom).lerp(mixColorTo, b.fin()); diff --git a/core/src/mindustry/entities/bullet/BombBulletType.java b/core/src/mindustry/entities/bullet/BombBulletType.java index acd18a8064..ad9e09fc70 100644 --- a/core/src/mindustry/entities/bullet/BombBulletType.java +++ b/core/src/mindustry/entities/bullet/BombBulletType.java @@ -2,6 +2,7 @@ package mindustry.entities.bullet; import mindustry.gen.*; +/** Template class for an unmoving shrinking bullet. */ public class BombBulletType extends BasicBulletType{ public BombBulletType(float damage, float radius, String sprite){ diff --git a/core/src/mindustry/entities/bullet/ExplosionBulletType.java b/core/src/mindustry/entities/bullet/ExplosionBulletType.java index 0ad13fdb88..f6f42a36a4 100644 --- a/core/src/mindustry/entities/bullet/ExplosionBulletType.java +++ b/core/src/mindustry/entities/bullet/ExplosionBulletType.java @@ -2,6 +2,7 @@ package mindustry.entities.bullet; import mindustry.content.*; +/** Template class for a non-drawing bullet type that makes an explosion and disappears instantly. */ public class ExplosionBulletType extends BulletType{ public ExplosionBulletType(float splashDamage, float splashDamageRadius){ diff --git a/core/src/mindustry/entities/bullet/FlakBulletType.java b/core/src/mindustry/entities/bullet/FlakBulletType.java index a1ae9c2ee8..210efb5dea 100644 --- a/core/src/mindustry/entities/bullet/FlakBulletType.java +++ b/core/src/mindustry/entities/bullet/FlakBulletType.java @@ -25,10 +25,9 @@ public class FlakBulletType extends BasicBulletType{ @Override public void update(Bullet b){ super.update(b); - //don't check for targets if primed to explode - if(b.fdata < 0f) return; - if(b.timer(2, 6)){ + //don't check for targets if primed to explode + if(b.fdata >= 0 && b.timer(2, 6)){ Units.nearbyEnemies(b.team, Tmp.r1.setSize(explodeRange * 2f).setCenter(b.x, b.y), unit -> { //fadata < 0 means it's primed to explode if(b.fdata < 0f || !unit.checkTarget(collidesAir, collidesGround)) return; diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index acb1d8b5a5..20f98a0121 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -65,6 +65,9 @@ public class ContentParser{ if(data.isString()){ return field(Fx.class, data); } + if(data.isArray()){ + return new MultiEffect(parser.readValue(Effect[].class, data)); + } Class bc = resolve(data.getString("type", ""), ParticleEffect.class); data.remove("type"); Effect result = make(bc); diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 4b1b080bb7..e5687fcdde 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -323,7 +323,7 @@ public class UnitType extends UnlockableContent{ legMoveSpace = 1f, /** for legs without "joints", this is how much the second leg sprite is moved "back" by, so it covers the joint region (it's hard to explain without an image) */ legExtension = 0, - /** ??? I don't really know what this does or why it's here */ + /** Higher values of this field make groups of legs move less in-sync with each other. */ legPairOffset = 0, /** scaling for how far away legs *try* to be from the body (not their actual length); e.g. if set to 0.5, legs will appear somewhat folded */ legLengthScl = 1f,