Skip to content

Commit 888251a

Browse files
committed
Better black hole sounds
1 parent 936790f commit 888251a

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

src/progressed/content/PMSounds.java

-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public class PMSounds{
1818
pixelShoot = new Sound(),
1919
pixelHit = new Sound(),
2020
rockExplode = new Sound(),
21-
harbingerCharge = new Sound(),
22-
harbingerBlast = new Sound(),
2321
nuclearExplosion = new Sound(),
2422
pulseBeam = new Sound(),
2523
funiBoom = new Sound(),
@@ -31,8 +29,6 @@ public static void load() {
3129
pixelShoot = Vars.tree.loadSound("pixel-shoot");
3230
pixelHit = Vars.tree.loadSound("pixel-hit");
3331
rockExplode = Vars.tree.loadSound("rock-explode");
34-
harbingerCharge = Vars.tree.loadSound("harbinger-charge");
35-
harbingerBlast = Vars.tree.loadSound("harbinger-blast");
3632
nuclearExplosion = Vars.tree.loadSound("nuclear-explosion");
3733
pulseBeam = Vars.tree.loadSound("pulse-beam");
3834
funiBoom = Vars.tree.loadSound("funi-boom");

src/progressed/content/blocks/PMBlocks.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ public void setStats(){
771771
recoilTime = 240f;
772772
cooldownTime = 300f;
773773
shootY = 0f;
774-
shootSound = Sounds.release;
774+
shootSound = Sounds.dullExplosion;
775775
shootType = PMBullets.blackHole;
776776

777777
consumePower(35f);

src/progressed/entities/bullet/energy/BlackHoleBulletType.java

+27
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package progressed.entities.bullet.energy;
22

3+
import arc.audio.*;
34
import arc.graphics.*;
45
import arc.math.*;
56
import arc.math.geom.*;
67
import arc.struct.*;
78
import arc.util.*;
89
import blackhole.graphics.*;
10+
import mindustry.audio.*;
911
import mindustry.content.*;
1012
import mindustry.entities.*;
1113
import mindustry.entities.bullet.*;
@@ -15,6 +17,8 @@
1517
import progressed.entities.*;
1618
import progressed.entities.bullet.pseudo3d.*;
1719

20+
import static mindustry.Vars.*;
21+
1822
public class BlackHoleBulletType extends BulletType{
1923
static Seq<Class<?>> immuneTypes = Seq.with(
2024
ArcBulletType.class, //TODO Maybe implement a special case for these 3D bullets? Make suction radius spherical.
@@ -28,6 +32,8 @@ public class BlackHoleBulletType extends BulletType{
2832

2933
public Color color = Color.black;
3034
public Effect swirlEffect = EnergyFx.blackHoleSwirl;
35+
public Sound loopSound = Sounds.spellLoop;
36+
public float loopSoundVolume = 2f;
3137
public float suctionRadius = 160f, size = 6f, lensEdge = -1f, damageRadius = 17f;
3238
public float force = 10f, scaledForce = 800f, bulletForce = 0.1f, bulletScaledForce = 1f;
3339
public float bulletDamage = 10f;
@@ -60,6 +66,15 @@ public float continuousDamage(){
6066
return damage / 2f * 60f; //Damage every 2 ticks
6167
}
6268

69+
@Override
70+
public void init(Bullet b){
71+
super.init(b);
72+
73+
if(loopSound != null){
74+
b.data = new SoundLoop(loopSound, loopSoundVolume);
75+
}
76+
}
77+
6378
@Override
6479
public void update(Bullet b){
6580
if(b.timer(1, 2f)){
@@ -98,6 +113,10 @@ public void update(Bullet b){
98113
});
99114
}
100115

116+
if(!headless && b.data instanceof SoundLoop loop){
117+
loop.update(b.x, b.y, b.isAdded(), fout(b));
118+
}
119+
101120
super.update(b);
102121
}
103122

@@ -145,6 +164,14 @@ public void despawned(Bullet b){
145164
}
146165
}
147166

167+
@Override
168+
public void removed(Bullet b){
169+
super.removed(b);
170+
if(b.data instanceof SoundLoop loop){
171+
loop.stop();
172+
}
173+
}
174+
148175
public static boolean checkType(BulletType type){ //Returns true for bullets immune to suction.
149176
return immuneTypes.contains(c -> c.isAssignableFrom(type.getClass()));
150177
}

0 commit comments

Comments
 (0)