(commented) support for Call server-to-client sounds

This commit is contained in:
Anuken
2021-07-16 15:39:03 -04:00
parent 5c6b659ce3
commit 0980495a28
4 changed files with 63 additions and 7 deletions

View File

@@ -159,6 +159,22 @@ public class NetClient implements ApplicationListener{
clientPacketReliable(type, contents);
}
//TODO enable in build 129
/*
@Remote(variants = Variant.both, unreliable = true)
public static void sound(Sound sound, float volume, float pitch, float pan){
if(sound == null) return;
sound.play(volume * Core.settings.getInt("sfxvol") / 100f, pitch, pan);
}
@Remote(variants = Variant.both, unreliable = true)
public static void soundAt(Sound sound, float x, float y, float volume, float pitch){
if(sound == null) return;
sound.at(x, y, pitch, volume);
}*/
@Remote(variants = Variant.both, unreliable = true)
public static void effect(Effect effect, float x, float y, float rotation, Color color){
if(effect == null) return;

View File

@@ -1,5 +1,6 @@
package mindustry.io;
import arc.audio.*;
import arc.graphics.*;
import arc.math.geom.*;
import arc.struct.*;
@@ -501,6 +502,15 @@ public class TypeIO{
return id == -1 ? null : content.item(id);
}
//note that only the standard sound constants in Sounds are supported; modded sounds are not.
public static void writeSound(Writes write, Sound sound){
write.s(Sounds.getSoundId(sound));
}
public static Sound readSound(Reads read){
return Sounds.getSound(read.s());
}
public static void writeWeather(Writes write, Weather item){
write.s(item == null ? -1 : item.id);
}

View File

@@ -76,7 +76,7 @@ public class StatusEffect extends UnlockableContent{
if(reloadMultiplier != 1) stats.addPercent(Stat.reloadMultiplier, reloadMultiplier);
if(buildSpeedMultiplier != 1) stats.addPercent(Stat.buildSpeedMultiplier, buildSpeedMultiplier);
if(damage > 0) stats.add(Stat.damage, damage * 60f, StatUnit.perSecond);
if(damage < 0) stats.add(Stat.healing, -(damage * 60f), StatUnit.perSecond);
if(damage < 0) stats.add(Stat.healing, -damage * 60f, StatUnit.perSecond);
boolean reacts = false;