v0.10.5.1
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using FarseerPhysics;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -64,6 +63,27 @@ namespace Barotrauma
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 60 + offset), $"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < ObjectiveManager.Objectives.Count; i++)
|
||||
{
|
||||
var objective = ObjectiveManager.Objectives[i];
|
||||
int offsetMultiplier;
|
||||
if (ObjectiveManager.CurrentOrder == null)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
offsetMultiplier = i - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offsetMultiplier = i + 1;
|
||||
}
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(120, offsetMultiplier * 18 + 100), $"{objective.DebugTag} ({objective.Priority.FormatZeroDecimal()})", Color.White, Color.Black * 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
if (steeringManager is IndoorsSteeringManager pathSteering)
|
||||
|
||||
@@ -409,11 +409,6 @@ namespace Barotrauma
|
||||
|
||||
emitter.Emit(1.0f, limb.WorldPosition, character.CurrentHull, amountMultiplier: gibParticleAmount);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(character.BloodDecalName))
|
||||
{
|
||||
character.CurrentHull?.AddDecal(character.BloodDecalName, limb.WorldPosition, MathHelper.Clamp(limb.Mass, 0.5f, 2.0f));
|
||||
}
|
||||
}
|
||||
|
||||
if (playSound)
|
||||
|
||||
@@ -97,8 +97,6 @@ namespace Barotrauma
|
||||
set { chromaticAberrationStrength = MathHelper.Clamp(value, 0.0f, 100.0f); }
|
||||
}
|
||||
|
||||
public string BloodDecalName => Params.BloodDecal;
|
||||
|
||||
private readonly List<ParticleEmitter> bloodEmitters = new List<ParticleEmitter>();
|
||||
public IEnumerable<ParticleEmitter> BloodEmitters
|
||||
{
|
||||
@@ -617,7 +615,7 @@ namespace Barotrauma
|
||||
|
||||
partial void SetOrderProjSpecific(Order order, string orderOption)
|
||||
{
|
||||
GameMain.GameSession?.CrewManager?.DisplayCharacterOrder(this, order, orderOption);
|
||||
GameMain.GameSession?.CrewManager?.AddCurrentOrderIcon(this, order, orderOption);
|
||||
}
|
||||
|
||||
public static void AddAllToGUIUpdateList()
|
||||
@@ -786,7 +784,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (CampaignInteractionType != CampaignMode.InteractionType.None && AllowCustomInteract)
|
||||
{
|
||||
var iconStyle = GUI.Style.GetComponentStyle("CampaignInteractionIcon." + CampaignInteractionType);
|
||||
var iconStyle = GUI.Style.GetComponentStyle("CampaignInteractionBubble." + CampaignInteractionType);
|
||||
if (iconStyle != null)
|
||||
{
|
||||
Vector2 headPos = AnimController.GetLimb(LimbType.Head)?.WorldPosition ?? WorldPosition + Vector2.UnitY * 100.0f;
|
||||
@@ -825,15 +823,19 @@ namespace Barotrauma
|
||||
/// Creates a progress bar that's "linked" to the specified object (or updates an existing one if there's one already linked to the object)
|
||||
/// The progress bar will automatically fade out after 1 sec if the method hasn't been called during that time
|
||||
/// </summary>
|
||||
public HUDProgressBar UpdateHUDProgressBar(object linkedObject, Vector2 worldPosition, float progress, Color emptyColor, Color fullColor)
|
||||
public HUDProgressBar UpdateHUDProgressBar(object linkedObject, Vector2 worldPosition, float progress, Color emptyColor, Color fullColor, string textTag = "")
|
||||
{
|
||||
if (controlled != this) return null;
|
||||
if (controlled != this) { return null; }
|
||||
|
||||
if (!hudProgressBars.TryGetValue(linkedObject, out HUDProgressBar progressBar))
|
||||
{
|
||||
progressBar = new HUDProgressBar(worldPosition, Submarine, emptyColor, fullColor);
|
||||
progressBar = new HUDProgressBar(worldPosition, Submarine, emptyColor, fullColor, textTag);
|
||||
hudProgressBars.Add(linkedObject, progressBar);
|
||||
}
|
||||
else
|
||||
{
|
||||
progressBar.TextTag = textTag;
|
||||
}
|
||||
|
||||
progressBar.WorldPosition = worldPosition;
|
||||
progressBar.FadeTimer = Math.Max(progressBar.FadeTimer, 1.0f);
|
||||
@@ -859,7 +861,7 @@ namespace Barotrauma
|
||||
}
|
||||
var selectedSound = matchingSounds.GetRandom();
|
||||
if (selectedSound?.Sound == null) { return; }
|
||||
soundChannel = SoundPlayer.PlaySound(selectedSound.Sound, AnimController.WorldPosition, selectedSound.Volume, selectedSound.Range, CurrentHull);
|
||||
soundChannel = SoundPlayer.PlaySound(selectedSound.Sound, AnimController.WorldPosition, selectedSound.Volume, selectedSound.Range, hullGuess: CurrentHull);
|
||||
soundTimer = soundInterval;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace Barotrauma
|
||||
return
|
||||
character?.Inventory != null &&
|
||||
character.AllowInput &&
|
||||
!character.LockHands &&
|
||||
(controller?.User != character || !controller.HideHUD) &&
|
||||
!IsCampaignInterfaceOpen &&
|
||||
!ConversationAction.FadeScreenToBlack;
|
||||
@@ -227,7 +226,7 @@ namespace Barotrauma
|
||||
Color.Lerp(GUI.Style.Red, GUI.Style.Orange * 0.5f, brokenItem.Condition / brokenItem.MaxCondition) * alpha);
|
||||
}
|
||||
|
||||
if (!character.IsIncapacitated && character.Stun <= 0.0f && !IsCampaignInterfaceOpen)
|
||||
if (!character.IsIncapacitated && character.Stun <= 0.0f && !IsCampaignInterfaceOpen && (!character.IsKeyDown(InputType.Aim) || character.SelectedItems.Any(it => it?.GetComponent<Sprayer>() == null)))
|
||||
{
|
||||
if (character.FocusedCharacter != null && character.FocusedCharacter.CanBeSelected)
|
||||
{
|
||||
@@ -307,6 +306,14 @@ namespace Barotrauma
|
||||
{
|
||||
progressBar.Draw(spriteBatch, cam);
|
||||
}
|
||||
|
||||
foreach (Character npc in Character.CharacterList)
|
||||
{
|
||||
if (npc.CampaignInteractionType == CampaignMode.InteractionType.None || npc.Submarine != character.Submarine || npc.IsDead || npc.IsIncapacitated) { continue; }
|
||||
|
||||
var iconStyle = GUI.Style.GetComponentStyle("CampaignInteractionIcon." + npc.CampaignInteractionType);
|
||||
GUI.DrawIndicator(spriteBatch, npc.WorldPosition, cam, 500.0f, iconStyle.GetDefaultSprite(), iconStyle.Color);
|
||||
}
|
||||
}
|
||||
|
||||
if (character.SelectedConstruction != null &&
|
||||
@@ -355,7 +362,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (ShouldDrawInventory(character))
|
||||
{
|
||||
character.Inventory.Locked = LockInventory(character);
|
||||
character.Inventory.Locked = character == Character.Controlled && LockInventory(character);
|
||||
character.Inventory.DrawOwn(spriteBatch);
|
||||
character.Inventory.CurrentLayout = CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null ?
|
||||
CharacterInventory.Layout.Default :
|
||||
@@ -369,14 +376,10 @@ namespace Barotrauma
|
||||
{
|
||||
if (character.SelectedCharacter.CanInventoryBeAccessed)
|
||||
{
|
||||
///character.Inventory.CurrentLayout = Alignment.Left;
|
||||
character.SelectedCharacter.Inventory.Locked = false;
|
||||
character.SelectedCharacter.Inventory.CurrentLayout = CharacterInventory.Layout.Left;
|
||||
character.SelectedCharacter.Inventory.DrawOwn(spriteBatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
//character.Inventory.CurrentLayout = (CharacterHealth.OpenHealthWindow == null) ? Alignment.Center : Alignment.Left;
|
||||
}
|
||||
if (CharacterHealth.OpenHealthWindow == character.SelectedCharacter.CharacterHealth)
|
||||
{
|
||||
character.SelectedCharacter.CharacterHealth.Alignment = Alignment.Left;
|
||||
@@ -450,7 +453,6 @@ namespace Barotrauma
|
||||
private static bool LockInventory(Character character)
|
||||
{
|
||||
if (character?.Inventory == null || !character.AllowInput || character.LockHands || IsCampaignInterfaceOpen) { return true; }
|
||||
|
||||
return character.ShouldLockHud();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (this != Controlled)
|
||||
{
|
||||
if (GameMain.Client.EndCinematic != null) // Freezes the characters during the ending cinematic
|
||||
if (GameMain.Client.EndCinematic != null &&
|
||||
GameMain.Client.EndCinematic.Running) // Freezes the characters during the ending cinematic
|
||||
{
|
||||
AnimController.Frozen = true;
|
||||
memState.Clear();
|
||||
|
||||
@@ -38,25 +38,43 @@ namespace Barotrauma
|
||||
|
||||
public Vector2 Size;
|
||||
|
||||
private Submarine parentSub;
|
||||
private readonly Submarine parentSub;
|
||||
public string Text
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public HUDProgressBar(Vector2 worldPosition, Submarine parentSubmarine = null)
|
||||
: this(worldPosition, parentSubmarine, GUI.Style.Red, GUI.Style.Green)
|
||||
private string textTag;
|
||||
public string TextTag
|
||||
{
|
||||
get { return textTag; }
|
||||
set
|
||||
{
|
||||
if (textTag == value) { return; }
|
||||
textTag = value;
|
||||
Text = string.IsNullOrEmpty(textTag) ? string.Empty : TextManager.Get(textTag);
|
||||
}
|
||||
}
|
||||
|
||||
public HUDProgressBar(Vector2 worldPosition, string textTag, Submarine parentSubmarine = null)
|
||||
: this(worldPosition, parentSubmarine, GUI.Style.Red, GUI.Style.Green, textTag)
|
||||
{
|
||||
}
|
||||
|
||||
public HUDProgressBar(Vector2 worldPosition, Submarine parentSubmarine, Color emptyColor, Color fullColor)
|
||||
public HUDProgressBar(Vector2 worldPosition, Submarine parentSubmarine, Color emptyColor, Color fullColor, string textTag)
|
||||
{
|
||||
this.emptyColor = emptyColor;
|
||||
this.fullColor = fullColor;
|
||||
|
||||
parentSub = parentSubmarine;
|
||||
|
||||
WorldPosition = worldPosition;
|
||||
|
||||
Size = new Vector2(100.0f, 20.0f);
|
||||
|
||||
FadeTimer = 1.0f;
|
||||
if (!string.IsNullOrEmpty(textTag))
|
||||
{
|
||||
textTag = textTag;
|
||||
Text = TextManager.Get(textTag);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(float deltatime)
|
||||
@@ -76,12 +94,21 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
pos = cam.WorldToScreen(pos);
|
||||
|
||||
Color color = Color.Lerp(emptyColor, fullColor, progress);
|
||||
GUI.DrawProgressBar(spriteBatch,
|
||||
new Vector2(pos.X, -pos.Y),
|
||||
Size, progress,
|
||||
Color.Lerp(emptyColor, fullColor, progress) * a,
|
||||
Size, progress,
|
||||
color * a,
|
||||
Color.White * a * 0.8f);
|
||||
|
||||
if (!string.IsNullOrEmpty(Text))
|
||||
{
|
||||
Vector2 textSize = GUI.SmallFont.MeasureString(Text);
|
||||
Vector2 textPos = new Vector2(pos.X + (Size.X - textSize.X) / 2, pos.Y - textSize.Y * 1.2f);
|
||||
GUI.DrawString(spriteBatch, textPos - Vector2.One, Text, Color.Black * a, font: GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, textPos, Text, Color.White * a, font: GUI.SmallFont);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private GUIButton suicideButton;
|
||||
public GUIButton SuicideButton { get; private set; }
|
||||
|
||||
// healthbars
|
||||
private GUIProgressBar healthBar;
|
||||
@@ -247,22 +247,6 @@ namespace Barotrauma
|
||||
|
||||
private GUIFrame healthBarHolder;
|
||||
|
||||
private Point healthBarOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Point(Math.Max(2, GUI.IntScaleCeiling(1.5f)), Math.Min(GUI.IntScaleFloor(18f), 19));
|
||||
}
|
||||
}
|
||||
|
||||
private Point healthBarSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Point(healthBarHolder.Rect.Width - Math.Min(GUI.IntScale(45f), 47), GUI.IntScale(15f));
|
||||
}
|
||||
}
|
||||
|
||||
partial void InitProjSpecific(XElement element, Character character)
|
||||
{
|
||||
DisplayedVitality = MaxVitality;
|
||||
@@ -290,29 +274,22 @@ namespace Barotrauma
|
||||
healthBarHolder.RectTransform.NonScaledSize = HUDLayoutSettings.HealthBarArea.Size;
|
||||
healthBarHolder.RectTransform.RelativeOffset = Vector2.Zero;
|
||||
|
||||
GUIFrame healthBarBG = new GUIFrame(new RectTransform(Vector2.One, healthBarHolder.RectTransform), style: "CharacterHealthBarBG")
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
healthBarShadow = new GUIProgressBar(new RectTransform(healthBarSize, healthBarHolder.RectTransform, Anchor.BottomRight),
|
||||
barSize: 1.0f, color: Color.Green, style: horizontal ? "CharacterHealthBarSlider" : "GUIProgressBarVertical", showFrame: false)
|
||||
healthBarShadow = new GUIProgressBar(new RectTransform(Vector2.One, healthBarHolder.RectTransform, Anchor.BottomRight),
|
||||
barSize: 1.0f, color: Color.Green, style: horizontal ? "CharacterHealthBar" : "GUIProgressBarVertical", showFrame: false)
|
||||
{
|
||||
IsHorizontal = horizontal
|
||||
};
|
||||
healthBarShadow.Visible = false;
|
||||
healthShadowSize = 1.0f;
|
||||
|
||||
healthBar = new GUIProgressBar(new RectTransform(healthBarSize, healthBarHolder.RectTransform, Anchor.BottomRight),
|
||||
barSize: 1.0f, color: GUI.Style.HealthBarColorHigh, style: horizontal ? "CharacterHealthBarSlider" : "GUIProgressBarVertical", showFrame: false)
|
||||
healthBar = new GUIProgressBar(new RectTransform(Vector2.One, healthBarHolder.RectTransform, Anchor.BottomRight),
|
||||
barSize: 1.0f, color: GUI.Style.HealthBarColorHigh, style: horizontal ? "CharacterHealthBar" : "GUIProgressBarVertical")
|
||||
{
|
||||
HoverCursor = CursorState.Hand,
|
||||
Enabled = true,
|
||||
IsHorizontal = horizontal
|
||||
};
|
||||
|
||||
healthBar.RectTransform.AbsoluteOffset = healthBarShadow.RectTransform.AbsoluteOffset = healthBarOffset;
|
||||
|
||||
healthInterfaceFrame = new GUIFrame(new RectTransform(new Vector2(0.7f, 0.55f), GUI.Canvas, anchor: Anchor.Center, scaleBasis: ScaleBasis.Smallest), style: "ItemUI");
|
||||
|
||||
var healthInterfaceLayout = new GUILayoutGroup(new RectTransform(Vector2.One / 1.05f, healthInterfaceFrame.RectTransform, anchor: Anchor.Center), true);
|
||||
@@ -519,7 +496,7 @@ namespace Barotrauma
|
||||
|
||||
UpdateAlignment();
|
||||
|
||||
suicideButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.02f), GUI.Canvas, Anchor.TopCenter)
|
||||
SuicideButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.02f), GUI.Canvas, Anchor.TopCenter)
|
||||
{
|
||||
MinSize = new Point(150, 20), RelativeOffset = new Vector2(0.0f, 0.01f)
|
||||
},
|
||||
@@ -546,7 +523,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
};
|
||||
suicideButton.TextBlock.AutoScaleHorizontal = true;
|
||||
SuicideButton.TextBlock.AutoScaleHorizontal = true;
|
||||
|
||||
if (element != null)
|
||||
{
|
||||
@@ -591,9 +568,6 @@ namespace Barotrauma
|
||||
healthBarHolder.RectTransform.NonScaledSize = HUDLayoutSettings.HealthBarArea.Size;
|
||||
healthBarHolder.RectTransform.RelativeOffset = Vector2.Zero;
|
||||
|
||||
healthBar.RectTransform.NonScaledSize = healthBarShadow.RectTransform.NonScaledSize = healthBarSize;
|
||||
healthBar.RectTransform.AbsoluteOffset = healthBarShadow.RectTransform.AbsoluteOffset = healthBarOffset;
|
||||
|
||||
switch (alignment)
|
||||
{
|
||||
case Alignment.Left:
|
||||
@@ -943,23 +917,7 @@ namespace Barotrauma
|
||||
healthBar.State = GUIComponent.ComponentState.None;
|
||||
}
|
||||
|
||||
suicideButton.Visible = Character == Character.Controlled && !Character.IsDead && Character.IsIncapacitated;
|
||||
|
||||
if (GameMain.GameSession?.Campaign is { } campaign)
|
||||
{
|
||||
RectTransform endRoundButton = campaign?.EndRoundButton.RectTransform;
|
||||
if (endRoundButton != null)
|
||||
{
|
||||
if (suicideButton.Visible)
|
||||
{
|
||||
endRoundButton.ScreenSpaceOffset = new Point(0, suicideButton.Rect.Height);
|
||||
}
|
||||
else if (endRoundButton.ScreenSpaceOffset != Point.Zero)
|
||||
{
|
||||
endRoundButton.ScreenSpaceOffset = Point.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
SuicideButton.Visible = Character == Character.Controlled && !Character.IsDead && Character.IsIncapacitated;
|
||||
|
||||
cprButton.Visible =
|
||||
Character == Character.Controlled?.SelectedCharacter
|
||||
@@ -992,9 +950,9 @@ namespace Barotrauma
|
||||
{
|
||||
healthBarHolder.AddToGUIUpdateList();
|
||||
}
|
||||
if (suicideButton.Visible && Character == Character.Controlled)
|
||||
if (SuicideButton.Visible && Character == Character.Controlled)
|
||||
{
|
||||
suicideButton.AddToGUIUpdateList();
|
||||
SuicideButton.AddToGUIUpdateList();
|
||||
}
|
||||
if (cprButton != null && cprButton.Visible)
|
||||
{
|
||||
@@ -1907,6 +1865,8 @@ namespace Barotrauma
|
||||
|
||||
private readonly List<Pair<AfflictionPrefab, float>> newAfflictions = new List<Pair<AfflictionPrefab, float>>();
|
||||
private readonly List<Triplet<LimbHealth, AfflictionPrefab, float>> newLimbAfflictions = new List<Triplet<LimbHealth, AfflictionPrefab, float>>();
|
||||
private readonly List<Pair<AfflictionPrefab.PeriodicEffect, float>> newPeriodicEffects = new List<Pair<AfflictionPrefab.PeriodicEffect, float>>();
|
||||
|
||||
public void ClientRead(IReadMessage inc)
|
||||
{
|
||||
newAfflictions.Clear();
|
||||
@@ -1920,9 +1880,20 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError("Error while reading character health data: affliction with the uint ID " + afflictionID + " not found.");
|
||||
//read the 8 bytes for affliction strength anyway to prevent messing up reading rest of the message
|
||||
_ = inc.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
int _periodicAfflictionCount = inc.ReadByte();
|
||||
for (int j = 0; j < _periodicAfflictionCount; j++)
|
||||
{
|
||||
_ = inc.ReadByte();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
float afflictionStrength = inc.ReadRangedSingle(0.0f, afflictionPrefab.MaxStrength, 8);
|
||||
int periodicAfflictionCount = inc.ReadByte();
|
||||
for (int j = 0; j < periodicAfflictionCount; j++)
|
||||
{
|
||||
float periodicAfflictionTimer = inc.ReadRangedSingle(afflictionPrefab.PeriodicEffects[j].MinInterval, afflictionPrefab.PeriodicEffects[j].MaxInterval, 8);
|
||||
newPeriodicEffects.Add(new Pair<AfflictionPrefab.PeriodicEffect, float>(afflictionPrefab.PeriodicEffects[j], periodicAfflictionTimer));
|
||||
}
|
||||
newAfflictions.Add(new Pair<AfflictionPrefab, float>(afflictionPrefab, afflictionStrength));
|
||||
}
|
||||
|
||||
@@ -1940,12 +1911,26 @@ namespace Barotrauma
|
||||
Affliction existingAffliction = afflictions.Find(a => a.Prefab == newAffliction.First);
|
||||
if (existingAffliction == null)
|
||||
{
|
||||
afflictions.Add(newAffliction.First.Instantiate(newAffliction.Second));
|
||||
existingAffliction = newAffliction.First.Instantiate(newAffliction.Second);
|
||||
afflictions.Add(existingAffliction);
|
||||
}
|
||||
else
|
||||
existingAffliction.SetStrength(newAffliction.Second);
|
||||
if (existingAffliction == stunAffliction)
|
||||
{
|
||||
existingAffliction.Strength = newAffliction.Second;
|
||||
if (existingAffliction == stunAffliction) Character.SetStun(existingAffliction.Strength, true, true);
|
||||
Character.SetStun(existingAffliction.Strength, true, true);
|
||||
}
|
||||
foreach (var periodicEffect in newPeriodicEffects)
|
||||
{
|
||||
if (!existingAffliction.Prefab.PeriodicEffects.Contains(periodicEffect.First)) { continue; }
|
||||
//timer has wrapped around, apply the effect
|
||||
if (periodicEffect.Second - existingAffliction.PeriodicEffectTimers[periodicEffect.First] > periodicEffect.First.MinInterval / 2)
|
||||
{
|
||||
existingAffliction.PeriodicEffectTimers[periodicEffect.First] = periodicEffect.Second;
|
||||
foreach (StatusEffect effect in periodicEffect.First.StatusEffects)
|
||||
{
|
||||
existingAffliction.ApplyStatusEffect(effect, deltaTime: 1.0f, this, targetLimb: null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1961,9 +1946,20 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError("Error while reading character health data: affliction with the uint ID " + afflictionID + " not found.");
|
||||
//read the 8 bytes for affliction strength anyway to prevent messing up reading rest of the message
|
||||
_ = inc.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
int _periodicAfflictionCount = inc.ReadByte();
|
||||
for (int j = 0; j < _periodicAfflictionCount; j++)
|
||||
{
|
||||
_ = inc.ReadByte();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
float afflictionStrength = inc.ReadRangedSingle(0.0f, afflictionPrefab.MaxStrength, 8);
|
||||
int periodicAfflictionCount = inc.ReadByte();
|
||||
for (int j = 0; j < periodicAfflictionCount; j++)
|
||||
{
|
||||
float periodicAfflictionTimer = inc.ReadRangedSingle(afflictionPrefab.PeriodicEffects[j].MinInterval, afflictionPrefab.PeriodicEffects[j].MaxInterval, 8);
|
||||
newPeriodicEffects.Add(new Pair<AfflictionPrefab.PeriodicEffect, float>(afflictionPrefab.PeriodicEffects[j], periodicAfflictionTimer));
|
||||
}
|
||||
newLimbAfflictions.Add(new Triplet<LimbHealth, AfflictionPrefab, float>(limbHealths[limbIndex], afflictionPrefab, afflictionStrength));
|
||||
}
|
||||
|
||||
@@ -1980,15 +1976,28 @@ namespace Barotrauma
|
||||
|
||||
foreach (Triplet<LimbHealth, AfflictionPrefab, float> newAffliction in newLimbAfflictions)
|
||||
{
|
||||
if (newAffliction.First != limbHealth) continue;
|
||||
if (newAffliction.First != limbHealth) { continue; }
|
||||
Affliction existingAffliction = limbHealth.Afflictions.Find(a => a.Prefab == newAffliction.Second);
|
||||
if (existingAffliction == null)
|
||||
{
|
||||
limbHealth.Afflictions.Add(newAffliction.Second.Instantiate(newAffliction.Third));
|
||||
existingAffliction = newAffliction.Second.Instantiate(newAffliction.Third);
|
||||
limbHealth.Afflictions.Add(existingAffliction);
|
||||
}
|
||||
else
|
||||
existingAffliction.SetStrength(newAffliction.Third);
|
||||
|
||||
foreach (var periodicEffect in newPeriodicEffects)
|
||||
{
|
||||
existingAffliction.Strength = newAffliction.Third;
|
||||
if (!existingAffliction.Prefab.PeriodicEffects.Contains(periodicEffect.First)) { continue; }
|
||||
//timer has wrapped around, apply the effect
|
||||
if (periodicEffect.Second - existingAffliction.PeriodicEffectTimers[periodicEffect.First] > periodicEffect.First.MinInterval / 2)
|
||||
{
|
||||
existingAffliction.PeriodicEffectTimers[periodicEffect.First] = periodicEffect.Second;
|
||||
foreach (StatusEffect effect in periodicEffect.First.StatusEffects)
|
||||
{
|
||||
Limb targetLimb = Character.AnimController.Limbs.FirstOrDefault(l => l.HealthIndex == limbHealths.IndexOf(newAffliction.First));
|
||||
existingAffliction.ApplyStatusEffect(effect, deltaTime: 1.0f, this, targetLimb: targetLimb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,7 +446,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (affliction is AfflictionBleeding)
|
||||
{
|
||||
bleedingDamage += affliction.GetVitalityDecrease(character.CharacterHealth);
|
||||
bleedingDamage += affliction.GetVitalityDecrease(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -455,7 +455,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (affliction.Prefab.AfflictionType == "damage")
|
||||
{
|
||||
damage += affliction.GetVitalityDecrease(character.CharacterHealth);
|
||||
damage += affliction.GetVitalityDecrease(null);
|
||||
}
|
||||
}
|
||||
float damageMultiplier = 1;
|
||||
@@ -488,7 +488,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
// spawn damage particles
|
||||
float damageParticleAmount = Math.Min(damage / 10, 1.0f) * damageMultiplier;
|
||||
float damageParticleAmount = Math.Min(damage / 5, 1.0f) * damageMultiplier;
|
||||
if (damageParticleAmount > 0.001f)
|
||||
{
|
||||
foreach (ParticleEmitter emitter in character.DamageEmitters)
|
||||
@@ -510,11 +510,6 @@ namespace Barotrauma
|
||||
if (!inWater && emitter.Prefab.ParticlePrefab.DrawTarget == ParticlePrefab.DrawTargetType.Water) { continue; }
|
||||
emitter.Emit(1.0f, WorldPosition, character.CurrentHull, sizeMultiplier: bloodParticleSize, amountMultiplier: bloodParticleAmount);
|
||||
}
|
||||
|
||||
if (bloodParticleAmount > 0 && character.CurrentHull != null && !string.IsNullOrEmpty(character.BloodDecalName))
|
||||
{
|
||||
character.CurrentHull.AddDecal(character.BloodDecalName, WorldPosition, MathHelper.Clamp(bloodParticleSize, 0.5f, 1.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user