Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -78,14 +78,23 @@ namespace Barotrauma
{
bool entityAngleAssigned = false;
Limb targetLimb = null;
if (entity is Item item && item.body != null)
if (entity is Item item)
{
angle = item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
particleRotation = -item.body.Rotation;
if (emitter.Prefab.Properties.CopyEntityDir && item.body.Dir < 0.0f)
if (item.body != null)
{
particleRotation += MathHelper.Pi;
mirrorAngle = true;
angle = item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
particleRotation = -item.body.Rotation;
if (emitter.Prefab.Properties.CopyEntityDir && item.body.Dir < 0.0f)
{
particleRotation += MathHelper.Pi;
mirrorAngle = true;
}
}
else
{
angle = -item.RotationRad;
if (item.FlippedX) { angle += MathHelper.Pi; }
particleRotation = item.RotationRad;
}
entityAngleAssigned = true;
}
@@ -135,6 +144,7 @@ namespace Barotrauma
private void PlaySound(Entity entity, Hull hull, Vector2 worldPosition)
{
if (sounds.Count == 0) { return; }
if (entity is { Submarine.Loading: true }) { return; }
if (soundChannel == null || !soundChannel.IsPlaying || forcePlaySounds)
{
@@ -185,13 +195,8 @@ namespace Barotrauma
soundChannel.Position = new Vector3(worldPosition, 0.0f);
}
if (soundChannel != null && soundChannel.Looping)
{
ActiveLoopingSounds.Add(this);
soundEmitter = entity;
loopStartTime = Timing.TotalTime;
}
KeepLoopingSoundAlive(soundChannel);
void PlaySoundOrDelayIfNotLoaded(RoundSound selectedSound)
{
if (playSoundAfterLoadedCoroutine != null) { return; }
@@ -222,14 +227,28 @@ namespace Barotrauma
void PlaySound(RoundSound selectedSound)
{
//if the sound loops, we must make sure the existing channel
//if the sound loops, we must make sure the existing channel has been stopped first before attempting to play a new one
System.Diagnostics.Debug.Assert(
soundChannel == null || !soundChannel.IsPlaying || soundChannel.FadingOutAndDisposing || !soundChannel.Looping,
"A StatusEffect attempted to play a sound, but an looping sound is already playing. The looping sound should be stopped before playing a new one, or it will keep looping indefinitely.");
soundChannel = SoundPlayer.PlaySound(selectedSound.Sound, worldPosition, selectedSound.Volume, selectedSound.Range, hullGuess: hull, ignoreMuffling: selectedSound.IgnoreMuffling, freqMult: selectedSound.GetRandomFrequencyMultiplier());
ignoreMuffling = selectedSound.IgnoreMuffling;
if (soundChannel != null) { soundChannel.Looping = loopSound; }
if (soundChannel != null)
{
soundChannel.Looping = loopSound;
KeepLoopingSoundAlive(soundChannel);
}
}
void KeepLoopingSoundAlive(SoundChannel soundChannel)
{
if (soundChannel != null && soundChannel.Looping)
{
ActiveLoopingSounds.Add(this);
soundEmitter = entity;
loopStartTime = Timing.TotalTime;
}
}
}