diff --git a/core/src/mindustry/content/Bullets.java b/core/src/mindustry/content/Bullets.java index ff8e820cbb..333af3f681 100644 --- a/core/src/mindustry/content/Bullets.java +++ b/core/src/mindustry/content/Bullets.java @@ -476,60 +476,15 @@ public class Bullets implements ContentList{ drawSize = 400f; }}; - meltdownLaser = new BulletType(0.001f, 70){ - Color tmpColor = new Color(); - Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.white}; - float[] tscales = {1f, 0.7f, 0.5f, 0.2f}; - float[] strokes = {2f, 1.5f, 1f, 0.3f}; - float[] lenscales = {1f, 1.12f, 1.15f, 1.17f}; - float length = 220f; + meltdownLaser = new ContinuousLaserBulletType(70){{ + length = 220f; + hitEffect = Fx.hitMeltdown; + drawSize = 420f; - { - hitEffect = Fx.hitMeltdown; - despawnEffect = Fx.none; - hitSize = 4; - drawSize = 420f; - lifetime = 16f; - pierce = true; - hittable = false; - } - - @Override - public void update(Bulletc b){ - if(b.timer(1, 5f)){ - Damage.collideLine(b, b.team(), hitEffect, b.x(), b.y(), b.rotation(), length, true); - } - Effects.shake(1f, 1f, b.x(), b.y()); - } - - @Override - public void hit(Bulletc b, float hitx, float hity){ - hitEffect.at(hitx, hity, colors[2]); - if(Mathf.chance(0.4)){ - Fires.create(world.tileWorld(hitx + Mathf.range(5f), hity + Mathf.range(5f))); - } - } - - @Override - public void draw(Bulletc b){ - float baseLen = (length) * b.fout(); - - Lines.lineAngle(b.x(), b.y(), b.rotation(), baseLen); - for(int s = 0; s < colors.length; s++){ - Draw.color(tmpColor.set(colors[s]).mul(1f + Mathf.absin(Time.time(), 1f, 0.1f))); - for(int i = 0; i < tscales.length; i++){ - Tmp.v1.trns(b.rotation() + 180f, (lenscales[i] - 1f) * 35f); - Lines.stroke((9f + Mathf.absin(Time.time(), 0.8f, 1.5f)) * b.fout() * strokes[s] * tscales[i]); - Lines.lineAngle(b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, b.rotation(), baseLen * lenscales[i], CapStyle.none); - } - } - - Tmp.v1.trns(b.rotation(), baseLen * 1.1f); - - Drawf.light(b.x(), b.y(), b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, 40, Color.orange, 0.7f); - Draw.reset(); - } - }; + incendChance = 0.4f; + incendSpread = 5f; + incendAmount = 1; + }}; waterShot = new LiquidBulletType(Liquids.water){{ knockback = 0.7f; diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 6b53d64e3a..9feb508eca 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -1,6 +1,7 @@ package mindustry.entities.bullet; import arc.audio.*; +import arc.graphics.*; import arc.math.*; import arc.util.ArcAnnotate.*; import arc.util.*; @@ -74,6 +75,7 @@ public abstract class BulletType extends Content{ public int fragBullets = 9; public float fragVelocityMin = 0.2f, fragVelocityMax = 1f; public BulletType fragBullet = null; + public Color hitColor = Color.white; /** Use a negative value to disable splash damage. */ public float splashDamageRadius = -1f; @@ -119,7 +121,7 @@ public abstract class BulletType extends Content{ } public void hit(Bulletc b, float x, float y){ - hitEffect.at(x, y, b.rotation()); + hitEffect.at(x, y, b.rotation(), hitColor); hitSound.at(b); Effects.shake(hitShake, hitShake, b); diff --git a/core/src/mindustry/entities/bullet/ContinuousLaserBulletType.java b/core/src/mindustry/entities/bullet/ContinuousLaserBulletType.java new file mode 100644 index 0000000000..5332453b78 --- /dev/null +++ b/core/src/mindustry/entities/bullet/ContinuousLaserBulletType.java @@ -0,0 +1,85 @@ +package mindustry.entities.bullet; + +import arc.graphics.*; +import arc.graphics.g2d.*; +import arc.math.*; +import arc.util.*; +import mindustry.content.*; +import mindustry.entities.*; +import mindustry.gen.*; +import mindustry.graphics.*; + +public class ContinuousLaserBulletType extends BulletType{ + public float length = 220f; + public float shake = 1f; + public Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.white}; + public float[] tscales = {1f, 0.7f, 0.5f, 0.2f}; + public float[] strokes = {2f, 1.5f, 1f, 0.3f}; + public float[] lenscales = {1f, 1.12f, 1.15f, 1.17f}; + + public ContinuousLaserBulletType(float damage){ + super(0.001f, damage); + + hitEffect = Fx.hitMeltdown; + despawnEffect = Fx.none; + hitSize = 4; + drawSize = 420f; + lifetime = 16f; + pierce = true; + hittable = false; + hitColor = colors[2]; + } + + protected ContinuousLaserBulletType(){ + this(0); + } + + @Override + public float range(){ + return length; + } + + @Override + public void update(Bulletc b){ + //TODO possible laser absorption from blocks + + //damage every 5 ticks + if(b.timer(1, 5f)){ + Damage.collideLine(b, b.team(), hitEffect, b.x(), b.y(), b.rotation(), length, true); + } + + if(shake > 0){ + Effects.shake(shake, shake, b); + } + } + + /* + @Override + public void hit(Bulletc b, float hitx, float hity){ + hitEffect.at(hitx, hity, colors[2]); + if(Mathf.chance(0.4)){ + Fires.create(world.tileWorld(hitx + Mathf.range(5f), hity + Mathf.range(5f))); + } + }*/ + + @Override + public void draw(Bulletc b){ + float baseLen = length * b.fout(); + + Lines.lineAngle(b.x(), b.y(), b.rotation(), baseLen); + for(int s = 0; s < colors.length; s++){ + Draw.color(Tmp.c1.set(colors[s]).mul(1f + Mathf.absin(Time.time(), 1f, 0.1f))); + for(int i = 0; i < tscales.length; i++){ + Tmp.v1.trns(b.rotation() + 180f, (lenscales[i] - 1f) * 35f); + Lines.stroke((9f + Mathf.absin(Time.time(), 0.8f, 1.5f)) * b.fout() * strokes[s] * tscales[i]); + Lines.lineAngle(b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, b.rotation(), baseLen * lenscales[i], CapStyle.none); + } + } + + Tmp.v1.trns(b.rotation(), baseLen * 1.1f); + + Drawf.light(b.x(), b.y(), b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, 40, Color.orange, 0.7f); + Draw.reset(); + } + +} diff --git a/core/src/mindustry/world/blocks/defense/turrets/LaserTurret.java b/core/src/mindustry/world/blocks/defense/turrets/LaserTurret.java index 3abe53bcf3..9cb5992bdb 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/LaserTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/LaserTurret.java @@ -44,6 +44,11 @@ public class LaserTurret extends PowerTurret{ Bulletc bullet; float bulletLife; + @Override + protected void updateCooling(){ + //do nothing, cooling is irrelevant here + } + @Override public void updateTile(){ super.updateTile(); diff --git a/core/src/mindustry/world/blocks/distribution/PayloadConveyor.java b/core/src/mindustry/world/blocks/distribution/PayloadConveyor.java index cc91fda1d1..a090f0e286 100644 --- a/core/src/mindustry/world/blocks/distribution/PayloadConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/PayloadConveyor.java @@ -174,7 +174,7 @@ public class PayloadConveyor extends Block{ @Override public boolean acceptPayload(Tilec source, Payload payload){ //accepting payloads from units isn't supported - return this.item == null && progress <= 5f && source != this; + return this.item == null && progress <= 5f && source != this && payload.fits(); } @Override diff --git a/core/src/mindustry/world/blocks/payloads/BlockPayload.java b/core/src/mindustry/world/blocks/payloads/BlockPayload.java index 3824a90742..f9d72b4e1a 100644 --- a/core/src/mindustry/world/blocks/payloads/BlockPayload.java +++ b/core/src/mindustry/world/blocks/payloads/BlockPayload.java @@ -33,6 +33,11 @@ public class BlockPayload implements Payload{ tile.setBlock(entity.block(), entity.team(), rotation, () -> entity); } + @Override + public boolean fits(){ + return entity.block().size < 3; + } + @Override public void write(Writes write){ write.b(payloadBlock); diff --git a/core/src/mindustry/world/blocks/payloads/Payload.java b/core/src/mindustry/world/blocks/payloads/Payload.java index 02acf2cb09..49be536fd4 100644 --- a/core/src/mindustry/world/blocks/payloads/Payload.java +++ b/core/src/mindustry/world/blocks/payloads/Payload.java @@ -22,6 +22,11 @@ public interface Payload{ return false; } + /** @return whether this payload fits on a standard 3x3 conveyor. */ + default boolean fits(){ + return true; + } + /** writes the payload for saving. */ void write(Writes write); diff --git a/core/src/mindustry/world/blocks/payloads/UnitPayload.java b/core/src/mindustry/world/blocks/payloads/UnitPayload.java index f480e2f852..fe81f4934a 100644 --- a/core/src/mindustry/world/blocks/payloads/UnitPayload.java +++ b/core/src/mindustry/world/blocks/payloads/UnitPayload.java @@ -15,6 +15,11 @@ public class UnitPayload implements Payload{ this.unit = unit; } + @Override + public boolean fits(){ + return unit.hitSize() <= 16f; + } + @Override public void write(Writes write){ write.b(payloadUnit);