0.15.21.0

This commit is contained in:
Markus Isberg
2021-12-16 01:05:43 +09:00
parent 617d9ede88
commit 7d43cb1e91
74 changed files with 487 additions and 541 deletions
@@ -1155,7 +1155,7 @@ namespace Barotrauma
if (afflictionsDirty())
{
var currentAfflictions = afflictions.Where(a => a.Value == selectedLimb && a.Key.ShouldShowIcon(Character)).Select(a => a.Key);
var currentAfflictions = afflictions.Where(a => ShouldDisplayAfflictionOnLimb(a, selectedLimb)).Select(a => a.Key);
CreateAfflictionInfos(currentAfflictions);
CreateRecommendedTreatments();
}
@@ -1170,7 +1170,7 @@ namespace Barotrauma
//not displaying one of the current afflictions -> dirty
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
{
if (kvp.Value != selectedLimb || !kvp.Key.ShouldShowIcon(Character)) { continue; }
if (!ShouldDisplayAfflictionOnLimb(kvp, selectedLimb)) { continue; }
if (!displayedAfflictions.Any(d => d.affliction == kvp.Key)) { return true; }
}
//displaying an affliction we no longer have -> dirty
@@ -1187,7 +1187,7 @@ namespace Barotrauma
afflictionIconContainer.ClearChildren();
displayedAfflictions.Clear();
Affliction mostSevereAffliction = SortAfflictionsBySeverity(afflictions).FirstOrDefault();
Affliction mostSevereAffliction = SortAfflictionsBySeverity(afflictions, excludeBuffs: false).FirstOrDefault();
GUIButton buttonToSelect = null;
foreach (Affliction affliction in afflictions)
@@ -1779,25 +1779,10 @@ namespace Barotrauma
i = 0;
foreach (LimbHealth limbHealth in limbHealths)
{
bool shouldDisplayAffliction(KeyValuePair<Affliction, LimbHealth> kvp, LimbHealth limbHealth)
{
if (!kvp.Key.ShouldShowIcon(Character)) { return false; }
if (kvp.Value == limbHealth)
{
return true;
}
else if (kvp.Value == null)
{
Limb indicatorLimb = Character.AnimController.GetLimb(kvp.Key.Prefab.IndicatorLimb);
return indicatorLimb != null && indicatorLimb.HealthIndex == i;
}
return false;
}
afflictionsDisplayedOnLimb.Clear();
foreach (var affliction in afflictions)
{
if (shouldDisplayAffliction(affliction, limbHealth)) { afflictionsDisplayedOnLimb.Add(affliction.Key); }
if (ShouldDisplayAfflictionOnLimb(affliction, limbHealth)) { afflictionsDisplayedOnLimb.Add(affliction.Key); }
}
if (!afflictionsDisplayedOnLimb.Any()) { i++; continue; }
@@ -1839,6 +1824,22 @@ namespace Barotrauma
}
}
private bool ShouldDisplayAfflictionOnLimb(KeyValuePair<Affliction, LimbHealth> kvp, LimbHealth limbHealth)
{
if (!kvp.Key.ShouldShowIcon(Character)) { return false; }
if (kvp.Value == limbHealth)
{
return true;
}
else if (kvp.Value == null)
{
Limb indicatorLimb = Character.AnimController.GetLimb(kvp.Key.Prefab.IndicatorLimb);
return indicatorLimb != null && indicatorLimb.HealthIndex == limbHealths.IndexOf(limbHealth);
}
return false;
}
private void DrawLimbAfflictionIcon(SpriteBatch spriteBatch, Affliction affliction, float iconScale, ref Vector2 iconPos)
{
if (!affliction.ShouldShowIcon(Character) || affliction.Prefab.Icon == null) { return; }
@@ -438,7 +438,7 @@ namespace Barotrauma
Color.White, Color.Black * 0.5f, 0, SmallFont);
DrawString(spriteBatch, new Vector2(10, 40),
$"Bodies: {GameMain.World.BodyList.Count} ({GameMain.World.BodyList.FindAll(b => b.Awake && b.Enabled).Count} awake, {GameMain.World.BodyList.FindAll(b => b.Awake && b.BodyType == BodyType.Dynamic && b.Enabled).Count} dynamic)",
$"Bodies: {GameMain.World.BodyList.Count} ({GameMain.World.BodyList.Count(b => b != null && b.Awake && b.Enabled)} awake, {GameMain.World.BodyList.Count(b => b != null && b.Awake && b.BodyType == BodyType.Dynamic && b.Enabled)} dynamic)",
Color.White, Color.Black * 0.5f, 0, SmallFont);
if (Screen.Selected.Cam != null)
@@ -476,7 +476,9 @@ namespace Barotrauma
DebugConsole.Log("Selected content packages: " + string.Join(", ", Config.AllEnabledPackages.Select(cp => cp.Name)));
}
#if !DEBUG
GameAnalyticsManager.InitIfConsented();
#endif
yield return CoroutineStatus.Running;
@@ -535,6 +535,9 @@ namespace Barotrauma
return false;
}
};
#if DEBUG
statisticsTickBox.Enabled = false;
#endif
void updateGATickBoxToolTip()
=> statisticsTickBox.ToolTip = TextManager.Get($"GameAnalyticsStatus.{GameAnalyticsManager.UserConsented}");
updateGATickBoxToolTip();
@@ -38,9 +38,9 @@ namespace Barotrauma.Items.Components
private bool qteSuccess;
private float qteTimer;
private const float qteTime = 0.5f;
private const float QteDuration = 0.5f;
private float qteCooldown;
private const float qteCooldownTime = 0.5f;
private const float QteCooldownDuration = 0.5f;
public float FakeBrokenTimer;
@@ -155,7 +155,7 @@ namespace Barotrauma.Items.Components
IgnoreLayoutGroups = true
};
qteTimer = qteTime;
qteTimer = QteDuration;
repairButtonText = TextManager.Get("RepairButton");
repairingText = TextManager.Get("Repairing");
@@ -276,14 +276,13 @@ namespace Barotrauma.Items.Components
qteCooldown -= deltaTime;
if (qteCooldown <= 0.0f)
{
qteTimer = qteTime;
qteTimer = QteDuration;
}
}
else
{
qteTimer -= deltaTime * (qteTimer / qteTime);
if (qteTimer < 0.0f) qteTimer = qteTime;
qteTimer -= deltaTime * (qteTimer / QteDuration);
if (qteTimer < 0.0f) { qteTimer = QteDuration; }
}
}
else
@@ -307,11 +306,11 @@ namespace Barotrauma.Items.Components
if (qteCooldown > 0.0f)
{
qteSliderColor = qteSuccess ? GUI.Style.Green : GUI.Style.Red * 0.5f;
progressBar.Color = ToolBox.GradientLerp(qteCooldown / qteCooldownTime, progressBar.Color, qteSliderColor, Color.White);
progressBar.Color = ToolBox.GradientLerp(qteCooldown / QteCooldownDuration, progressBar.Color, qteSliderColor, Color.White);
}
else
{
if (qteTimer / qteTime <= item.Condition / item.MaxCondition)
if (qteTimer / QteDuration <= item.Condition / item.MaxCondition)
{
qteSliderColor = Color.Lerp(qteSliderColor, GUI.Style.Green, 0.5f);
}
@@ -319,7 +318,7 @@ namespace Barotrauma.Items.Components
progressBar.Parent.Parent.Parent.DrawManually(spriteBatch, true);
GUI.DrawRectangle(spriteBatch,
new Rectangle(sliderRect.X + (int)((qteTimer / qteTime) * sliderRect.Width), sliderRect.Y - 5, 2, sliderRect.Height + 10),
new Rectangle(sliderRect.X + (int)((qteTimer / QteDuration) * sliderRect.Width), sliderRect.Y - 5, 2, sliderRect.Height + 10),
qteSliderColor, true);
if (item.Condition > defaultMaxCondition)
@@ -341,7 +340,7 @@ namespace Barotrauma.Items.Components
SabotageButton.Visible = character.IsTraitor;
SabotageButton.IgnoreLayoutGroups = !SabotageButton.Visible;
SabotageButton.Enabled = (currentFixerAction == FixActions.None || (CurrentFixer == character && currentFixerAction != FixActions.Sabotage)) && character.IsTraitor && IsBelowRepairThreshold;
SabotageButton.Enabled = (currentFixerAction == FixActions.None || (CurrentFixer == character && currentFixerAction != FixActions.Sabotage)) && character.IsTraitor && item.ConditionPercentage > MinSabotageCondition;
SabotageButton.Text = (currentFixerAction == FixActions.None || CurrentFixer != character || currentFixerAction != FixActions.Sabotage || !character.IsTraitor) ?
sabotageButtonText :
sabotagingText + new string('.', ((int)(Timing.TotalTime * 2.0f) % 3) + 1);
@@ -408,7 +407,8 @@ namespace Barotrauma.Items.Components
{
if (currentFixerAction == FixActions.Repair)
{
qteSuccess = qteCooldown <= 0.0f && qteTimer / qteTime <= item.Condition / item.MaxCondition;
float defaultMaxCondition = item.MaxCondition / item.MaxRepairConditionMultiplier;
qteSuccess = qteCooldown <= 0.0f && qteTimer / QteDuration <= item.Condition / defaultMaxCondition;
}
else
{
@@ -420,8 +420,8 @@ namespace Barotrauma.Items.Components
SoundPlayer.PlayUISound(qteSuccess ? GUISoundType.IncreaseQuantity : GUISoundType.DecreaseQuantity);
//on failure during cooldown reset cursor to beginning
if (!qteSuccess && qteCooldown > 0.0f) { qteTimer = qteTime; }
qteCooldown = qteCooldownTime;
if (!qteSuccess && qteCooldown > 0.0f) { qteTimer = QteDuration; }
qteCooldown = QteCooldownDuration;
//this will be set on button down so we can reset it here
requestStartFixAction = FixActions.None;
item.CreateClientEvent(this);
@@ -438,7 +438,11 @@ namespace Barotrauma.Items.Components
currentFixerAction = (FixActions)msg.ReadRangedInteger(0, 2);
CurrentFixer = currentFixerID != 0 ? Entity.FindEntityByID(currentFixerID) as Character : null;
item.MaxRepairConditionMultiplier = GetMaxRepairConditionMultiplier(CurrentFixer);
repairBoost = msg.ReadSingle();
if (CurrentFixer == null)
{
qteTimer = QteDuration;
qteCooldown = 0.0f;
}
}
public void ClientWrite(IWriteMessage msg, object[] extraData = null)
@@ -314,7 +314,7 @@ namespace Barotrauma
}
}
string colorStr = XMLExtensions.ColorToString(!item.AllowStealing ? GUI.Style.Red : Color.White);
string colorStr = XMLExtensions.ColorToString(item.SpawnedInCurrentOutpost && !item.AllowStealing ? GUI.Style.Red : Color.White);
toolTip = $"‖color:{colorStr}‖{name}‖color:end‖";
if (item.GetComponent<Quality>() != null)
@@ -648,12 +648,18 @@ namespace Barotrauma
if (linkedTo.Contains(otherEntity))
{
linkedTo.Remove(otherEntity);
if (otherEntity.linkedTo != null && otherEntity.linkedTo.Contains(this)) otherEntity.linkedTo.Remove(this);
if (otherEntity.linkedTo != null && otherEntity.linkedTo.Contains(this))
{
otherEntity.linkedTo.Remove(this);
}
}
else
{
linkedTo.Add(otherEntity);
if (otherEntity.Linkable && otherEntity.linkedTo != null) otherEntity.linkedTo.Add(this);
if (otherEntity.Linkable && otherEntity.linkedTo != null)
{
otherEntity.linkedTo.Add(this);
}
}
}
}
@@ -1470,6 +1470,7 @@ namespace Barotrauma.Networking
serverSettings.AllowFriendlyFire = inc.ReadBoolean();
serverSettings.LockAllDefaultWires = inc.ReadBoolean();
serverSettings.AllowRagdollButton = inc.ReadBoolean();
serverSettings.AllowLinkingWifiToChat = inc.ReadBoolean();
GameMain.NetLobbyScreen.UsingShuttle = inc.ReadBoolean();
GameMain.LightManager.LosMode = (LosMode)inc.ReadByte();
bool includesFinalize = inc.ReadBoolean(); inc.ReadPadBits();
@@ -92,9 +92,8 @@ namespace Barotrauma.Networking
}
}
public void ClientAdminRead(IReadMessage incMsg, NetFlags requiredFlags)
public void ClientAdminRead(IReadMessage incMsg)
{
if (!requiredFlags.HasFlag(NetFlags.Properties)) { return; }
int count = incMsg.ReadUInt16();
for (int i = 0; i < count; i++)
{
@@ -162,7 +161,7 @@ namespace Barotrauma.Networking
incMsg.ReadPadBits();
if (isAdmin)
{
ClientAdminRead(incMsg, requiredFlags);
ClientAdminRead(incMsg);
}
}
@@ -17,7 +17,11 @@ namespace Barotrauma
allowSubVoting = value;
GameMain.NetLobbyScreen.SubList.Enabled = value ||
(GameMain.Client != null && GameMain.Client.HasPermission(ClientPermissions.SelectSub));
GameMain.NetLobbyScreen.Frame.FindChild("subvotes", true).Visible = value;
var subVotesLabel = GameMain.NetLobbyScreen.Frame.FindChild("subvotes", true) as GUITextBlock;
subVotesLabel.Visible = value;
var subVisButton = GameMain.NetLobbyScreen.SubVisibilityButton;
subVisButton.RectTransform.AbsoluteOffset
= new Point(value ? (int)(subVotesLabel.TextSize.X + subVisButton.Rect.Width) : 0, 0);
UpdateVoteTexts(null, VoteType.Sub);
GameMain.NetLobbyScreen.SubList.Deselect();
@@ -827,7 +827,8 @@ namespace Barotrauma
TextManager.Get("Votes"), textAlignment: Alignment.CenterRight)
{
UserData = "subvotes",
Visible = false
Visible = false,
CanBeFocused = false
};
//respawn shuttle / submarine preview ------------------------------------------------------------------
@@ -3435,9 +3436,12 @@ namespace Barotrauma
public readonly string Hash;
public FailedSubInfo(string name, string hash) { Name = name; Hash = hash; }
public void Deconstruct(out string name, out string hash) { name = Name; hash = Hash; }
private static bool StringsEqual(string a, string b)
=> string.Equals(a, b, StringComparison.OrdinalIgnoreCase);
public static bool operator ==(FailedSubInfo a, FailedSubInfo b)
=> a.Name.Equals(b.Name, StringComparison.OrdinalIgnoreCase)
&& a.Hash.Equals(b.Hash, StringComparison.OrdinalIgnoreCase);
=> StringsEqual(a.Name, b.Name) && StringsEqual(a.Hash, b.Hash);
public static bool operator !=(FailedSubInfo a, FailedSubInfo b)
=> !(a == b);
}