diff --git a/core/assets-raw/sprites/blocks/walls/shielded-wall-glow.png b/core/assets-raw/sprites/blocks/walls/shielded-wall-glow.png new file mode 100644 index 0000000000..7eac1db515 Binary files /dev/null and b/core/assets-raw/sprites/blocks/walls/shielded-wall-glow.png differ diff --git a/core/assets-raw/sprites/blocks/walls/shielded-wall.png b/core/assets-raw/sprites/blocks/walls/shielded-wall.png new file mode 100644 index 0000000000..293839126b Binary files /dev/null and b/core/assets-raw/sprites/blocks/walls/shielded-wall.png differ diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index 4408c861c0..2bc10271e3 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -565,3 +565,4 @@ 63119=ship-refabricator|block-ship-refabricator-ui 63118=slag-heater|block-slag-heater-ui 63117=afflict|block-afflict-ui +63116=shielded-wall|block-shielded-wall-ui diff --git a/core/assets/logicids.dat b/core/assets/logicids.dat index 3ee34e9448..85047dce5b 100644 Binary files a/core/assets/logicids.dat and b/core/assets/logicids.dat differ diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 934fe6d40e..6ab0b23cee 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -80,7 +80,11 @@ public class Blocks{ //defense copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, plastaniumWall, plastaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge, phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, + + //walls - erekir berylliumWall, berylliumWallLarge, tungstenWall, tungstenWallLarge, blastDoor, reinforcedSurgeWall, reinforcedSurgeWallLarge, carbideWall, carbideWallLarge, + shieldedWall, + mender, mendProjector, overdriveProjector, overdriveDome, forceProjector, shockMine, scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet @@ -1669,6 +1673,20 @@ public class Blocks{ size = 2; }}; + shieldedWall = new ShieldWall("shielded-wall"){{ + requirements(Category.defense, ItemStack.with(Items.phaseFabric, 20, Items.surgeAlloy, 12)); + consumePower(3f / 60f); + + outputsPower = false; + hasPower = true; + consumesPower = true; + conductivePower = true; + + health = 260 * wallHealthMultiplier * 4; + armor = 15f; + size = 2; + }}; + mender = new MendProjector("mender"){{ requirements(Category.effect, with(Items.lead, 30, Items.copper, 25)); consumePower(0.3f); @@ -1992,6 +2010,7 @@ public class Blocks{ hasPower = true; consumesPower = true; conductivePower = true; + underBullets = true; baseEfficiency = 1f; consumePower(1f / 60f); @@ -4124,7 +4143,7 @@ public class Blocks{ intervalRandomSpread = 20f; intervalBullets = 2; intervalAngle = 180f; - intervalSpread = 280f; + intervalSpread = 300f; fragBullets = 20; fragVelocityMin = 0.5f; @@ -4140,7 +4159,7 @@ public class Blocks{ under = true; moveX = 2f; moveY = -1f; - moveRot = -5f; + moveRot = -7f; }}, new RegionPart("-blade-glow"){{ progress = PartProgress.recoil; @@ -4151,7 +4170,7 @@ public class Blocks{ under = true; moveX = 2f; moveY = -1f; - moveRot = -5f; + moveRot = -7f; }}); }}; diff --git a/core/src/mindustry/world/blocks/defense/ShieldWall.java b/core/src/mindustry/world/blocks/defense/ShieldWall.java new file mode 100644 index 0000000000..5fc190c099 --- /dev/null +++ b/core/src/mindustry/world/blocks/defense/ShieldWall.java @@ -0,0 +1,122 @@ +package mindustry.world.blocks.defense; + +import arc.graphics.*; +import arc.graphics.g2d.*; +import arc.math.*; +import arc.util.*; +import arc.util.io.*; +import mindustry.annotations.Annotations.*; +import mindustry.graphics.*; +import mindustry.world.meta.*; + +import static mindustry.Vars.*; + +public class ShieldWall extends Wall{ + public float shieldHealth = 900f; + public float breakCooldown = 60f * 10f; + public float regenSpeed = 2f; + + public Color glowColor = Color.valueOf("ff7531").a(0.5f); + public float glowMag = 0.6f, glowScl = 8f; + + public @Load("@-glow") TextureRegion glowRegion; + + public ShieldWall(String name){ + super(name); + + update = true; + } + + @Override + public void setStats(){ + super.setStats(); + + stats.add(Stat.shieldHealth, shieldHealth); + } + + public class ShieldWallBuild extends WallBuild{ + public float shield = shieldHealth, shieldRadius = 0f; + public float breakTimer; + + @Override + public void draw(){ + Draw.rect(block.region, x, y); + + if(shieldRadius > 0){ + float radius = shieldRadius * tilesize; + + Draw.z(Layer.shields); + + Draw.color(team.color, Color.white, Mathf.clamp(hit)); + + if(renderer.animateShields){ + Fill.square(x, y, radius); + }else{ + Lines.stroke(1.5f); + Draw.alpha(0.09f + Mathf.clamp(0.08f * hit)); + Fill.square(x, y, radius); + Draw.alpha(1f); + Lines.poly(x, y, 4, radius, 45f); + Draw.reset(); + } + + Draw.reset(); + + Drawf.additive(glowRegion, glowColor, (1f - glowMag + Mathf.absin(glowScl, glowMag)) * shieldRadius, x, y, 0f, Layer.blockAdditive); + } + } + + @Override + public void updateTile(){ + if(breakTimer > 0){ + breakTimer -= Time.delta; + }else{ + //regen when not broken + shield = Mathf.clamp(shield + regenSpeed * edelta(), 0f, shieldHealth); + } + + if(hit > 0){ + hit -= Time.delta / 10f; + hit = Math.max(hit, 0f); + } + + shieldRadius = Mathf.lerpDelta(shieldRadius, broken() ? 0f : 1f, 0.12f); + } + + public boolean broken(){ + return breakTimer > 0 || !canConsume(); + } + + @Override + public void damage(float damage){ + float shieldTaken = broken() ? 0f : Math.min(shield, damage); + + shield -= shieldTaken; + if(shieldTaken > 0){ + hit = 1f; + } + + //shield was destroyed, needs to go down + if(shield <= 0.00001f && shieldTaken > 0){ + breakTimer = breakCooldown; + } + + if(damage - shieldTaken > 0){ + super.damage(damage - shieldTaken); + } + } + + @Override + public void write(Writes write){ + super.write(write); + write.f(shield); + } + + @Override + public void read(Reads read, byte revision){ + super.read(read, revision); + shield = read.f(); + if(shield > 0) shieldRadius = 1f; + } + } +}