Faction Test 100.4.0.0

This commit is contained in:
Markus Isberg
2022-11-14 18:28:28 +02:00
parent 87426b68b2
commit c772b61fc1
412 changed files with 16984 additions and 5530 deletions
@@ -47,8 +47,8 @@ namespace Barotrauma
GUI.DrawRectangle(spriteBatch, wallTargetPos - new Vector2(10.0f, 10.0f), new Vector2(20.0f, 20.0f), Color.Orange, false);
GUI.DrawLine(spriteBatch, pos, wallTargetPos, Color.Orange * 0.5f, 0, 5);
}
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $"{SelectedAiTarget.Entity} ({GetTargetMemory(SelectedAiTarget, false)?.Priority.FormatZeroDecimal()})", GUIStyle.Red, Color.Black);
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 40.0f, $"({targetValue.FormatZeroDecimal()})", GUIStyle.Red, Color.Black);
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $"{SelectedAiTarget.Entity}", GUIStyle.Red, Color.Black);
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 40.0f, $"{targetValue.FormatZeroDecimal()} (M: {SelectedTargetMemory?.Priority.FormatZeroDecimal()}, P: {SelectedTargetingParams?.Priority.FormatZeroDecimal()})", GUIStyle.Red, Color.Black);
}
/*GUIStyle.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY * 80.0f, GUIStyle.Red);
@@ -99,12 +99,14 @@ namespace Barotrauma
float newAngularVelocity = Collider.AngularVelocity;
Collider.CorrectPosition(character.MemState, out newPosition, out newVelocity, out newRotation, out newAngularVelocity);
newVelocity = newVelocity.ClampLength(100.0f);
if (!MathUtils.IsValid(newVelocity)) { newVelocity = Vector2.Zero; }
overrideTargetMovement = newVelocity.LengthSquared() > 0.01f ? newVelocity : Vector2.Zero;
Collider.LinearVelocity = newVelocity;
Collider.AngularVelocity = newAngularVelocity;
if (Collider.BodyType == BodyType.Dynamic)
{
newVelocity = newVelocity.ClampLength(100.0f);
if (!MathUtils.IsValid(newVelocity)) { newVelocity = Vector2.Zero; }
overrideTargetMovement = newVelocity.LengthSquared() > 0.01f ? newVelocity : Vector2.Zero;
Collider.LinearVelocity = newVelocity;
Collider.AngularVelocity = newAngularVelocity;
}
float distSqrd = Vector2.DistanceSquared(newPosition, Collider.SimPosition);
float errorTolerance = character.CanMove ? 0.01f : 0.2f;
@@ -442,8 +444,7 @@ namespace Barotrauma
{
foreach (Limb limb in Limbs)
{
if (limb == null || limb.IsSevered || limb.ActiveSprite == null) { continue; }
if (limb == null || limb.IsSevered || limb.ActiveSprite == null || !limb.DoesFlip) { continue; }
Vector2 spriteOrigin = limb.ActiveSprite.Origin;
spriteOrigin.X = limb.ActiveSprite.SourceRect.Width - spriteOrigin.X;
limb.ActiveSprite.Origin = spriteOrigin;
@@ -468,7 +469,10 @@ namespace Barotrauma
{
var damageSound = character.GetSound(s => s.Type == CharacterSound.SoundType.Damage);
float range = damageSound != null ? damageSound.Range * 2 : ConvertUnits.ToDisplayUnits(character.AnimController.Collider.GetSize().Length() * 10);
SoundPlayer.PlayDamageSound(limbJoint.Params.BreakSound, 1.0f, limbJoint.LimbA.body.DrawPosition, range: range);
if (!limbJoint.Params.BreakSound.IsNullOrEmpty() && !limbJoint.Params.BreakSound.Equals("none", StringComparison.OrdinalIgnoreCase))
{
SoundPlayer.PlayDamageSound(limbJoint.Params.BreakSound, 1.0f, limbJoint.LimbA.body.DrawPosition, range: range);
}
}
}
@@ -42,7 +42,7 @@ namespace Barotrauma
if (sound != null)
{
SoundPlayer.PlaySound(sound.Sound, worldPosition, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling);
SoundPlayer.PlaySound(sound.Sound, worldPosition, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling, freqMult: sound.GetRandomFrequencyMultiplier());
}
}
}
@@ -109,6 +109,42 @@ namespace Barotrauma
set => grainStrength = Math.Max(0, value);
}
/// <summary>
/// Can be used by status effects
/// </summary>
public float CollapseEffectStrength
{
get { return Level.Loaded?.Renderer?.CollapseEffectStrength ?? 0.0f; }
set
{
if (Level.Loaded?.Renderer == null) { return; }
if (Controlled == this)
{
float strength = MathHelper.Clamp(value, 0.0f, 1.0f);
Level.Loaded.Renderer.CollapseEffectStrength = strength;
Level.Loaded.Renderer.CollapseEffectOrigin = Submarine?.WorldPosition ?? WorldPosition;
Screen.Selected.Cam.Shake = Math.Max(MathF.Pow(strength, 3) * 100.0f, Screen.Selected.Cam.Shake);
Screen.Selected.Cam.Rotation = strength * (PerlinNoise.GetPerlin((float)Timing.TotalTime * 0.01f, (float)Timing.TotalTime * 0.05f) - 0.5f);
Level.Loaded.Renderer.ChromaticAberrationStrength = value * 50.0f;
}
}
}
/// <summary>
/// Can be used to set camera shake from status effects
/// </summary>
public float CameraShake
{
get { return Screen.Selected?.Cam?.Shake ?? 0.0f; }
set
{
if (!MathUtils.IsValid(value)) { return; }
if (Screen.Selected?.Cam != null)
{
Screen.Selected.Cam.Shake = value;
}
}
}
private readonly List<ParticleEmitter> bloodEmitters = new List<ParticleEmitter>();
public IEnumerable<ParticleEmitter> BloodEmitters
{
@@ -907,7 +943,7 @@ namespace Barotrauma
{
name += " " + TextManager.Get("Disguised");
}
else if (Info.Title != null)
else if (Info.Title != null && TeamID != CharacterTeamType.Team1)
{
name += '\n' + Info.Title;
}
@@ -965,14 +1001,31 @@ namespace Barotrauma
}
if (IsDead) { return; }
if (CharacterHealth.DisplayedVitality < MaxVitality * 0.98f && hudInfoVisible)
var healthBarMode = GameMain.NetworkMember?.ServerSettings.ShowEnemyHealthBars ?? GameSettings.CurrentConfig.ShowEnemyHealthBars;
if (healthBarMode != EnemyHealthBarMode.ShowAll)
{
if (Controlled == null)
{
if (!IsOnPlayerTeam) { return; }
}
else
{
if (!HumanAIController.IsFriendly(Controlled, this) ||
(AIController is HumanAIController humanAi && humanAi.ObjectiveManager.CurrentObjective is AIObjectiveCombat combatObjective && HumanAIController.IsFriendly(Controlled, combatObjective.Enemy)))
{
return;
}
}
}
if (Params.ShowHealthBar && CharacterHealth.DisplayedVitality < MaxVitality * 0.98f && hudInfoVisible)
{
hudInfoAlpha = Math.Max(hudInfoAlpha, Math.Min(CharacterHealth.DamageOverlayTimer, 1.0f));
Vector2 healthBarPos = new Vector2(pos.X - 50, -pos.Y);
GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f),
CharacterHealth.DisplayedVitality / MaxVitality,
CharacterHealth.DisplayedVitality / MaxVitality,
Color.Lerp(GUIStyle.Red, GUIStyle.Green, CharacterHealth.DisplayedVitality / MaxVitality) * 0.8f * hudInfoAlpha,
new Color(0.5f, 0.57f, 0.6f, 1.0f) * hudInfoAlpha);
}
@@ -1,6 +1,5 @@
using Barotrauma.Extensions;
using Barotrauma.Items.Components;
using Barotrauma.Tutorials;
using FarseerPhysics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -14,9 +13,8 @@ namespace Barotrauma
{
const float BossHealthBarDuration = 120.0f;
class BossHealthBar
abstract class BossProgressBar
{
public readonly Character Character;
public float FadeTimer;
public readonly GUIComponent TopContainer;
@@ -25,9 +23,14 @@ namespace Barotrauma
public readonly GUIProgressBar TopHealthBar;
public readonly GUIProgressBar SideHealthBar;
public BossHealthBar(Character character)
public abstract bool Completed { get; }
public abstract bool Interrupted { get; }
public abstract float State { get; }
public BossProgressBar(LocalizedString label)
{
Character = character;
FadeTimer = BossHealthBarDuration;
TopContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.18f, 0.03f), HUDFrame.RectTransform, Anchor.TopCenter)
@@ -35,7 +38,7 @@ namespace Barotrauma
MinSize = new Point(100, 50),
RelativeOffset = new Vector2(0.0f, 0.01f)
}, isHorizontal: false, childAnchor: Anchor.TopCenter);
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), TopContainer.RectTransform), character.DisplayName, textAlignment: Alignment.Center, textColor: GUIStyle.Red);
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), TopContainer.RectTransform), label, textAlignment: Alignment.Center, textColor: GUIStyle.Red);
TopHealthBar = new GUIProgressBar(new RectTransform(new Vector2(1.0f, 0.6f), TopContainer.RectTransform)
{
MinSize = new Point(100, HUDLayoutSettings.HealthBarArea.Size.Y)
@@ -48,7 +51,7 @@ namespace Barotrauma
{
MinSize = new Point(80, 60)
}, isHorizontal: false, childAnchor: Anchor.TopRight);
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), SideContainer.RectTransform), character.DisplayName, textAlignment: Alignment.CenterRight, textColor: GUIStyle.Red);
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), SideContainer.RectTransform), label, textAlignment: Alignment.CenterRight, textColor: GUIStyle.Red);
SideHealthBar = new GUIProgressBar(new RectTransform(new Vector2(1.0f, 0.7f), SideContainer.RectTransform), barSize: 0.0f, style: "CharacterHealthBar")
{
Color = GUIStyle.Red
@@ -60,6 +63,50 @@ namespace Barotrauma
SideContainer.CanBeFocused = false;
SideContainer.Children.ForEach(c => c.CanBeFocused = false);
}
public abstract bool IsDuplicate(BossProgressBar progressBar);
}
class BossHealthBar : BossProgressBar
{
public readonly Character Character;
public override float State => Character.Vitality / Character.MaxVitality;
public override bool Completed => Character.IsDead;
public override bool Interrupted => Character.Removed || !Character.Enabled;
public BossHealthBar(Character character) : base(character.DisplayName)
{
Character = character;
}
public override bool IsDuplicate(BossProgressBar progressBar)
{
return progressBar is BossHealthBar bossHealthBar && bossHealthBar.Character == Character;
}
}
class MissionProgressBar : BossProgressBar
{
public readonly Mission Mission;
public override float State => Mission.State / (float)Mission.Prefab.MaxProgressState;
public override bool Completed => Mission.State >= Mission.Prefab.MaxProgressState;
public override bool Interrupted => Mission.Failed;
public MissionProgressBar(Mission mission) : base(mission.Prefab.ProgressBarLabel)
{
Mission = mission;
}
public override bool IsDuplicate(BossProgressBar progressBar)
{
return progressBar is MissionProgressBar missionProgressBar && missionProgressBar.Mission == Mission;
}
}
private static readonly Dictionary<ISpatialEntity, int> orderIndicatorCount = new Dictionary<ISpatialEntity, int>();
@@ -70,7 +117,7 @@ namespace Barotrauma
private static readonly List<Item> brokenItems = new List<Item>();
private static float brokenItemsCheckTimer;
private static readonly List<BossHealthBar> bossHealthBars = new List<BossHealthBar>();
private static readonly List<BossProgressBar> bossHealthBars = new List<BossProgressBar>();
private static readonly Dictionary<Identifier, LocalizedString> cachedHudTexts = new Dictionary<Identifier, LocalizedString>();
@@ -114,7 +161,7 @@ namespace Barotrauma
return
character?.Inventory != null &&
!character.Removed && !character.IsKnockedDown &&
(controller?.User != character || !controller.HideHUD) &&
(controller?.User != character || !controller.HideHUD || Screen.Selected.IsEditor) &&
!IsCampaignInterfaceOpen &&
!ConversationAction.FadeScreenToBlack;
}
@@ -159,7 +206,7 @@ namespace Barotrauma
public static void Update(float deltaTime, Character character, Camera cam)
{
UpdateBossHealthBars(deltaTime);
UpdateBossProgressBars(deltaTime);
if (GUI.DisableHUD)
{
@@ -307,7 +354,7 @@ namespace Barotrauma
{
if (!brokenItem.IsInteractable(character)) { continue; }
float alpha = GetDistanceBasedIconAlpha(brokenItem);
if (alpha <= 0.0f) continue;
if (alpha <= 0.0f) { continue; }
GUI.DrawIndicator(spriteBatch, brokenItem.DrawPosition, cam, 100.0f, GUIStyle.BrokenIcon.Value.Sprite,
Color.Lerp(GUIStyle.Red, GUIStyle.Orange * 0.5f, brokenItem.Condition / brokenItem.MaxCondition) * alpha);
}
@@ -548,7 +595,7 @@ namespace Barotrauma
if (CharacterHealth.OpenHealthWindow == character.SelectedCharacter.CharacterHealth)
{
character.SelectedCharacter.CharacterHealth.Alignment = Alignment.Left;
character.SelectedCharacter.CharacterHealth.DrawStatusHUD(spriteBatch);
//character.SelectedCharacter.CharacterHealth.DrawStatusHUD(spriteBatch);
}
}
else if (character.Inventory != null)
@@ -602,7 +649,9 @@ namespace Barotrauma
GUI.DrawString(spriteBatch, textPos, focusName, nameColor, Color.Black * 0.7f, 2, GUIStyle.SubHeadingFont, ForceUpperCase.No);
textPos.Y += GUIStyle.SubHeadingFont.MeasureString(focusName).Y;
if (character.FocusedCharacter.Info?.Title != null && !character.FocusedCharacter.Info.Title.IsNullOrEmpty())
if (character.FocusedCharacter.Info?.Title != null &&
!character.FocusedCharacter.Info.Title.IsNullOrEmpty() &&
character.FocusedCharacter.TeamID != CharacterTeamType.Team1)
{
GUI.DrawString(spriteBatch, textPos, character.FocusedCharacter.Info.Title, nameColor, Color.Black * 0.7f, 2, GUIStyle.SubHeadingFont, ForceUpperCase.No);
textPos.Y += GUIStyle.SubHeadingFont.MeasureString(character.FocusedCharacter.Info.Title.Value).Y;
@@ -640,20 +689,41 @@ namespace Barotrauma
}
}
public static void ShowBossHealthBar(Character character)
public static void ShowBossHealthBar(Character character, float damage)
{
if (character == null || character.IsDead || character.Removed) { return; }
AddBossProgressBar(new BossHealthBar(character), damage);
}
var existingBar = bossHealthBars.Find(b => b.Character == character);
if (existingBar != null)
public static void ShowMissionProgressBar(Mission mission)
{
if (mission == null || mission.Completed || mission.Failed) { return; }
AddBossProgressBar(new MissionProgressBar(mission));
}
private static void AddBossProgressBar(BossProgressBar progressBar, float damage = 0.0f)
{
var healthBarMode = GameMain.NetworkMember?.ServerSettings.ShowEnemyHealthBars ?? GameSettings.CurrentConfig.ShowEnemyHealthBars;
if (healthBarMode == EnemyHealthBarMode.HideAll)
{
existingBar.FadeTimer = BossHealthBarDuration;
return;
}
var existingBar = bossHealthBars.Find(b => b.IsDuplicate(progressBar));
if (existingBar != null)
{
existingBar.FadeTimer = BossHealthBarDuration;
if (damage > 0)
{
// Show the most recent target at the top of the screen
bossHealthBars.Remove(existingBar);
bossHealthBars.Add(existingBar);
}
return;
}
if (bossHealthBars.Count > 5)
{
BossHealthBar oldestHealthBar = bossHealthBars.First();
BossProgressBar oldestHealthBar = bossHealthBars.First();
foreach (var bar in bossHealthBars)
{
if (bar.TopHealthBar.BarSize < oldestHealthBar.TopHealthBar.BarSize)
@@ -663,54 +733,65 @@ namespace Barotrauma
}
oldestHealthBar.FadeTimer = Math.Min(oldestHealthBar.FadeTimer, 1.0f);
}
bossHealthBars.Add(new BossHealthBar(character));
bossHealthBars.Add(progressBar);
}
public static void UpdateBossHealthBars(float deltaTime)
public static void UpdateBossProgressBars(float deltaTime)
{
var healthBarMode = GameMain.NetworkMember?.ServerSettings.ShowEnemyHealthBars ?? GameSettings.CurrentConfig.ShowEnemyHealthBars;
for (int i = 0; i < bossHealthBars.Count; i++)
{
var bossHealthBar = bossHealthBars[i];
bool showTopBar = i == 0;
if (showTopBar != bossHealthBar.TopContainer.Visible)
bool showTopBar = i == bossHealthBars.Count - 1;
if (showTopBar && !bossHealthBar.TopContainer.Visible)
{
bossHealthContainer.Recalculate();
bossHealthBar.SideContainer.SetAsLastChild();
SetColor(bossHealthBar, bossHealthBar.SideContainer, 0);
}
bossHealthBar.TopContainer.Visible = showTopBar;
bossHealthBar.SideContainer.Visible = !bossHealthBar.TopContainer.Visible;
float health = bossHealthBar.Character.Vitality / bossHealthBar.Character.MaxVitality;
bossHealthBar.TopHealthBar.BarSize = bossHealthBar.SideHealthBar.BarSize = bossHealthBar.State;
float alpha = Math.Min(bossHealthBar.FadeTimer, 1.0f);
foreach (var c in bossHealthBar.SideContainer.GetAllChildren().Concat(bossHealthBar.TopContainer.GetAllChildren()))
if (bossHealthBar.TopContainer.Visible)
{
c.Color = new Color(c.Color, (byte)(alpha * 255));
if (c is GUITextBlock textBlock)
SetColor(bossHealthBar, bossHealthBar.TopContainer, alpha);
}
if (bossHealthBar.SideContainer.Visible)
{
SetColor(bossHealthBar, bossHealthBar.SideContainer, alpha);
}
static void SetColor(BossProgressBar bossHealthBar, GUIComponent container, float alpha)
{
foreach (var component in container.GetAllChildren())
{
textBlock.TextColor = new Color(bossHealthBar.Character.IsDead ? Color.Gray : textBlock.TextColor, (byte)(alpha * 255));
component.Color = new Color(component.Color, (byte)(alpha * 255));
if (component is GUITextBlock textBlock)
{
textBlock.TextColor = new Color(bossHealthBar.Completed ? Color.Gray : textBlock.TextColor, (byte)(alpha * 255));
}
}
}
bossHealthBar.TopHealthBar.BarSize = bossHealthBar.SideHealthBar.BarSize = health;
if (bossHealthBar.Character.Removed || !bossHealthBar.Character.Enabled)
if (bossHealthBar.Interrupted)
{
bossHealthBar.FadeTimer = Math.Min(bossHealthBar.FadeTimer, 1.0f);
}
else if (bossHealthBar.Character.IsDead)
else if (bossHealthBar.Completed)
{
bossHealthBar.FadeTimer = Math.Min(bossHealthBar.FadeTimer, 5.0f);
}
bossHealthBar.FadeTimer -= deltaTime;
}
for (int i = bossHealthBars.Count - 1; i >= 0 ; i--)
{
var bossHealthBar = bossHealthBars[i];
if (bossHealthBar.FadeTimer <= 0)
if (bossHealthBar.FadeTimer <= 0 || healthBarMode == EnemyHealthBarMode.HideAll)
{
bossHealthBar.SideContainer.Parent?.RemoveChild(bossHealthBar.SideContainer);
bossHealthBar.TopContainer.Parent?.RemoveChild(bossHealthBar.TopContainer);
@@ -78,7 +78,7 @@ namespace Barotrauma
Color? nameColor = null;
if (Job != null) { nameColor = Job.Prefab.UIColor; }
GUITextBlock characterNameBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), headerTextArea.RectTransform), ToolBox.LimitString(Name, GUIStyle.Font, headerTextArea.Rect.Width), textColor: nameColor, font: GUIStyle.Font)
GUITextBlock characterNameBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.25f), headerTextArea.RectTransform), ToolBox.LimitString(Name, GUIStyle.Font, headerTextArea.Rect.Width), textColor: nameColor, font: GUIStyle.Font)
{
ForceUpperCase = ForceUpperCase.Yes,
Padding = Vector4.Zero
@@ -92,8 +92,8 @@ namespace Barotrauma
}
if (Job != null)
{
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), headerTextArea.RectTransform), Job.Name, textColor: Job.Prefab.UIColor, font: font)
{
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.25f), headerTextArea.RectTransform), Job.Name, textColor: Job.Prefab.UIColor, font: font)
{
Padding = Vector4.Zero
};
@@ -101,7 +101,7 @@ namespace Barotrauma
if (PersonalityTrait != null)
{
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), headerTextArea.RectTransform),
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.25f), headerTextArea.RectTransform),
TextManager.AddPunctuation(':', TextManager.Get("PersonalityTrait"), PersonalityTrait.DisplayName),
font: font)
{
@@ -109,7 +109,23 @@ namespace Barotrauma
};
}
if (Job != null && (Character == null || !Character.IsDead))
GUIButton manageTalentButton = new GUIButton(new RectTransform(new Vector2(1.0f, 0.25f), headerTextArea.RectTransform),
text: TextManager.Get("ClientPermission.ManageBotTalents"), style: "GUIButtonSmall")
{
Enabled = false,
UserData = TalentMenu.ManageBotTalentsButtonUserData,
TextBlock =
{
AutoScaleHorizontal = true
}
};
if (TalentMenu.CanManageTalents(this))
{
manageTalentButton.Enabled = true;
}
if (Job != null && Character is not { IsDead: true })
{
var skillsArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.63f), paddedFrame.RectTransform, Anchor.BottomCenter, Pivot.BottomCenter))
{
@@ -120,7 +136,7 @@ namespace Barotrauma
skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level));
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), skillsArea.RectTransform), TextManager.AddPunctuation(':', TextManager.Get("skills"), string.Empty), font: font) { Padding = Vector4.Zero };
foreach (Skill skill in skills)
{
Color textColor = Color.White * (0.5f + skill.Level / 200.0f);
@@ -144,7 +160,7 @@ namespace Barotrauma
}
}
}
else if (Character != null && Character.IsDead)
else if (Character is { IsDead: true })
{
var deadArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.63f), paddedFrame.RectTransform, Anchor.BottomCenter, Pivot.BottomCenter))
{
@@ -524,25 +540,33 @@ namespace Barotrauma
string ragdollFile = inc.ReadString();
Identifier npcId = inc.ReadIdentifier();
Identifier factionId = inc.ReadIdentifier();
float minReputationToHire = 0.0f;
if (factionId != default)
{
minReputationToHire = inc.ReadSingle();
}
uint jobIdentifier = inc.ReadUInt32();
int variant = inc.ReadByte();
JobPrefab jobPrefab = null;
Dictionary<Identifier, float> skillLevels = new Dictionary<Identifier, float>();
if (jobIdentifier > 0)
{
{
jobPrefab = JobPrefab.Prefabs.Find(jp => jp.UintIdentifier == jobIdentifier);
foreach (SkillPrefab skillPrefab in jobPrefab.Skills.OrderBy(s => s.Identifier))
{
float skillLevel = inc.ReadSingle();
skillLevels.Add(skillPrefab.Identifier, skillLevel);
}
}
}
}
// TODO: animations
CharacterInfo ch = new CharacterInfo(speciesName, newName, originalName, jobPrefab, ragdollFile, variant, npcIdentifier: npcId)
{
ID = infoID
ID = infoID,
MinReputationToHire = (factionId, minReputationToHire)
};
ch.RecreateHead(tagSet.ToImmutableHashSet(), hairIndex, beardIndex, moustacheIndex, faceAttachmentIndex);
ch.Head.SkinColor = skinColor;
@@ -501,7 +501,7 @@ namespace Barotrauma
info?.ClearSavedStatValues(statType);
for (int i = 0; i < savedStatValueCount; i++)
{
string statIdentifier = msg.ReadString();
Identifier statIdentifier = msg.ReadIdentifier();
float statValue = msg.ReadSingle();
bool removeOnDeath = msg.ReadBoolean();
info?.ChangeSavedStatValue(statType, statValue, statIdentifier, removeOnDeath, setValue: true);
@@ -32,12 +32,6 @@ namespace Barotrauma
public static Sprite DamageOverlay => DamageOverlayPrefab.Prefabs.ActivePrefab.DamageOverlay;
private readonly static LocalizedString[] strengthTexts = new LocalizedString[]
{
TextManager.Get("AfflictionStrengthLow"),
TextManager.Get("AfflictionStrengthMedium"),
TextManager.Get("AfflictionStrengthHigh")
};
private Point screenResolution;
@@ -89,11 +83,23 @@ namespace Barotrauma
private int selectedLimbIndex = -1;
private LimbHealth currentDisplayedLimb;
/// <summary>
/// Container for the icons above the health bar
/// </summary>
private GUIComponent afflictionIconContainer;
private GUIButton showHiddenAfflictionsButton;
/// <summary>
/// Container for passive afflictions that have been hidden from afflictionIconContainer
/// </summary>
private GUIComponent hiddenAfflictionIconContainer;
private GUIProgressBar healthWindowHealthBar;
private GUIProgressBar healthWindowHealthBarShadow;
private GUITextBlock characterName;
private GUIListBox afflictionIconContainer;
private GUIListBox afflictionIconList;
private GUILayoutGroup treatmentLayout;
private GUIListBox recommendedTreatmentContainer;
@@ -331,7 +337,7 @@ namespace Barotrauma
deadIndicator.AutoScaleHorizontal = true;
}
afflictionIconContainer = new GUIListBox(new RectTransform(new Vector2(0.25f, 1.0f), characterIndicatorArea.RectTransform), style: null);
afflictionIconList = new GUIListBox(new RectTransform(new Vector2(0.25f, 1.0f), characterIndicatorArea.RectTransform), style: null);
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), healthWindowVerticalLayout.RectTransform),
TextManager.Get("SuitableTreatments"), font: GUIStyle.SubHeadingFont, textAlignment: Alignment.BottomCenter);
@@ -379,6 +385,25 @@ namespace Barotrauma
Enabled = true
};
afflictionIconContainer = new GUILayoutGroup(
HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.HealthBarAfflictionArea, GUI.Canvas),
isHorizontal: true, childAnchor: Anchor.CenterRight)
{
AbsoluteSpacing = GUI.IntScale(5)
};
showHiddenAfflictionsButton = new GUIButton(new RectTransform(new Point(afflictionIconContainer.Rect.Height), afflictionIconContainer.RectTransform), style: "GUIButtonCircular")
{
CanBeFocused = false
};
hiddenAfflictionIconContainer = new GUILayoutGroup(
HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.HealthBarAfflictionArea, GUI.Canvas),
isHorizontal: true, childAnchor: Anchor.CenterRight)
{
AbsoluteSpacing = GUI.IntScale(5)
};
UpdateAlignment();
SuicideButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.02f), GUI.Canvas, Anchor.TopCenter)
@@ -596,7 +621,7 @@ namespace Barotrauma
public void UpdateHUD(float deltaTime)
{
if (GUI.DisableHUD) return;
if (GUI.DisableHUD) { return; }
if (openHealthWindow != null)
{
if (openHealthWindow != Character.Controlled?.CharacterHealth && openHealthWindow != Character.Controlled?.SelectedCharacter?.CharacterHealth)
@@ -700,6 +725,8 @@ namespace Barotrauma
distortTimer = 0.0f;
}
UpdateStatusHUD(deltaTime);
if (PlayerInput.KeyHit(InputType.Health) && GUI.KeyboardDispatcher.Subscriber == null &&
Character.Controlled.AllowInput && !toggledThisFrame)
{
@@ -726,9 +753,9 @@ namespace Barotrauma
OpenHealthWindow = null;
}
foreach (GUIComponent afflictionIcon in afflictionIconContainer.Content.Children)
foreach (GUIComponent afflictionIcon in afflictionIconList.Content.Children)
{
if (!(afflictionIcon.UserData is Affliction affliction)) { continue; }
if (afflictionIcon.UserData is not Affliction affliction) { continue; }
if (affliction.AppliedAsFailedTreatmentTime > Timing.TotalTime - 1.0 && afflictionIcon.FlashTimer <= 0.0f)
{
afflictionIcon.Flash(GUIStyle.Red);
@@ -900,7 +927,7 @@ namespace Barotrauma
healthBarHolder.CanBeFocused = healthBar.CanBeFocused = healthBarShadow.CanBeFocused = !Character.ShouldLockHud();
if (Character.AllowInput && UseHealthWindow && !Character.DisableHealthWindow && healthBar.Enabled && healthBar.CanBeFocused &&
(GUI.IsMouseOn(healthBar) || highlightedAfflictionIcon != null) && Inventory.SelectedSlot == null)
(GUI.IsMouseOn(healthBar) || GUI.MouseOn?.UserData is AfflictionPrefab) && Inventory.SelectedSlot == null)
{
healthBar.State = GUIComponent.ComponentState.Hover;
if (PlayerInput.PrimaryMouseButtonClicked())
@@ -960,7 +987,12 @@ namespace Barotrauma
}
else if (Character.Controlled == Character && !CharacterHUD.IsCampaignInterfaceOpen)
{
healthBarHolder.AddToGUIUpdateList();
healthBarHolder.AddToGUIUpdateList();
afflictionIconContainer.AddToGUIUpdateList();
if (hiddenAfflictionIconContainer.Visible)
{
hiddenAfflictionIconContainer.AddToGUIUpdateList();
}
}
if (SuicideButton.Visible && Character == Character.Controlled)
{
@@ -989,7 +1021,7 @@ namespace Barotrauma
if (affliction.Prefab.AfflictionOverlay != null)
{
Sprite ScreenAfflictionOverlay = affliction.Prefab.AfflictionOverlay;
ScreenAfflictionOverlay?.Draw(spriteBatch, Vector2.Zero, Color.White * (affliction.GetAfflictionOverlayMultiplier()), Vector2.Zero, 0.0f,
ScreenAfflictionOverlay?.Draw(spriteBatch, Vector2.Zero, Color.White * affliction.GetAfflictionOverlayMultiplier(), Vector2.Zero, 0.0f,
new Vector2(GameMain.GraphicsWidth / DamageOverlay.size.X, GameMain.GraphicsHeight / DamageOverlay.size.Y));
}
}
@@ -1021,94 +1053,134 @@ namespace Barotrauma
// If manning a turret the portrait doesn't get rendered so we push the health bar to remove the empty gap
healthBarHolder.RectTransform.ScreenSpaceOffset = Character.ShouldLockHud() ? new Point(0, HUDLayoutSettings.PortraitArea.Height) : Point.Zero;
}
DrawStatusHUD(spriteBatch);
}
private (Affliction Affliction, LocalizedString NameToolTip)? highlightedAfflictionIcon = null;
public void DrawStatusHUD(SpriteBatch spriteBatch)
//private (Affliction Affliction, LocalizedString NameToolTip)? highlightedAfflictionIcon = null;
private readonly List<Affliction> statusIcons = new List<Affliction>();
private readonly Dictionary<AfflictionPrefab, float> statusIconVisibleTime = new Dictionary<AfflictionPrefab, float>();
private const float HideStatusIconDelay = 5.0f;
public void UpdateStatusHUD(float deltaTime)
{
highlightedAfflictionIcon = null;
//Rectangle interactArea = healthBar.Rect;
if (Character.Controlled?.SelectedCharacter == null && openHealthWindow == null)
{
var statusIcons = new List<(Affliction Affliction, LocalizedString Warning)>();
statusIcons.Clear();
if (Character.InPressure)
{
statusIcons.Add((pressureAffliction, TextManager.Get("PressureHUDWarning")));
statusIcons.Add(pressureAffliction);
}
if (Character.CurrentHull != null && Character.OxygenAvailable < LowOxygenThreshold && oxygenLowAffliction.Strength < oxygenLowAffliction.Prefab.ShowIconThreshold)
{
statusIcons.Add((oxygenLowAffliction, TextManager.Get("OxygenHUDWarning")));
statusIcons.Add(oxygenLowAffliction);
}
foreach (Affliction affliction in currentDisplayedAfflictions)
{
statusIcons.Add((affliction, affliction.Prefab.Name));
statusIcons.Add(affliction);
}
Vector2 highlightedIconPos = Vector2.Zero;
Rectangle afflictionArea = HUDLayoutSettings.AfflictionAreaLeft;
// Push the icons down since the portrait doesn't get rendered
int spacing = GUI.IntScale(10);
if (Character.ShouldLockHud())
{
afflictionArea.Y += HUDLayoutSettings.PortraitArea.Height;
// Push the icons down since the portrait doesn't get rendered
afflictionIconContainer.RectTransform.ScreenSpaceOffset = new Point(0, HUDLayoutSettings.PortraitArea.Height);
hiddenAfflictionIconContainer.RectTransform.ScreenSpaceOffset = new Point(0, -hiddenAfflictionIconContainer.Rect.Height - spacing + HUDLayoutSettings.PortraitArea.Height);
}
else
{
afflictionIconContainer.RectTransform.ScreenSpaceOffset = new Point(0, 0);
hiddenAfflictionIconContainer.RectTransform.ScreenSpaceOffset = new Point(0, -hiddenAfflictionIconContainer.Rect.Height - spacing);
}
//remove affliction icons for afflictions that no longer exist
bool horizontal = afflictionArea.Width > afflictionArea.Height;
int iconSize = horizontal ? afflictionArea.Height : afflictionArea.Width;
Point pos = new Point(afflictionArea.Right - iconSize, afflictionArea.Top);
RemoveNonExistentIcons(afflictionIconContainer);
RemoveNonExistentIcons(hiddenAfflictionIconContainer);
void RemoveNonExistentIcons(GUIComponent container)
{
for (int i = container.CountChildren - 1; i >= 0; i--)
{
var child = container.GetChild(i);
if (child.UserData is not AfflictionPrefab afflictionPrefab) { continue; }
if (!statusIcons.Any(s => s.Prefab == afflictionPrefab))
{
container.RemoveChild(child);
statusIconVisibleTime.Remove(afflictionPrefab);
}
}
}
foreach (var statusIcon in statusIcons)
{
Affliction affliction = statusIcon.Affliction;
Affliction affliction = statusIcon;
AfflictionPrefab afflictionPrefab = affliction.Prefab;
Rectangle afflictionIconRect = new Rectangle(pos, new Point(iconSize));
if (afflictionIconRect.Contains(PlayerInput.MousePosition) && !Character.ShouldLockHud() && GUI.MouseOn == null)
if (!statusIconVisibleTime.ContainsKey(afflictionPrefab)) { statusIconVisibleTime.Add(afflictionPrefab, 0.0f); }
statusIconVisibleTime[afflictionPrefab] += deltaTime;
var matchingIcon =
afflictionIconContainer.GetChildByUserData(afflictionPrefab) ??
hiddenAfflictionIconContainer.GetChildByUserData(afflictionPrefab);
if (matchingIcon == null)
{
highlightedAfflictionIcon = statusIcon;
highlightedIconPos = afflictionIconRect.Location.ToVector2();
matchingIcon = new GUIButton(new RectTransform(new Point(afflictionIconContainer.Rect.Height), afflictionIconContainer.RectTransform), style: null)
{
UserData = afflictionPrefab,
ToolTip = affliction.Prefab.Name,
CanBeSelected = false
};
if (affliction == pressureAffliction)
{
matchingIcon.ToolTip = TextManager.Get("PressureHUDWarning");
}
else if (affliction == pressureAffliction)
{
matchingIcon.ToolTip = TextManager.Get("OxygenHUDWarning");
}
new GUIImage(new RectTransform(Vector2.One, matchingIcon.RectTransform, Anchor.BottomCenter), afflictionPrefab.Icon, scaleToFit: true)
{
CanBeFocused = false
};
}
if (affliction.DamagePerSecond > 1.0f)
if (afflictionPrefab.HideIconAfterDelay && statusIconVisibleTime[afflictionPrefab] > HideStatusIconDelay)
{
Rectangle glowRect = afflictionIconRect;
glowRect.Inflate((int)(20 * GUI.Scale), (int)(20 * GUI.Scale));
var glow = GUIStyle.GetComponentStyle("OuterGlowCircular");
glow.Sprites[GUIComponent.ComponentState.None][0].Draw(
spriteBatch, glowRect,
GUIStyle.Red * (float)((Math.Sin(affliction.DamagePerSecondTimer * MathHelper.TwoPi - MathHelper.PiOver2) + 1.0f) * 0.5f));
matchingIcon.RectTransform.Parent = hiddenAfflictionIconContainer.RectTransform;
}
var image = matchingIcon.GetChild<GUIImage>();
image.Color = GetAfflictionIconColor(afflictionPrefab, affliction);
image.HoverColor = Color.Lerp(image.Color, Color.White, 0.5f);
float alphaMultiplier = highlightedAfflictionIcon == statusIcon ? 1f : 0.8f;
afflictionPrefab.Icon?.Draw(spriteBatch,
pos.ToVector2(),
/*highlightedIcon == statusIcon ? statusIcon.First.Prefab.IconColor : statusIcon.First.Prefab.IconColor * 0.8f,*/ // OLD IMPLEMENTATION
GetAfflictionIconColor(afflictionPrefab, affliction) * alphaMultiplier,
rotate: 0,
scale: iconSize / afflictionPrefab.Icon.size.X);
if (horizontal)
pos.X -= iconSize + (int)(5 * GUI.Scale);
else
pos.Y += iconSize + (int)(5 * GUI.Scale);
if (affliction.DamagePerSecond > 1.0f && matchingIcon.FlashTimer <= 0.0f)
{
matchingIcon.Flash(useCircularFlash: true, flashDuration: 1.5f, flashRectInflate: Vector2.One * 15.0f * GUI.Scale);
image.Pulsate(Vector2.One, Vector2.One * 1.2f, 1.0f);
}
}
if (highlightedAfflictionIcon != null)
afflictionIconContainer.RectTransform.SortChildren((r1, r2) =>
{
LocalizedString nameTooltip = highlightedAfflictionIcon.Value.NameToolTip;
Vector2 offset = GUIStyle.Font.MeasureString(nameTooltip);
if (r1.GUIComponent.UserData is not AfflictionPrefab prefab1) { return -1; }
if (r2.GUIComponent.UserData is not AfflictionPrefab prefab2) { return 1; }
var index1 = statusIcons.IndexOf(s => s.Prefab == prefab1);
var index2 = statusIcons.IndexOf(s => s.Prefab == prefab2);
return index1.CompareTo(index2);
});
(afflictionIconContainer as GUILayoutGroup).NeedsToRecalculate = true;
GUI.DrawString(spriteBatch,
alignment == Alignment.Left ? highlightedIconPos + offset : highlightedIconPos - offset,
nameTooltip,
Color.White * 0.8f, Color.Black * 0.5f);
Rectangle hiddenAfflictionHoverArea = showHiddenAfflictionsButton.Rect;
foreach (GUIComponent child in hiddenAfflictionIconContainer.Children)
{
hiddenAfflictionHoverArea = Rectangle.Union(hiddenAfflictionHoverArea, child.Rect);
}
afflictionIconContainer.Visible = true;
hiddenAfflictionIconContainer.Visible =
showHiddenAfflictionsButton.Rect.Contains(PlayerInput.MousePosition) ||
(hiddenAfflictionIconContainer.Visible && hiddenAfflictionHoverArea.Contains(PlayerInput.MousePosition));
showHiddenAfflictionsButton.Visible = hiddenAfflictionIconContainer.CountChildren > 0;
showHiddenAfflictionsButton.IgnoreLayoutGroups = !showHiddenAfflictionsButton.Visible;
showHiddenAfflictionsButton.Text = $"+{hiddenAfflictionIconContainer.CountChildren}";
if (Vitality > 0.0f)
{
float currHealth = healthBar.BarSize;
@@ -1126,6 +1198,7 @@ namespace Barotrauma
}
else
{
afflictionIconContainer.Visible = hiddenAfflictionIconContainer.Visible = false;
if (Vitality > 0.0f)
{
float currHealth = healthWindowHealthBar.BarSize;
@@ -1150,18 +1223,20 @@ namespace Barotrauma
public static Color GetAfflictionIconColor(AfflictionPrefab prefab, float afflictionStrength)
{
//use sqrt to make the color change rapidly when strength is low
//(low strength is where seeing the severity of the affliction makes more difference - at high strengths the character is already unconscious or dead)
float colorT = MathF.Sqrt(afflictionStrength / prefab.MaxStrength);
// No specific colors, use generic
if (prefab.IconColors == null)
{
if (prefab.IsBuff)
{
return ToolBox.GradientLerp(afflictionStrength / prefab.MaxStrength, GUIStyle.BuffColorLow, GUIStyle.BuffColorMedium, GUIStyle.BuffColorHigh);
return ToolBox.GradientLerp(colorT, GUIStyle.BuffColorLow, GUIStyle.BuffColorMedium, GUIStyle.BuffColorHigh);
}
return ToolBox.GradientLerp(afflictionStrength / prefab.MaxStrength, GUIStyle.DebuffColorLow, GUIStyle.DebuffColorMedium, GUIStyle.DebuffColorHigh);
return ToolBox.GradientLerp(colorT, GUIStyle.DebuffColorLow, GUIStyle.DebuffColorMedium, GUIStyle.DebuffColorHigh);
}
return ToolBox.GradientLerp(afflictionStrength / prefab.MaxStrength, prefab.IconColors);
return ToolBox.GradientLerp(colorT, prefab.IconColors);
}
public static Color GetAfflictionIconColor(Affliction affliction) => GetAfflictionIconColor(affliction.Prefab, affliction);
@@ -1172,7 +1247,7 @@ namespace Barotrauma
{
if (selectedLimb == null)
{
afflictionIconContainer.Content.ClearChildren();
afflictionIconList.Content.ClearChildren();
return;
}
@@ -1207,7 +1282,7 @@ namespace Barotrauma
private void CreateAfflictionInfos(IEnumerable<Affliction> afflictions)
{
afflictionIconContainer.ClearChildren();
afflictionIconList.ClearChildren();
displayedAfflictions.Clear();
Affliction mostSevereAffliction = SortAfflictionsBySeverity(afflictions, excludeBuffs: false).FirstOrDefault();
@@ -1217,7 +1292,7 @@ namespace Barotrauma
{
displayedAfflictions.Add((affliction, affliction.Strength));
var frame = new GUIButton(new RectTransform(new Vector2(1.0f, 0.25f), afflictionIconContainer.Content.RectTransform), style: "ListBoxElement")
var frame = new GUIButton(new RectTransform(new Vector2(1.0f, 0.25f), afflictionIconList.Content.RectTransform), style: "ListBoxElement")
{
UserData = affliction,
OnClicked = SelectAffliction
@@ -1275,7 +1350,7 @@ namespace Barotrauma
}
buttonToSelect?.OnClicked(buttonToSelect, buttonToSelect.UserData);
afflictionIconContainer.RecalculateChildren();
afflictionIconList.RecalculateChildren();
}
private void CreateRecommendedTreatments()
@@ -1386,7 +1461,7 @@ namespace Barotrauma
recommendedTreatmentContainer.RecalculateChildren();
afflictionIconContainer.Content.RectTransform.SortChildren((r1, r2) =>
afflictionIconList.Content.RectTransform.SortChildren((r1, r2) =>
{
var first = r1.GUIComponent.UserData as Affliction;
var second = r2.GUIComponent.UserData as Affliction;
@@ -1437,7 +1512,10 @@ namespace Barotrauma
};
var description = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), parent.RectTransform),
affliction.Prefab.Description, textAlignment: Alignment.TopLeft, wrap: true)
affliction.Prefab.GetDescription(
affliction.Strength,
Character == Character.Controlled ? AfflictionPrefab.Description.TargetType.Self : AfflictionPrefab.Description.TargetType.OtherCharacter),
textAlignment: Alignment.TopLeft, wrap: true)
{
CanBeFocused = false
};
@@ -1449,8 +1527,7 @@ namespace Barotrauma
Point nameDims = new Point(afflictionName.Rect.Width, (int)(GUIStyle.LargeFont.Size * 1.5f));
afflictionStrength.Text = strengthTexts[
MathHelper.Clamp((int)Math.Floor((affliction.Strength / affliction.Prefab.MaxStrength) * strengthTexts.Length), 0, strengthTexts.Length - 1)];
afflictionStrength.Text = affliction.GetStrengthText();
Vector2 strengthDims = GUIStyle.SubHeadingFont.MeasureString(afflictionStrength.Text);
@@ -1482,10 +1559,9 @@ namespace Barotrauma
private bool SelectAffliction(GUIButton button, object userData)
{
bool selected = button.Selected;
foreach (var child in afflictionIconContainer.Content.Children)
foreach (var child in afflictionIconList.Content.Children)
{
GUIButton btn = child.GetChild<GUIButton>();
if (btn != null)
if (child is GUIButton btn)
{
btn.Selected = btn == button && !selected;
}
@@ -1516,7 +1592,7 @@ namespace Barotrauma
afflictionEffectColor = GUIStyle.Green;
}
var child = afflictionIconContainer.Content.FindChild(affliction);
var child = afflictionIconList.Content.FindChild(affliction);
var afflictionStrengthPredictionBar = child.GetChild<GUILayoutGroup>().GetChildByUserData("afflictionstrengthprediction") as GUIProgressBar;
afflictionStrengthPredictionBar.BarSize = 0.0f;
@@ -1581,8 +1657,7 @@ namespace Barotrauma
var strengthText = labelContainer.GetChildByUserData("strength") as GUITextBlock;
strengthText.Text = strengthTexts[
MathHelper.Clamp((int)Math.Floor((affliction.Strength / affliction.Prefab.MaxStrength) * strengthTexts.Length), 0, strengthTexts.Length - 1)];
strengthText.Text = affliction.GetStrengthText();
strengthText.TextColor = Color.Lerp(GUIStyle.Orange, GUIStyle.Red,
affliction.Strength / affliction.Prefab.MaxStrength);
@@ -1836,14 +1911,14 @@ namespace Barotrauma
i++;
}
if (selectedLimbIndex > -1 && afflictionIconContainer.Content.CountChildren > 0)
if (selectedLimbIndex > -1 && afflictionIconList.Content.CountChildren > 0)
{
LimbHealth limbHealth = limbHealths[selectedLimbIndex];
if (limbHealth?.IndicatorSprite != null)
{
Rectangle selectedLimbArea = GetLimbHighlightArea(limbHealth, drawArea);
GUI.DrawLine(spriteBatch,
new Vector2(afflictionIconContainer.Rect.X, afflictionIconContainer.Rect.Y),
new Vector2(afflictionIconList.Rect.X, afflictionIconList.Rect.Y),
selectedLimbArea.Center.ToVector2(),
Color.LightGray * 0.5f, width: 4);
}
@@ -600,7 +600,7 @@ namespace Barotrauma
{
if (damageModifier.DamageMultiplier > 0 && !string.IsNullOrWhiteSpace(damageModifier.DamageParticle))
{
overrideParticle = GameMain.ParticleManager?.FindPrefab(damageModifier.DamageParticle);
overrideParticle = ParticleManager.FindPrefab(damageModifier.DamageParticle);
break;
}
}
@@ -647,7 +647,7 @@ namespace Barotrauma
dripParticleTimer += wetTimer * deltaTime * Mass * (wetTimer > 0.9f ? 50.0f : 5.0f);
if (dripParticleTimer > 1.0f)
{
float dropRadius = body.BodyShape == PhysicsBody.Shape.Rectangle ? Math.Min(body.width, body.height) : body.radius;
float dropRadius = body.BodyShape == PhysicsBody.Shape.Rectangle ? Math.Min(body.Width, body.Height) : body.Radius;
GameMain.ParticleManager.CreateParticle(
"waterdrop",
WorldPosition + Rand.Vector(Rand.Range(0.0f, ConvertUnits.ToDisplayUnits(dropRadius))),
@@ -684,10 +684,10 @@ namespace Barotrauma
public void Draw(SpriteBatch spriteBatch, Camera cam, Color? overrideColor = null, bool disableDeformations = false)
{
float brightness = Math.Max(1.0f - burnOverLayStrength, 0.2f);
var spriteParams = Params.GetSprite();
if (spriteParams == null) { return; }
float burn = spriteParams.IgnoreTint ? 0 : burnOverLayStrength;
float brightness = Math.Max(1.0f - burn, 0.2f);
Color clr = spriteParams.Color;
if (!spriteParams.IgnoreTint)
{