block destroyEffect (#5427)

This commit is contained in:
MEEP of Faith
2021-06-16 12:55:08 -07:00
committed by GitHub
parent 9088d9eb39
commit a74bc0c077
3 changed files with 10 additions and 3 deletions

View File

@@ -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){

View File

@@ -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);

View File

@@ -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.*/