From 7d6428fcf2126f643871b087aa669241d21c728b Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 5 Dec 2021 18:19:43 -0500 Subject: [PATCH] Titan recolor + complaining --- .../sprites/blocks/turrets/horde.png | Bin 0 -> 1262 bytes .../blocks/turrets/titan/titan-barrel.png | Bin 899 -> 918 bytes .../blocks/turrets/titan/titan-preview.png | Bin 1357 -> 1367 bytes .../blocks/turrets/titan/titan-side1.png | Bin 566 -> 566 bytes .../blocks/turrets/titan/titan-side2.png | Bin 600 -> 601 bytes .../sprites/blocks/turrets/titan/titan.png | Bin 629 -> 627 bytes core/assets/icons/icons.properties | 1 + core/assets/logicids.dat | Bin 3681 -> 3688 bytes core/src/mindustry/content/Blocks.java | 87 +++++++++++++---- core/src/mindustry/content/Fx.java | 12 +-- core/src/mindustry/type/Weapon.java | 6 +- .../blocks/defense/turrets/BaseTurret.java | 3 +- .../world/blocks/defense/turrets/Turret.java | 88 +++++++++++------- 13 files changed, 133 insertions(+), 64 deletions(-) create mode 100644 core/assets-raw/sprites/blocks/turrets/horde.png diff --git a/core/assets-raw/sprites/blocks/turrets/horde.png b/core/assets-raw/sprites/blocks/turrets/horde.png new file mode 100644 index 0000000000000000000000000000000000000000..b871ef644c5f74a846f107dc73d371c98ce0c383 GIT binary patch literal 1262 zcmeAS@N?(olHy`uVBq!ia0y~yU`POA4mJh`hDS5XEf^RW7>k44ofy`glX=O&z_P;A z#WAE}&fB?r{X`u_j;D9F>N`AQ_Bg2=ag#Ib7sHg0nvf$cEFL}`q6w)lnLSi5M1JI$ z_JcufAH&q^uU=HlooQSAtfu#j{=x@BWzYZB@3v0=mTcB?Fu_2AhfU4r8gIwVo7Qnl z?CR_5e6pT*_lBQ*dN(G1*Ux*}*LWF<9(qp@PHyC8ob`}7P9=p^M~r)_ypO=r|M>@< z{unK*K5*<=_GgAQsxvr02-qcP9&~9~{((`O^A(d#8-IjHfar$Z^^eSI9Clj;2~Xhu z|MJ$ZFyVg>Z{NNC}1dPWe!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V zV`gJJ%*Ekg?l8OJ^rz(wGhbDoEARfkQfcY#bJ3S=FZ(DmG9W+#_h*~?ubw|Wm{m6S z^1sc`wl3f6Kf}E2|i*JdTcJLj~?VsC&7?D%A@eLGoY|$Wd=j$O^(px(|s7X z{WaL;(sJst_odqFjmt7G+2rp#>MMBeTKsmqo~E692OIbFxEaA7*2mK(K&Q!UTaNR`(5K0kLSlvuU45` zA)?Ew?>JRy$+78&zBh0QPI~Okns?|V$IFjPnHZP&v~WFUW@uP2Kbqx$Ps;t)d{E?i My85}Sb4q9e03GA|9{>OV diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index a52d7d830c..8dade2a87d 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -474,3 +474,4 @@ 63232=wall-ore-tungsten|block-wall-ore-tungsten-ui 63231=regen-projector|block-regen-projector-ui 63230=titan|block-titan-ui +63229=horde|block-horde-ui diff --git a/core/assets/logicids.dat b/core/assets/logicids.dat index d315bbe10349a4f00fcb29533ae74744dcdcf0fa..fae5966c56f0ddf052e86157c080338cb9719069 100644 GIT binary patch delta 23 fcmaDT^FoG+;nYT^+uUrd8TmyishjU`w=w|$YH Math.max(Mathf.slope(v), 0.8f); shrinkX = 0.2f; shrinkY = 0.1f; @@ -2992,27 +3043,23 @@ public class Blocks{ acceptCoolant = false; draw = new DrawTurret("reinforced-"){{ - Color heatc = Color.valueOf("f03b0e"); - Interp in = Interp.pow2In; - parts.addAll( new RegionPart("-barrel"){{ moveY = -5f; - heatColor = heatc; + heatColor = Color.valueOf("f03b0e"); mirror = false; - interp = in; + interp = Interp.pow2In; }}, new RegionPart("-side"){{ + moveX = 2f; moveY = -1f; rotMove = -40f; - moveX = 2f; useReload = false; under = true; - heatColor = Pal.berylShot.cpy().mul(1.1f); + heatColor = Color.valueOf("768a9a"); useProgressHeat = true; interp = Interp.pow2Out; - }} - ); + }}); }}; restitution = 0.02f; diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 6c28dc1ff9..e9dbada86d 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -340,7 +340,7 @@ public class Fx{ }), titanExplosion = new Effect(30f, 160f, e -> { - color(Pal.berylShot); + color(e.color); stroke(e.fout() * 3f); float circleRad = 6f + e.finpow() * 60f; Lines.circle(e.x, e.y, circleRad); @@ -356,7 +356,7 @@ public class Fx{ titanSmoke = new Effect(300f, 300f, b -> { float intensity = 3f; - color(Pal.berylShot, 0.7f); + color(b.color, 0.7f); for(int i = 0; i < 4; i++){ rand.setSeed(b.id*2 + i); float lenScl = rand.random(0.5f, 1f); @@ -1372,7 +1372,7 @@ public class Fx{ }), shootTitan = new Effect(10, e -> { - color(Pal.lightOrange, Pal.berylShot, e.fin()); + color(Pal.lightOrange, e.color, e.fin()); float w = 1.3f + 10 * e.fout(); Drawf.tri(e.x, e.y, w, 35f * e.fout(), e.rotation); Drawf.tri(e.x, e.y, w, 6f * e.fout(), e.rotation + 180f); @@ -1399,7 +1399,7 @@ public class Fx{ for(int i = 0; i < 13; i++){ v.trns(e.rotation + rand.range(30f), rand.random(e.finpow() * 40f)); e.scaled(e.lifetime * rand.random(0.3f, 1f), b -> { - color(Pal.berylShot, Pal.lightishGray, b.fin()); + color(e.color, Pal.lightishGray, b.fin()); Fill.circle(e.x + v.x, e.y + v.y, b.fout() * 3.4f + 0.3f); }); } @@ -1441,8 +1441,8 @@ public class Fx{ } }), - berylSpark = new Effect(21f, e -> { - color(Color.white, Pal.berylShot, e.fin()); + colorSpark = new Effect(21f, e -> { + color(Color.white, e.color, e.fin()); stroke(e.fout() * 1.1f + 0.5f); randLenVectors(e.id, 5, 27f * e.fin(), e.rotation, 9f, (x, y) -> { diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 31a56f0623..b40cd4aa09 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -350,6 +350,8 @@ public class Weapon implements Cloneable{ BulletType ammo = bullet; float lifeScl = ammo.scaleVelocity ? Mathf.clamp(Mathf.dst(shootX, shootY, aimX, aimY) / ammo.range()) : 1f; + //TODO far too complicated and similar to Turret + sequenceNum = 0; if(delay){ Angles.shotgun(shots, spacing, rotation, f -> { @@ -396,8 +398,8 @@ public class Weapon implements Cloneable{ } ejectEffect.at(mountX, mountY, rotation * side); - ammo.shootEffect.at(shootX, shootY, rotation, parentize ? unit : null); - ammo.smokeEffect.at(shootX, shootY, rotation, parentize ? unit : null); + ammo.shootEffect.at(shootX, shootY, rotation, ammo.hitColor, parentize ? unit : null); + ammo.smokeEffect.at(shootX, shootY, rotation, ammo.hitColor, parentize ? unit : null); unit.apply(shootStatus, shootStatusDuration); } diff --git a/core/src/mindustry/world/blocks/defense/turrets/BaseTurret.java b/core/src/mindustry/world/blocks/defense/turrets/BaseTurret.java index ea04cf0b88..f8013c677f 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/BaseTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/BaseTurret.java @@ -16,6 +16,7 @@ public class BaseTurret extends Block{ public float range = 80f; public float rotateSpeed = 5; + public float coolantUsage = 0.2f; public boolean acceptCoolant = true; /** Effect displayed when coolant is used. */ public Effect coolEffect = Fx.fuelburn; @@ -38,7 +39,7 @@ public class BaseTurret extends Block{ public void init(){ if(acceptCoolant && !consumes.has(ConsumeType.liquid)){ hasLiquids = true; - consumes.add(new ConsumeCoolant(0.2f)).update(false).boost(); + consumes.add(new ConsumeCoolant(coolantUsage)).update(false).boost(); } super.init(); diff --git a/core/src/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/mindustry/world/blocks/defense/turrets/Turret.java index 3aca805667..fb47b45758 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/Turret.java @@ -23,7 +23,6 @@ import mindustry.graphics.*; import mindustry.logic.*; import mindustry.type.*; import mindustry.world.blocks.*; -import mindustry.world.consumers.*; import mindustry.world.draw.*; import mindustry.world.meta.*; @@ -42,54 +41,74 @@ public class Turret extends ReloadTurret{ public Effect ammoUseEffect = Fx.none; public Sound shootSound = Sounds.shoot; - //general info - public int maxAmmo = 30; - public int ammoPerShot = 1; + public Effect chargeEffect = Fx.none; + public Effect chargeBeginEffect = Fx.none; + public Sound chargeSound = Sounds.none; + + //visuals public float ammoEjectBack = 1f; - public float inaccuracy = 0f; - public float velocityInaccuracy = 0f; public float shootWarmupSpeed = 0.1f; - public int shots = 1; - public float spread = 4f; public float recoilAmount = 1f; public float restitution = 0.02f; public float cooldown = 0.02f; - public float coolantUsage = 0.2f; - public float shootCone = 8f; + public float elevation = -1f; public float shootShake = 0f; + + public int maxAmmo = 30; + public int ammoPerShot = 1; + + //TODO all the fields below should be deprecated and moved into a ShootPattern class or similar + //TODO ...however, it would be nice to unify the weapon and turret systems into one. + + // below + /** Bullet angle randomness in degrees. */ + public float inaccuracy = 0f; + /** Fraction of bullet velocity that is random. */ + public float velocityInaccuracy = 0f; + /** Number of bullets fired per volley. */ + public int shots = 1; + /** + * Spread between bullets in degrees. + * For some dumb reason, this is also used for the "alternation width", and it's too late to change anything. + * */ + public float spread = 4f; + /** Maximum angle difference in degrees at which turret will still try to shoot. */ + public float shootCone = 8f; + /** Length of turret shoot point. */ public float shootLength = -1; + /** Random spread of projectile across width. This looks stupid. */ public float xRand = 0f; /** Currently used for artillery only. */ public float minRange = 0f; + /** Ticks between shots if shots > 1. */ public float burstSpacing = 0; + /** An inflexible and terrible idea. */ public boolean alternate = false; /** If true, this turret will accurately target moving targets with respect to charge time. */ public boolean accurateDelay = false; - public boolean targetAir = true; - public boolean targetGround = true; - public boolean targetHealing = false; - public boolean playerControllable = true; - public boolean displayAmmoMultiplier = true; //charging public float chargeTime = -1f; public int chargeEffects = 5; public float chargeMaxDelay = 10f; - public Effect chargeEffect = Fx.none; - public Effect chargeBeginEffect = Fx.none; - public Sound chargeSound = Sounds.none; + //see above + + public boolean targetAir = true; + public boolean targetGround = true; + public boolean targetHealing = false; + public boolean playerControllable = true; + public boolean displayAmmoMultiplier = true; public Sortf unitSort = UnitSorts.closest; - /** @deprecated loaded in {@link #draw} instead, unused */ - public @Deprecated @Load(value = "@-base", fallback = "block-@size") TextureRegion baseRegion; - /** @deprecated loaded in {@link #draw} instead, unused */ - public @Deprecated @Load("@-heat") TextureRegion heatRegion; - - public float elevation = -1f; - public DrawBlock draw = new DrawTurret(); + /** @deprecated loaded in {@link #draw} instead, unused */ + @Deprecated + public @Load(value = "@-base", fallback = "block-@size") TextureRegion baseRegion; + /** @deprecated loaded in {@link #draw} instead, unused */ + @Deprecated + public @Load("@-heat") TextureRegion heatRegion; /** @deprecated use bulletOffset; this will always be zero. **/ @Deprecated protected Vec2 tr = new Vec2(); @@ -128,11 +147,6 @@ public class Turret extends ReloadTurret{ @Override public void init(){ - if(acceptCoolant && !consumes.has(ConsumeType.liquid)){ - hasLiquids = true; - consumes.add(new ConsumeCoolant(coolantUsage)).update(false).boost(); - } - if(shootLength < 0) shootLength = size * tilesize / 2f; if(elevation < 0) elevation = size / 2f; @@ -436,6 +450,7 @@ public class Turret extends ReloadTurret{ } protected void shoot(BulletType type){ + //TODO absolute disaster here, combining shot patterns fails in unpredictable ways and I don't want to touch anything in case it breaks mods //when charging is enabled, use the charge shoot pattern if(chargeTime > 0){ @@ -470,6 +485,7 @@ public class Turret extends ReloadTurret{ int ii = i; Time.run(burstSpacing * i, () -> { if(dead || !hasAmmo()) return; + bulletOffset.trns(rotation, shootLength, Mathf.range(xRand)); bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (ii - (int)(shots / 2f)) * spread); effects(); @@ -485,7 +501,7 @@ public class Turret extends ReloadTurret{ if(alternate){ float i = (shotCounter % shots) - (shots-1)/2f; - bulletOffset.trns(rotation - 90, spread * i + Mathf.range(xRand), shootLength); + bulletOffset.trns(rotation - 90, (spread) * i + Mathf.range(xRand), shootLength); bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy)); }else{ bulletOffset.trns(rotation, shootLength, Mathf.range(xRand)); @@ -511,11 +527,13 @@ public class Turret extends ReloadTurret{ } protected void effects(){ - Effect fshootEffect = shootEffect == Fx.none ? peekAmmo().shootEffect : shootEffect; - Effect fsmokeEffect = smokeEffect == Fx.none ? peekAmmo().smokeEffect : smokeEffect; + var bullet = peekAmmo(); + //TODO "shoot" and "smoke" should just be MultiEffects there's no reason to have them separate + Effect fshootEffect = shootEffect == Fx.none ? bullet.shootEffect : shootEffect; + Effect fsmokeEffect = smokeEffect == Fx.none ? bullet.smokeEffect : smokeEffect; - fshootEffect.at(x + bulletOffset.x, y + bulletOffset.y, rotation); - fsmokeEffect.at(x + bulletOffset.x, y + bulletOffset.y, rotation); + fshootEffect.at(x + bulletOffset.x, y + bulletOffset.y, rotation, bullet.hitColor); + fsmokeEffect.at(x + bulletOffset.x, y + bulletOffset.y, rotation, bullet.hitColor); shootSound.at(x + bulletOffset.x, y + bulletOffset.y, Mathf.random(0.9f, 1.1f)); if(shootShake > 0){