Unstable 0.17.5.0

This commit is contained in:
Markus Isberg
2022-03-30 01:20:59 +09:00
parent c1b8e5a341
commit 44ded0225a
88 changed files with 2033 additions and 1430 deletions
@@ -38,11 +38,14 @@ namespace Barotrauma.Items.Components
public readonly bool Loop;
public ItemSound(RoundSound sound, ActionType type, bool loop = false)
public readonly bool OnlyPlayInSameSub;
public ItemSound(RoundSound sound, ActionType type, bool loop = false, bool onlyPlayInSameSub = false)
{
this.RoundSound = sound;
this.Type = type;
this.Loop = loop;
this.OnlyPlayInSameSub = onlyPlayInSameSub;
}
}
@@ -339,6 +342,11 @@ namespace Barotrauma.Items.Components
return;
}
if (itemSound.OnlyPlayInSameSub && item.Submarine != null && Character.Controlled != null)
{
if (Character.Controlled.Submarine == null || !Character.Controlled.Submarine.IsEntityFoundOnThisSub(item, includingConnectedSubs: true)) { return; }
}
if (itemSound.Loop)
{
if (loopingSoundChannel != null && loopingSoundChannel.Sound != itemSound.RoundSound.Sound)
@@ -500,7 +508,9 @@ namespace Barotrauma.Items.Components
RoundSound sound = RoundSound.Load(subElement);
if (sound == null) { break; }
ItemSound itemSound = new ItemSound(sound, type, subElement.GetAttributeBool("loop", false))
ItemSound itemSound = new ItemSound(sound, type,
subElement.GetAttributeBool("loop", false),
subElement.GetAttributeBool("onlyinsamesub", false))
{
VolumeProperty = subElement.GetAttributeIdentifier("volumeproperty", "")
};