From a74bc0c0772a079ec3e7051b4be9dd8e35ffcf26 Mon Sep 17 00:00:00 2001 From: MEEP of Faith <54301439+MEEPofFaith@users.noreply.github.com> Date: Wed, 16 Jun 2021 12:55:08 -0700 Subject: [PATCH] block destroyEffect (#5427) --- core/src/mindustry/entities/Damage.java | 9 +++++++-- core/src/mindustry/entities/comp/BuildingComp.java | 2 +- core/src/mindustry/world/Block.java | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index 176761c349..7c69b06cb2 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -34,13 +34,18 @@ public class Damage{ dynamicExplosion(x, y, flammability, explosiveness, power, radius, damage, true, null, Fx.dynamicExplosion); } + /** Creates a dynamic explosion based on specified parameters. */ + public static void dynamicExplosion(float x, float y, float flammability, float explosiveness, float power, float radius, boolean damage, Effect explosionFx){ + dynamicExplosion(x, y, flammability, explosiveness, power, radius, damage, true, null, explosionFx); + } + /** Creates a dynamic explosion based on specified parameters. */ public static void dynamicExplosion(float x, float y, float flammability, float explosiveness, float power, float radius, boolean damage, boolean fire, @Nullable Team ignoreTeam){ dynamicExplosion(x, y, flammability, explosiveness, power, radius, damage, fire, ignoreTeam, Fx.dynamicExplosion); } /** Creates a dynamic explosion based on specified parameters. */ - public static void dynamicExplosion(float x, float y, float flammability, float explosiveness, float power, float radius, boolean damage, boolean fire, @Nullable Team ignoreTeam, Effect explosion){ + public static void dynamicExplosion(float x, float y, float flammability, float explosiveness, float power, float radius, boolean damage, boolean fire, @Nullable Team ignoreTeam, Effect explosionFx){ if(damage){ for(int i = 0; i < Mathf.clamp(power / 700, 0, 8); i++){ int length = 5 + Mathf.clamp((int)(power / 500), 1, 20); @@ -74,7 +79,7 @@ public class Damage{ float shake = Math.min(explosiveness / 4f + 3f, 9f); Effect.shake(shake, shake, x, y); - explosion.at(x, y, radius / 8f); + explosionFx.at(x, y, radius / 8f); } public static void createIncend(float x, float y, float range, int amount){ diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 6c6bf1250d..83c20b40ab 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1059,7 +1059,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, }); } - Damage.dynamicExplosion(x, y, flammability, explosiveness * 3.5f, power, tilesize * block.size / 2f, state.rules.damageExplosions); + Damage.dynamicExplosion(x, y, flammability, explosiveness * 3.5f, power, tilesize * block.size / 2f, state.rules.damageExplosions, block.destroyEffect); if(!floor().solid && !floor().isLiquid){ Effect.rubble(x, y, block.size); diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 11eb6b3bef..6e2e2c1afc 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -229,6 +229,8 @@ public class Block extends UnlockableContent{ public boolean instantDeconstruct = false; /** Effect for breaking the block. Passes size as rotation. */ public Effect breakEffect = Fx.breakBlock; + /** Effect for destroying the block. */ + public Effect destroyEffect = Fx.dynamicExplosion; /** Multiplier for cost of research in tech tree. */ public float researchCostMultiplier = 1; /** Whether this block has instant transfer.*/