Sound framework improvements

This commit is contained in:
Anuken
2020-11-12 18:07:26 -05:00
parent d163cacb6a
commit d1d3ef0c67
24 changed files with 162 additions and 355 deletions

View File

@@ -1368,12 +1368,14 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
}
if(sound != null){
sound.update(x, y, shouldActiveSound());
}
if(!headless){
if(sound != null){
sound.update(x, y, shouldActiveSound());
}
if(block.ambientSound != Sounds.none && shouldAmbientSound()){
loops.play(block.ambientSound, self(), block.ambientSoundVolume * ambientVolume());
if(block.ambientSound != Sounds.none && shouldAmbientSound()){
control.sound.loop(block.ambientSound, self(), block.ambientSoundVolume * ambientVolume());
}
}
if(enabled || !block.noUpdateDisabled){

View File

@@ -34,7 +34,9 @@ abstract class FireComp implements Timedc, Posc, Firec, Syncc{
Fx.fireSmoke.at(x + Mathf.range(4f), y + Mathf.range(4f));
}
loops.play(Sounds.fire, this, 0.07f);
if(!headless){
control.sound.loop(Sounds.fire, this, 0.07f);
}
time = Mathf.clamp(time + Time.delta, 0, lifetime());

View File

@@ -89,7 +89,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
}
if(!headless){
loops.play(type.mineSound, this, type.mineSoundVolume);
control.sound.loop(type.mineSound, this, type.mineSoundVolume);
}
}
}