Unhardcode reactor explosion sound (#7085)

Also fix NuclearReactors playing the explode sound even if it doesn't explode.
This commit is contained in:
MEEPofFaith 2022-06-28 13:09:58 -07:00 committed by GitHub
parent 7402577902
commit 49b6f417d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,7 @@
package mindustry.world.blocks.power;
import arc.*;
import arc.audio.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
@ -27,6 +28,7 @@ public class ImpactReactor extends PowerGenerator{
public int explosionRadius = 23;
public int explosionDamage = 1900;
public Effect explodeEffect = Fx.impactReactorExplosion;
public Sound explodeSound = Sounds.explosionbig;
public Color plasma1 = Color.valueOf("ffd06b"), plasma2 = Color.valueOf("ff361b");
@ -145,12 +147,11 @@ public class ImpactReactor extends PowerGenerator{
if(warmup < 0.3f || !state.rules.reactorExplosions) return;
Sounds.explosionbig.at(this);
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage * 4);
Effect.shake(6f, 16f, x, y);
explodeEffect.at(x, y);
explodeEffect.at(this);
explodeSound.at(this);
}
@Override

View File

@ -1,6 +1,7 @@
package mindustry.world.blocks.power;
import arc.*;
import arc.audio.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
@ -30,6 +31,7 @@ public class NuclearReactor extends PowerGenerator{
public Color coolColor = new Color(1, 1, 1, 0f);
public Color hotColor = Color.valueOf("ff9575a3");
public Effect explodeEffect = Fx.reactorExplosion;
public Sound explodeSound = Sounds.explosionbig;
/** ticks to consume 1 fuel */
public float itemDuration = 120;
/** heating per frame * fullness */
@ -128,8 +130,6 @@ public class NuclearReactor extends PowerGenerator{
public void onDestroyed(){
super.onDestroyed();
Sounds.explosionbig.at(this);
int fuel = items.get(fuelItem);
if((fuel < 5 && heat < 0.5f) || !state.rules.reactorExplosions) return;
@ -138,7 +138,8 @@ public class NuclearReactor extends PowerGenerator{
// * ((float)fuel / itemCapacity) to scale based on fullness
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage * 4);
explodeEffect.at(x, y);
explodeEffect.at(this);
explodeSound.at(this);
}
@Override