Core launch/land SFX
This commit is contained in:
@@ -3,6 +3,7 @@ package mindustry.audio;
|
||||
import arc.*;
|
||||
import arc.audio.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.*;
|
||||
|
||||
import static mindustry.gen.Sounds.*;
|
||||
|
||||
@@ -11,12 +12,15 @@ public class SoundPriority{
|
||||
static int lastGroup = 1;
|
||||
|
||||
public static void init(){
|
||||
//launching should not get interrupted by the loading screen
|
||||
coreLaunch.setBus(Vars.control.sound.uiBus);
|
||||
|
||||
max(7, beamPlasma, shootMeltdown, beamMeltdown);
|
||||
|
||||
//priority 3: absolutely do not interrupt these
|
||||
set(
|
||||
3f,
|
||||
acceleratorLaunch, acceleratorCharge
|
||||
acceleratorLaunch, acceleratorCharge, coreLand, coreLaunch
|
||||
);
|
||||
|
||||
//priority 2: long weapon loops and big explosions
|
||||
|
||||
@@ -1190,7 +1190,7 @@ public class Blocks{
|
||||
|
||||
size = 2;
|
||||
ambientSound = Sounds.loopMachineSpin;
|
||||
ambientSoundVolume = 0.09f;
|
||||
ambientSoundVolume = 0.1f;
|
||||
|
||||
consumePower(0.20f);
|
||||
consumeItems(with(Items.coal, 1, Items.lead, 2, Items.sand, 2));
|
||||
@@ -1204,7 +1204,7 @@ public class Blocks{
|
||||
size = 2;
|
||||
envEnabled |= Env.space;
|
||||
ambientSound = Sounds.loopMachineSpin;
|
||||
ambientSoundVolume = 0.1f;
|
||||
ambientSoundVolume = 0.12f;
|
||||
|
||||
consumeItems(with(Items.pyratite, 1, Items.sporePod, 1));
|
||||
consumePower(0.40f);
|
||||
@@ -1936,7 +1936,7 @@ public class Blocks{
|
||||
consumePower(3.50f);
|
||||
size = 2;
|
||||
consumeItem(Items.phaseFabric).boost();
|
||||
ambientSoundVolume = 0.05f;
|
||||
ambientSoundVolume = 0.08f;
|
||||
}};
|
||||
|
||||
overdriveDome = new OverdriveProjector("overdrive-dome"){{
|
||||
@@ -1946,6 +1946,7 @@ public class Blocks{
|
||||
range = 200f;
|
||||
speedBoost = 2.5f;
|
||||
useTime = 300f;
|
||||
ambientSoundVolume = 0.12f;
|
||||
hasBoost = false;
|
||||
consumeItems(with(Items.phaseFabric, 1, Items.silicon, 1));
|
||||
}};
|
||||
|
||||
@@ -216,9 +216,11 @@ public class Control implements ApplicationListener, Loadable{
|
||||
if(settings.getInt("musicvol") > 0){
|
||||
//TODO what to do if another core with different music is already playing?
|
||||
Music music = core.landMusic();
|
||||
music.stop();
|
||||
music.play();
|
||||
music.setVolume(settings.getInt("musicvol") / 100f);
|
||||
if(music != null){
|
||||
music.stop();
|
||||
music.play();
|
||||
music.setVolume(settings.getInt("musicvol") / 100f);
|
||||
}
|
||||
}
|
||||
|
||||
renderer.showLanding(core);
|
||||
|
||||
@@ -2,7 +2,6 @@ package mindustry.core;
|
||||
|
||||
import arc.*;
|
||||
import arc.assets.loaders.TextureLoader.*;
|
||||
import arc.audio.*;
|
||||
import arc.files.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.Texture.*;
|
||||
@@ -568,11 +567,6 @@ public class Renderer implements ApplicationListener{
|
||||
launching = true;
|
||||
landTime = landCore.launchDuration();
|
||||
|
||||
Music music = landCore.launchMusic();
|
||||
music.stop();
|
||||
music.play();
|
||||
music.setVolume(settings.getInt("musicvol") / 100f);
|
||||
|
||||
landCore.beginLaunch(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.world.blocks;
|
||||
|
||||
import arc.audio.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
public interface LaunchAnimator{
|
||||
@@ -17,13 +18,9 @@ public interface LaunchAnimator{
|
||||
|
||||
float launchDuration();
|
||||
|
||||
default Music landMusic(){
|
||||
default @Nullable Music landMusic(){
|
||||
return Musics.land;
|
||||
}
|
||||
|
||||
default Music launchMusic(){
|
||||
return Musics.launch;
|
||||
}
|
||||
|
||||
float zoomLaunch();
|
||||
}
|
||||
|
||||
@@ -40,9 +40,8 @@ public class Accelerator extends Block{
|
||||
/** Override for planets that this block can launch to. If null, the planet's launch candidates are used. */
|
||||
public @Nullable Seq<Planet> launchCandidates;
|
||||
|
||||
public Music launchMusic = Musics.coreLaunch;
|
||||
public Sound lightningSound = new RandomSound(Sounds.acceleratorLightning1, Sounds.acceleratorLightning2, Sounds.shootArc);
|
||||
public float lightningSoundVolume = 0.9f;
|
||||
public float lightningSoundVolume = 0.85f;
|
||||
public Sound chargeSound = Sounds.acceleratorCharge;
|
||||
public Sound launchSound = Sounds.acceleratorLaunch;
|
||||
public Sound constructSound = Sounds.acceleratorConstruct;
|
||||
@@ -311,13 +310,7 @@ public class Accelerator extends Block{
|
||||
|
||||
@Override
|
||||
public Music landMusic(){
|
||||
//unused
|
||||
return launchMusic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Music launchMusic(){
|
||||
return launchMusic;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,9 @@ public class CoreBlock extends StorageBlock{
|
||||
public UnitType unitType = UnitTypes.alpha;
|
||||
public float landDuration = 160f;
|
||||
public Music landMusic = Musics.land;
|
||||
public Music launchMusic = Musics.coreLaunch;
|
||||
public float launchSoundVolume = 1f, landSoundVolume = 1f;
|
||||
public Sound launchSound = Sounds.coreLaunch;
|
||||
public Sound landSound = Sounds.coreLand;
|
||||
public Effect launchEffect = Fx.launch;
|
||||
|
||||
public Interp landZoomInterp = Interp.pow3;
|
||||
@@ -303,11 +305,6 @@ public class CoreBlock extends StorageBlock{
|
||||
return landMusic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Music launchMusic(){
|
||||
return launchMusic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginLaunch(boolean launching){
|
||||
cloudSeed = Mathf.random(1f);
|
||||
@@ -316,6 +313,7 @@ public class CoreBlock extends StorageBlock{
|
||||
}
|
||||
|
||||
if(!headless){
|
||||
(launching ? launchSound : landSound).play(launchSoundVolume);
|
||||
// Add fade-in and fade-out foreground when landing or launching.
|
||||
if(renderer.isLaunching()){
|
||||
float margin = 30f;
|
||||
|
||||
@@ -51,6 +51,7 @@ public class UnitFactory extends UnitBlock{
|
||||
regionRotated1 = 1;
|
||||
commandable = true;
|
||||
ambientSound = Sounds.loopUnitBuilding;
|
||||
ambientSoundVolume = 0.09f;
|
||||
|
||||
config(Integer.class, (UnitFactoryBuild build, Integer i) -> {
|
||||
if(!configurable) return;
|
||||
|
||||
Reference in New Issue
Block a user