This commit is contained in:
Mythril382
2024-05-27 03:35:37 +08:00
committed by GitHub
parent bc2be5de25
commit 7f80a1879e
3 changed files with 43 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
package mindustry.logic;
import arc.*;
import arc.audio.*;
import arc.graphics.*;
import arc.math.*;
import arc.math.geom.*;
@@ -2025,15 +2026,14 @@ public class LExecutor{
public static class PlaySoundI implements LInstruction{
public boolean positional;
public LogicSound sound;
public int volume, pitch, pan, x, y;
public int id, volume, pitch, pan, x, y;
public PlaySoundI(){
}
public PlaySoundI(boolean positional, LogicSound sound, int volume, int pitch, int pan, int x, int y){
public PlaySoundI(boolean positional, int id, int volume, int pitch, int pan, int x, int y){
this.positional = positional;
this.sound = sound;
this.id = id;
this.volume = volume;
this.pitch = pitch;
this.pan = pan;
@@ -2043,10 +2043,13 @@ public class LExecutor{
@Override
public void run(LExecutor exec){
Sound sound = Sounds.getSound(exec.numi(id));
if(sound == Sounds.none || sound == Sounds.swish) sound = Sounds.pew; //no.
if(positional){
sound.sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume));
sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume));
}else{
sound.sound.play(exec.numf(volume) * (Core.settings.getInt("sfxvol") / 100f), exec.numf(pitch), exec.numf(pan));
sound.play(exec.numf(volume) * (Core.settings.getInt("sfxvol") / 100f), exec.numf(pitch), exec.numf(pan));
}
}
}