From 45a0f3c58874872fc107966413ba89a3af47d666 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 21 Apr 2022 14:39:30 -0400 Subject: [PATCH] Proper shield breaker --- core/assets/icons/icons.properties | 1 + core/assets/logicids.dat | Bin 4302 -> 4318 bytes core/src/mindustry/content/Blocks.java | 4 +++- .../world/blocks/defense/BaseShield.java | 1 + .../world/blocks/defense/ShieldBreaker.java | 18 +++++++++--------- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index 53532fdba9..44aa449427 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -549,3 +549,4 @@ 63143=armored-duct|block-armored-duct-ui 63142=anthicus|unit-anthicus-ui 63141=anthicus-missile|unit-anthicus-missile-ui +63140=shield-breaker|block-shield-breaker-ui diff --git a/core/assets/logicids.dat b/core/assets/logicids.dat index 4942751fab18967b9728ebad92d3fe4dcca27459..534e2a396b20363c2561aeb070ffdf4fb94e5681 100644 GIT binary patch delta 32 ocmX@7cu$du;l)O#`@H;o#Tl8YIVrkHMX8C|sYRO~@V;XL0LnHDrvLx| delta 16 YcmcbocutXt;rT|U`@EY!^1fvP06XLd7XSbN diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 9651026dad..84a8b11f8d 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1782,12 +1782,14 @@ public class Blocks{ consumePower(5f); }}; - shieldBreaker = new BaseShield("shield-breaker"){{ + shieldBreaker = new ShieldBreaker("shield-breaker"){{ requirements(Category.effect, BuildVisibility.editorOnly, with()); size = 5; + toDestroy = new Block[]{Blocks.shieldProjector, Blocks.largeShieldProjector}; consumeItem(Items.tungsten, 100); + itemCapacity = 100; }}; //endregion diff --git a/core/src/mindustry/world/blocks/defense/BaseShield.java b/core/src/mindustry/world/blocks/defense/BaseShield.java index 7ec122c19a..fc9605d63b 100644 --- a/core/src/mindustry/world/blocks/defense/BaseShield.java +++ b/core/src/mindustry/world/blocks/defense/BaseShield.java @@ -58,6 +58,7 @@ public class BaseShield extends Block{ hasPower = true; update = solid = true; + rebuildable = false; } @Override diff --git a/core/src/mindustry/world/blocks/defense/ShieldBreaker.java b/core/src/mindustry/world/blocks/defense/ShieldBreaker.java index b0cda79ded..0368f1557e 100644 --- a/core/src/mindustry/world/blocks/defense/ShieldBreaker.java +++ b/core/src/mindustry/world/blocks/defense/ShieldBreaker.java @@ -1,7 +1,6 @@ package mindustry.world.blocks.defense; import arc.math.*; -import arc.util.*; import mindustry.*; import mindustry.content.*; import mindustry.entities.*; @@ -9,13 +8,14 @@ import mindustry.gen.*; import mindustry.world.*; public class ShieldBreaker extends Block{ - public @Nullable Block toDestroy; + public Block[] toDestroy = {}; public Effect effect = Fx.shockwave, breakEffect = Fx.reactorExplosion, selfKillEffect = Fx.massiveExplosion; public ShieldBreaker(String name){ super(name); solid = update = true; + rebuildable = false; } @Override @@ -28,19 +28,19 @@ public class ShieldBreaker extends Block{ @Override public void updateTile(){ if(Mathf.equal(efficiency, 1f)){ - if(toDestroy != null){ - effect.at(this); - for(var other : Vars.state.teams.active){ - if(team != other.team){ - other.getBuildings(toDestroy).copy().each(b -> { + effect.at(this); + for(var other : Vars.state.teams.active){ + if(team != other.team){ + for(var block : toDestroy){ + other.getBuildings(block).copy().each(b -> { breakEffect.at(b); b.kill(); }); } } - selfKillEffect.at(this); - kill(); } + selfKillEffect.at(this); + kill(); } } }