From 55e25cc509b989c269a64b2fa3de5cd811e8717b Mon Sep 17 00:00:00 2001 From: MEEP of Faith <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 24 Sep 2020 15:31:03 -0700 Subject: [PATCH 1/3] Make lightning have frag angle properties Adds `lightningCone`, which is the full angle of where the lightning direction can be, and `lightningAngle` which is the angle compared to the bullet that the center of the lightning cone is. --- core/src/mindustry/entities/bullet/BulletType.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 5cbb7fd3f1..d8d449f6ce 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -77,6 +77,7 @@ public abstract class BulletType extends Content{ //additional effects public float fragCone = 360f; + public float fragAngle = 0f; public int fragBullets = 9; public float fragVelocityMin = 0.2f, fragVelocityMax = 1f, fragLifeMin = 1f, fragLifeMax = 1f; public BulletType fragBullet = null; @@ -101,6 +102,8 @@ public abstract class BulletType extends Content{ public int lightningLength = 5, lightningLengthRand = 0; /** Use a negative value to use default bullet damage. */ public float lightningDamage = -1; + public float lightningCone = 360f; + public float lightningAngle = 0f; public float weaveScale = 1f; public float weaveMag = -1f; @@ -156,7 +159,7 @@ public abstract class BulletType extends Content{ if(fragBullet != null){ for(int i = 0; i < fragBullets; i++){ float len = Mathf.random(1f, 7f); - float a = b.rotation() + Mathf.range(fragCone/2); + float a = b.rotation() + Mathf.range(fragCone/2) + fragAngle; fragBullet.create(b, x + Angles.trnsx(a, len), y + Angles.trnsy(a, len), a, Mathf.random(fragVelocityMin, fragVelocityMax), Mathf.random(fragLifeMin, fragLifeMax)); } } @@ -181,7 +184,8 @@ public abstract class BulletType extends Content{ } for(int i = 0; i < lightning; i++){ - Lightning.create(b, lightningColor, lightningDamage < 0 ? damage : lightningDamage, b.x, b.y, Mathf.random(360f), lightningLength + Mathf.random(lightningLengthRand)); + float litA = b.rotation() + Mathf.range(lightningCone/2) + lightningAngle; + Lightning.create(b, lightningColor, lightningDamage < 0 ? damage : lightningDamage, b.x, b.y, litA, lightningLength + Mathf.random(lightningLengthRand)); } } From 9f2697941951dc86db83f497d0d5b988aeac5812 Mon Sep 17 00:00:00 2001 From: MEEP of Faith <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:34:02 -0700 Subject: [PATCH 2/3] why variable here --- core/src/mindustry/entities/bullet/BulletType.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index d8d449f6ce..b2d2f479ff 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -184,8 +184,7 @@ public abstract class BulletType extends Content{ } for(int i = 0; i < lightning; i++){ - float litA = b.rotation() + Mathf.range(lightningCone/2) + lightningAngle; - Lightning.create(b, lightningColor, lightningDamage < 0 ? damage : lightningDamage, b.x, b.y, litA, lightningLength + Mathf.random(lightningLengthRand)); + Lightning.create(b, lightningColor, lightningDamage < 0 ? damage : lightningDamage, b.x, b.y, b.rotation() + Mathf.range(lightningCone/2) + lightningAngle, lightningLength + Mathf.random(lightningLengthRand)); } } From 6492ffd35d171651b48735cbf97cfb7c2293c9c9 Mon Sep 17 00:00:00 2001 From: LeoDog896 Date: Fri, 25 Sep 2020 07:58:44 -0400 Subject: [PATCH 3/3] More sort and target options --- core/src/mindustry/logic/RadarSort.java | 4 +++- core/src/mindustry/logic/RadarTarget.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/RadarSort.java b/core/src/mindustry/logic/RadarSort.java index 4164563f6d..50e553b70f 100644 --- a/core/src/mindustry/logic/RadarSort.java +++ b/core/src/mindustry/logic/RadarSort.java @@ -6,6 +6,8 @@ import mindustry.gen.*; public enum RadarSort{ distance((pos, other) -> -pos.dst2(other)), health((pos, other) -> other.health()), + shield((pos, other) -> other.shield()), + armor((pos, other) -> other.armor()), maxHealth((pos, other) -> other.maxHealth()); public final RadarSortFunc func; @@ -17,6 +19,6 @@ public enum RadarSort{ } public interface RadarSortFunc{ - float get(Position pos, Healthc other); + float get(Position pos, Unit other); } } diff --git a/core/src/mindustry/logic/RadarTarget.java b/core/src/mindustry/logic/RadarTarget.java index f6499db8c8..ddd7a1f368 100644 --- a/core/src/mindustry/logic/RadarTarget.java +++ b/core/src/mindustry/logic/RadarTarget.java @@ -8,6 +8,7 @@ public enum RadarTarget{ enemy((team, other) -> team != other.team), ally((team, other) -> team == other.team), player((team, other) -> other.isPlayer()), + attacker((pos, other) -> other.canShoot()), flying((team, other) -> other.isFlying()), boss((team, other) -> other.isBoss()), ground((team, other) -> other.isGrounded());