diff --git a/core/assets-raw/sprites/units/weapons/conquer-weapon-heat.png b/core/assets-raw/sprites/units/weapons/conquer-weapon-heat.png new file mode 100644 index 0000000000..ee963032bc Binary files /dev/null and b/core/assets-raw/sprites/units/weapons/conquer-weapon-heat.png differ diff --git a/core/assets-raw/sprites/units/weapons/conquer-weapon-sides.png b/core/assets-raw/sprites/units/weapons/conquer-weapon-sides.png new file mode 100644 index 0000000000..81a6757cd9 Binary files /dev/null and b/core/assets-raw/sprites/units/weapons/conquer-weapon-sides.png differ diff --git a/core/assets-raw/sprites/units/weapons/conquer-weapon-sinks-heat.png b/core/assets-raw/sprites/units/weapons/conquer-weapon-sinks-heat.png index 55a717060d..4eeeb3a158 100644 Binary files a/core/assets-raw/sprites/units/weapons/conquer-weapon-sinks-heat.png and b/core/assets-raw/sprites/units/weapons/conquer-weapon-sinks-heat.png differ diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 4bf6235628..5152a89172 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -2526,7 +2526,9 @@ public class UnitTypes{ y = -2f; shadow = 50f; heatColor = Color.valueOf("f9350f"); - cooldownTime = 80f; + shootWarmupSpeed = 0.06f; + cooldownTime = 110f; + heatColor = Color.valueOf("f9350f"); parts.add( new RegionPart("-glow"){{ @@ -2534,10 +2536,33 @@ public class UnitTypes{ blending = Blending.additive; outline = mirror = false; }}, + new RegionPart("-sides"){{ + useReload = false; + mirror = true; + under = true; + moveX = 0.5f; + moveY = 0.5f; + rotMove = 82f; + x = 38 / 4f; + y = 9 / 4f; + }}, new RegionPart("-sinks"){{ useReload = false; mirror = true; under = true; + heatColor = new Color(1f, 0.1f, 0.1f); + moveX = 15f / 4f; + moveY = -13f / 4f; + x = 34 / 4f; + y = -36 / 4f; + }}, + new RegionPart("-sinks-heat"){{ + blending = Blending.additive; + useReload = false; + mirror = true; + outline = false; + colorTo = new Color(1f, 0f, 0f, 0.5f); + color = colorTo.cpy().a(0f); moveX = 15f / 4f; moveY = -13f / 4f; x = 34 / 4f; @@ -2545,20 +2570,20 @@ public class UnitTypes{ }} ); - bullet = new BasicBulletType(8f, 110){{ + bullet = new BasicBulletType(8.5f, 250){{ sprite = "missile-large"; - width = 9.5f; - height = 15f; + width = 12f; + height = 20f; lifetime = 30f; hitSize = 6f; shootEffect = Fx.shootTitan; smokeEffect = Fx.shootSmokeTitan; - pierceCap = 2; + pierceCap = 3; pierce = true; pierceBuilding = true; hitColor = backColor = trailColor = Color.valueOf("feb380"); frontColor = Color.white; - trailWidth = 3.1f; + trailWidth = 4f; trailLength = 8; hitEffect = despawnEffect = Fx.blastExplosion; }}; diff --git a/core/src/mindustry/entities/part/RegionPart.java b/core/src/mindustry/entities/part/RegionPart.java index f85179bf9b..29f88a965d 100644 --- a/core/src/mindustry/entities/part/RegionPart.java +++ b/core/src/mindustry/entities/part/RegionPart.java @@ -20,8 +20,6 @@ public class RegionPart extends WeaponPart{ public boolean mirror = false; /** If true, an outline is drawn under the part. */ public boolean outline = true; - /** If true, the layer is overridden to be under the weapon/turret itself. */ - public boolean under = false; /** If true, the base + outline regions are drawn. Set to false for heat-only regions. */ public boolean drawRegion = true; /** If true, progress is inverted. */ @@ -49,7 +47,8 @@ public class RegionPart extends WeaponPart{ public void draw(PartParams params){ float z = Draw.z(); if(layer > 0) Draw.z(layer); - if(under) Draw.z(z - 0.0001f); + //TODO 'under' should not be special cased like this... + if(under && turretShading) Draw.z(z - 0.0001f); float prevZ = Draw.z(); float progress = useReload ? 1f - params.reload : params.warmup; diff --git a/core/src/mindustry/entities/part/WeaponPart.java b/core/src/mindustry/entities/part/WeaponPart.java index b02c86158f..cbb3426f7f 100644 --- a/core/src/mindustry/entities/part/WeaponPart.java +++ b/core/src/mindustry/entities/part/WeaponPart.java @@ -8,6 +8,8 @@ public abstract class WeaponPart{ /** If true, turret shading is used. Don't touch this, it is set up in unit/block init()! */ public boolean turretShading; + /** If true, the layer is overridden to be under the weapon/turret itself. */ + public boolean under = false; public abstract void draw(PartParams params); public abstract void load(String name); diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 3889719f73..c368b3118e 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -613,7 +613,7 @@ public class UnitType extends UnlockableContent{ if(outlines){ //outlines only created when weapons are drawn under w/ merged outlines - makeOutline(packer, region, alwaysCreateOutline || weapons.contains(w -> !w.top)); + makeOutline(packer, region, alwaysCreateOutline || weapons.contains(w -> !w.top || w.parts.contains(p -> p.under))); for(Weapon weapon : weapons){ if(!weapon.name.isEmpty()){ @@ -981,7 +981,13 @@ public class UnitType extends UnlockableContent{ for(WeaponMount mount : unit.mounts){ if(!mount.weapon.top){ + //apply layer offset, roll it back at the end + float z = Draw.z(); + Draw.z(z + mount.weapon.layerOffset); + mount.weapon.drawOutline(unit, mount); + + Draw.z(z); } } diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index c0e74370fb..fbe7c00d66 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -25,7 +25,7 @@ import static mindustry.Vars.*; public class Weapon implements Cloneable{ /** temporary weapon sequence number */ static int sequenceNum = 0; - + /** displayed weapon region */ public String name; /** bullet shot */ @@ -129,7 +129,7 @@ public class Weapon implements Cloneable{ /** whether this weapon should fire when its owner dies */ public boolean shootOnDeath = false; /** extra animated parts */ - public Seq parts = new Seq<>(); + public Seq parts = new Seq<>(WeaponPart.class); public Weapon(String name){ this.name = name; @@ -158,10 +158,6 @@ public class Weapon implements Cloneable{ public void drawOutline(Unit unit, WeaponMount mount){ if(!outlineRegion.found()) return; - //apply layer offset, roll it back at the end - float z = Draw.z(); - Draw.z(z + layerOffset); - float rotation = unit.rotation - 90, weaponRotation = rotation + (rotate ? mount.rotation : 0), @@ -171,10 +167,8 @@ public class Weapon implements Cloneable{ Draw.xscl = -Mathf.sign(flipSprite); Draw.rect(outlineRegion, wx, wy, weaponRotation); Draw.xscl = 1f; - - Draw.z(z); } - + public void draw(Unit unit, WeaponMount mount){ if(!region.found()) return; @@ -198,6 +192,17 @@ public class Weapon implements Cloneable{ Draw.xscl = -Mathf.sign(flipSprite); + if(parts.size > 0){ + WeaponPart.params.set(mount.warmup, 1f - Mathf.clamp(mount.reload / reload), mount.heat, wx, wy, weaponRotation + 90); + + for(int i = 0; i < parts.size; i++){ + var part = parts.items[i]; + if(part.under){ + part.draw(WeaponPart.params); + } + } + } + Draw.rect(region, wx, wy, weaponRotation); if(heatRegion.found() && mount.heat > 0){ @@ -218,10 +223,11 @@ public class Weapon implements Cloneable{ Draw.z(Layer.turret); }*/ - var params = WeaponPart.params.set(mount.warmup, 1f - Mathf.clamp(mount.reload / reload), mount.heat, wx, wy, weaponRotation + 90); - - for(var part : parts){ - part.draw(params); + for(int i = 0; i < parts.size; i++){ + var part = parts.items[i]; + if(!part.under){ + part.draw(WeaponPart.params); + } } } @@ -361,8 +367,8 @@ public class Weapon implements Cloneable{ protected Vec2 getShootPos(Unit unit, WeaponMount mount, Vec2 out){ float weaponRot = unit.rotation - 90 + (rotate ? mount.rotation : 0); return out.set(unit.x, unit.y) - .add(Angles.trnsx(unit.rotation - 90, x, y), Angles.trnsy(unit.rotation - 90, x, y)) - .add(Angles.trnsx(weaponRot, this.shootX, this.shootY), Angles.trnsx(weaponRot, this.shootX, this.shootY)); + .add(Angles.trnsx(unit.rotation - 90, x, y), Angles.trnsy(unit.rotation - 90, x, y)) + .add(Angles.trnsx(weaponRot, this.shootX, this.shootY), Angles.trnsx(weaponRot, this.shootX, this.shootY)); } protected void shoot(Unit unit, WeaponMount mount, float shootX, float shootY, float aimX, float aimY, float mountX, float mountY, float rotation, int side){ @@ -430,9 +436,9 @@ public class Weapon implements Cloneable{ protected @Nullable Bullet bullet(Unit unit, float shootX, float shootY, float angle, float lifescl){ float - xr = Mathf.range(xRand), - x = shootX + Angles.trnsx(angle, 0, xr), - y = shootY + Angles.trnsy(angle, 0, xr); + xr = Mathf.range(xRand), + x = shootX + Angles.trnsx(angle, 0, xr), + y = shootY + Angles.trnsy(angle, 0, xr); if(unitSpawned == null){ return bullet.create(unit, unit.team, x, y, angle, (1f - velocityRnd) + Mathf.random(velocityRnd), lifescl); diff --git a/gradle.properties b/gradle.properties index 8d36b34f7b..4cc65959c2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,4 +24,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=680252597e +archash=476ab38cea diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index c974cdc12d..1e358fb140 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java @@ -515,7 +515,7 @@ public class Generators{ for(Weapon weapon : weapons){ if(outlined.add(weapon.name) && has(weapon.name)){ //only non-top weapons need separate outline sprites (this is mostly just mechs) - if(!weapon.top){ + if(!weapon.top || weapon.parts.contains(p -> p.under)){ save(outline.get(get(weapon.name)), weapon.name + "-outline"); }else{ //replace weapon with outlined version, no use keeping standard around