Removed sound config

This commit is contained in:
Anuken
2018-12-12 20:13:21 -05:00
parent e318b6a113
commit 6723479c32

View File

@@ -1,10 +1,7 @@
package io.anuke.mindustry.core; package io.anuke.mindustry.core;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.TimeUtils;
import io.anuke.mindustry.content.Mechs; import io.anuke.mindustry.content.Mechs;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
@@ -42,17 +39,13 @@ import static io.anuke.mindustry.Vars.*;
* This class is not created in the headless server. * This class is not created in the headless server.
*/ */
public class Control extends Module{ public class Control extends Module{
/** Minimum period of time between the same sound being played.*/
private static final long minSoundPeriod = 100;
public final Saves saves; public final Saves saves;
public final Unlocks unlocks; public final Unlocks unlocks;
private Timer timerRPC= new Timer(), timerUnlock = new Timer(); private Timer timerRPC = new Timer(), timerUnlock = new Timer();
private boolean hiscore = false; private boolean hiscore = false;
private boolean wasPaused = false; private boolean wasPaused = false;
private InputHandler[] inputs = {}; private InputHandler[] inputs = {};
private ObjectMap<Sound, Long> soundMap = new ObjectMap<>();
private Throwable error; private Throwable error;
public Control(){ public Control(){
@@ -72,17 +65,6 @@ public class Control extends Module{
unlocks.load(); unlocks.load();
Sounds.setFalloff(9000f);
Sounds.setPlayer((sound, volume) -> {
long time = TimeUtils.millis();
long value = soundMap.get(sound, 0L);
if(TimeUtils.timeSinceMillis(value) >= minSoundPeriod){
threads.runGraphics(() -> sound.play(volume));
soundMap.put(sound, time);
}
});
DefaultKeybinds.load(); DefaultKeybinds.load();
Settings.defaultList( Settings.defaultList(