v1.0.7.0 (Full Release)

This commit is contained in:
Regalis11
2023-03-13 10:30:37 +02:00
parent 2c5a7923b0
commit bf73ddb6c3
50 changed files with 504 additions and 193 deletions
@@ -85,7 +85,7 @@ namespace Barotrauma
}
}
public abstract bool IsDuplicate(BossProgressBar progressBar);
public abstract bool IsDuplicate(object targetObject);
}
class BossHealthBar : BossProgressBar
@@ -109,9 +109,9 @@ namespace Barotrauma
Character = character;
}
public override bool IsDuplicate(BossProgressBar progressBar)
public override bool IsDuplicate(object targetObject)
{
return progressBar is BossHealthBar bossHealthBar && bossHealthBar.Character == Character;
return targetObject is Character character && Character == character;
}
}
@@ -136,9 +136,9 @@ namespace Barotrauma
Mission = mission;
}
public override bool IsDuplicate(BossProgressBar progressBar)
public override bool IsDuplicate(object targetObject)
{
return progressBar is MissionProgressBar missionProgressBar && missionProgressBar.Mission == Mission;
return targetObject is Mission mission && Mission == mission;
}
}
@@ -150,7 +150,7 @@ namespace Barotrauma
private static readonly List<Item> brokenItems = new List<Item>();
private static float brokenItemsCheckTimer;
private static readonly List<BossProgressBar> bossHealthBars = new List<BossProgressBar>();
private static readonly List<BossProgressBar> bossProgressBars = new List<BossProgressBar>();
private static readonly Dictionary<Identifier, LocalizedString> cachedHudTexts = new Dictionary<Identifier, LocalizedString>();
@@ -747,44 +747,44 @@ namespace Barotrauma
public static void ShowBossHealthBar(Character character, float damage)
{
if (character == null || character.IsDead || character.Removed) { return; }
AddBossProgressBar(new BossHealthBar(character), damage);
if (bossProgressBars.Any(b => b.IsDuplicate(character))) { return; }
AddBossProgressBar(new BossHealthBar(character));
}
public static void ShowMissionProgressBar(Mission mission)
{
if (mission == null || mission.Completed || mission.Failed) { return; }
if (bossProgressBars.Any(b => b.IsDuplicate(mission))) { return; }
AddBossProgressBar(new MissionProgressBar(mission));
}
public static void ClearBossHealthBars()
public static void ClearBossProgressBars()
{
bossHealthBars.Clear();
for (int i = bossProgressBars.Count - 1; i>= 0; i--)
{
RemoveBossProgressBar(bossProgressBars[i]);
}
bossProgressBars.Clear();
}
private static void AddBossProgressBar(BossProgressBar progressBar, float damage = 0.0f)
private static void RemoveBossProgressBar(BossProgressBar progressBar)
{
progressBar.SideContainer.Parent?.RemoveChild(progressBar.SideContainer);
progressBar.TopContainer.Parent?.RemoveChild(progressBar.TopContainer);
bossProgressBars.Remove(progressBar);
}
private static void AddBossProgressBar(BossProgressBar progressBar)
{
var healthBarMode = GameMain.NetworkMember?.ServerSettings.ShowEnemyHealthBars ?? GameSettings.CurrentConfig.ShowEnemyHealthBars;
if (healthBarMode == EnemyHealthBarMode.HideAll)
{
return;
}
var existingBar = bossHealthBars.Find(b => b.IsDuplicate(progressBar));
if (existingBar != null)
if (bossProgressBars.Count > 5)
{
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)
{
BossProgressBar oldestHealthBar = bossHealthBars.First();
foreach (var bar in bossHealthBars)
BossProgressBar oldestHealthBar = bossProgressBars.First();
foreach (var bar in bossProgressBars)
{
if (bar.TopHealthBar.BarSize < oldestHealthBar.TopHealthBar.BarSize)
{
@@ -793,18 +793,18 @@ namespace Barotrauma
}
oldestHealthBar.FadeTimer = Math.Min(oldestHealthBar.FadeTimer, 1.0f);
}
bossHealthBars.Add(progressBar);
bossProgressBars.Add(progressBar);
}
public static void UpdateBossProgressBars(float deltaTime)
{
var healthBarMode = GameMain.NetworkMember?.ServerSettings.ShowEnemyHealthBars ?? GameSettings.CurrentConfig.ShowEnemyHealthBars;
for (int i = 0; i < bossHealthBars.Count; i++)
for (int i = 0; i < bossProgressBars.Count; i++)
{
var bossHealthBar = bossHealthBars[i];
var bossHealthBar = bossProgressBars[i];
bool showTopBar = i == bossHealthBars.Count - 1;
bool showTopBar = i == bossProgressBars.Count - 1;
if (showTopBar && !bossHealthBar.TopContainer.Visible)
{
bossHealthBar.SideContainer.SetAsLastChild();
@@ -848,14 +848,14 @@ namespace Barotrauma
}
bossHealthBar.FadeTimer -= deltaTime;
}
for (int i = bossHealthBars.Count - 1; i >= 0 ; i--)
for (int i = bossProgressBars.Count - 1; i >= 0 ; i--)
{
var bossHealthBar = bossHealthBars[i];
var bossHealthBar = bossProgressBars[i];
if (bossHealthBar.FadeTimer <= 0 || healthBarMode == EnemyHealthBarMode.HideAll)
{
bossHealthBar.SideContainer.Parent?.RemoveChild(bossHealthBar.SideContainer);
bossHealthBar.TopContainer.Parent?.RemoveChild(bossHealthBar.TopContainer);
bossHealthBars.RemoveAt(i);
bossProgressBars.RemoveAt(i);
bossHealthContainer.Recalculate();
}
}
@@ -578,7 +578,7 @@ namespace Barotrauma
ch.SetPersonalityTrait();
ch.Job?.OverrideSkills(skillLevels);
ch.ExperiencePoints = inc.ReadUInt16();
ch.ExperiencePoints = inc.ReadInt32();
ch.AdditionalTalentPoints = inc.ReadRangedInteger(0, MaxAdditionalTalentPoints);
return ch;
}
@@ -76,6 +76,7 @@ namespace Barotrauma
partial void UpdateProjSpecific()
{
if (boss == null || boss.Removed) { return; }
if (Phase is MissionPhase.Initial or MissionPhase.NoItemsDestroyed or MissionPhase.SomeItemsDestroyed)
{
// Put asleep.
@@ -611,10 +611,6 @@ namespace Barotrauma
GameMain.Client?.Draw(spriteBatch);
string factionWaterMark = "FACTION/ENDGAME TEST VERSION - please do not publicly share any material you see here!".ToUpper();
DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth / 2, 100 * yScale) - GUIStyle.SubHeadingFont.MeasureString(factionWaterMark) / 2, factionWaterMark,
GUIStyle.Red * 0.5f, font: GUIStyle.SubHeadingFont, backgroundColor: Color.Black * 0.5f, backgroundPadding: 10);
if (Character.Controlled?.Inventory != null)
{
if (Character.Controlled.Stun < 0.1f && !Character.Controlled.IsDead)
@@ -14,6 +14,13 @@ namespace Barotrauma.Items.Components
private CoroutineHandle resetPredictionCoroutine;
private float resetPredictionTimer;
/// <summary>
/// The current multiplier for the light color (usually equal to <see cref="lightBrightness"/>, but in the case of e.g. blinking lights the multiplier
/// doesn't go to 0 when the light turns off, because otherwise it'd take a while for it turn back on based on the lightBrightness which is interpolated
/// towards the current voltage).
/// </summary>
private float lightColorMultiplier;
public Vector2 DrawSize
{
get { return new Vector2(Light.Range * 2, Light.Range * 2); }
@@ -27,21 +34,14 @@ namespace Barotrauma.Items.Components
Light.Position = ParentBody != null ? ParentBody.Position : item.Position;
}
partial void SetLightSourceState(bool enabled, float? brightness)
partial void SetLightSourceState(bool enabled, float brightness)
{
if (Light == null) { return; }
Light.Enabled = enabled;
if (brightness.HasValue)
{
lightBrightness = brightness.Value;
}
else
{
lightBrightness = enabled ? 1.0f : 0.0f;
}
lightColorMultiplier = brightness;
if (enabled)
{
Light.Color = LightColor.Multiply(lightBrightness);
Light.Color = LightColor.Multiply(lightColorMultiplier);
}
}
@@ -328,19 +328,21 @@ namespace Barotrauma
case VoteType.PurchaseAndSwitchSub:
case VoteType.SwitchSub:
string subName2 = inc.ReadString();
var submarineInfo = GameMain.GameSession.OwnedSubmarines.FirstOrDefault(s => s.Name == subName2) ?? GameMain.Client.ServerSubmarines.FirstOrDefault(s => s.Name == subName2);
bool transferItems = inc.ReadBoolean();
if (submarineInfo == null)
if (GameMain.GameSession != null)
{
DebugConsole.ThrowError("Failed to find a matching submarine, vote aborted");
return;
var submarineInfo = GameMain.GameSession.OwnedSubmarines.FirstOrDefault(s => s.Name == subName2) ?? GameMain.Client.ServerSubmarines.FirstOrDefault(s => s.Name == subName2);
if (submarineInfo == null)
{
DebugConsole.ThrowError("Failed to find a matching submarine, vote aborted");
return;
}
submarineVoteInfo = new SubmarineVoteInfo(submarineInfo, transferItems);
}
submarineVoteInfo = new SubmarineVoteInfo(submarineInfo, transferItems);
break;
}
GameMain.Client.VotingInterface?.EndVote(passed, yesClientCount, noClientCount);
GameMain.Client.VotingInterface?.EndVote(passed, yesClientCount, noClientCount);
if (passed && submarineVoteInfo.SubmarineInfo is { } subInfo)
{
switch (voteType)
@@ -1043,7 +1043,15 @@ namespace Barotrauma
if (backgroundSprite == null)
{
#if UNSTABLE
backgroundSprite = new Sprite("Content/UnstableBackground.png", sourceRectangle: null);
#endif
if (GUIStyle.GetComponentStyle("MainMenuBackground") is { } mainMenuStyle &&
mainMenuStyle.Sprites.TryGetValue(GUIComponent.ComponentState.None, out var sprites))
{
backgroundSprite = sprites.GetRandomUnsynced()?.Sprite;
}
backgroundSprite ??= LocationType.Prefabs.GetRandomUnsynced()?.GetPortrait(0);
}
var vignette = GUIStyle.GetComponentStyle("mainmenuvignette")?.GetDefaultSprite();