Build 0.20.0.0

This commit is contained in:
Markus Isberg
2022-10-27 17:54:57 +03:00
parent 05c7b1f869
commit edaf4b09fe
197 changed files with 4344 additions and 1773 deletions
@@ -21,6 +21,13 @@ namespace Barotrauma
private Entity soundEmitter;
private double loopStartTime;
private bool loopSound;
/// <summary>
/// Each new sound overrides the existing sounds that were launched with this status effect, meaning the old sound will be faded out and disposed and the new sound will be played instead of the old.
/// Normally the call to play the sound is ignored if there's an existing sound playing when the effect triggers.
/// Used for example for ensuring that rapid playing sounds restart playing even when the previous clip(s) have not yet stopped.
/// Use with caution.
/// </summary>
private bool forcePlaySounds;
partial void InitProjSpecific(ContentXElement element, string parentDebugName)
{
@@ -50,6 +57,7 @@ namespace Barotrauma
break;
}
}
forcePlaySounds = element.GetAttributeBool(nameof(forcePlaySounds), false);
}
partial void ApplyProjSpecific(float deltaTime, Entity entity, IReadOnlyList<ISerializableEntity> targets, Hull hull, Vector2 worldPosition, bool playSound)
@@ -71,7 +79,7 @@ namespace Barotrauma
{
angle = item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
particleRotation = -item.body.Rotation;
if (item.body.Dir < 0.0f)
if (emitter.Prefab.Properties.CopyEntityDir && item.body.Dir < 0.0f)
{
particleRotation += MathHelper.Pi;
mirrorAngle = true;
@@ -96,7 +104,9 @@ namespace Barotrauma
{
angle = targetLimb.body.Rotation + ((targetLimb.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
particleRotation = -targetLimb.body.Rotation;
if (targetLimb.body.Dir < 0.0f)
float offset = targetLimb.Params.GetSpriteOrientation() - MathHelper.PiOver2;
particleRotation += offset;
if (emitter.Prefab.Properties.CopyEntityDir && targetLimb.body.Dir < 0.0f)
{
particleRotation += MathHelper.Pi;
mirrorAngle = true;
@@ -112,10 +122,14 @@ namespace Barotrauma
private void PlaySound(Entity entity, Hull hull, Vector2 worldPosition)
{
if (sounds.Count == 0) return;
if (sounds.Count == 0) { return; }
if (soundChannel == null || !soundChannel.IsPlaying)
if (soundChannel == null || !soundChannel.IsPlaying || forcePlaySounds)
{
if (soundChannel != null && soundChannel.IsPlaying)
{
soundChannel.FadeOutAndDispose();
}
if (soundSelectionMode == SoundSelectionMode.All)
{
foreach (RoundSound sound in sounds)