Release 1.11.4.1 (Winter Update)

This commit is contained in:
Markus Isberg
2025-12-08 14:56:47 +00:00
parent 21e34e5cd8
commit 598966f200
121 changed files with 1614 additions and 819 deletions
@@ -9,7 +9,7 @@ namespace Barotrauma
{
public override void DebugDraw(SpriteBatch spriteBatch)
{
if (Character.IsUnconscious || !Character.Enabled || !Enabled) { return; }
if (Character.IsUnconscious || !Character.Enabled || !Enabled || Screen.Selected?.Cam is { Zoom: < 0.4f }) { return; }
Vector2 pos = Character.DrawPosition;
pos.Y = -pos.Y;
@@ -11,7 +11,7 @@ namespace Barotrauma
public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
{
if (Character == Character.Controlled) { return; }
if (!DebugAI) { return; }
if (!DebugAI || Screen.Selected?.Cam is { Zoom: < 0.4f }) { return; }
Vector2 pos = Character.DrawPosition;
pos.Y = -pos.Y;
Vector2 textOffset = new Vector2(-40, -160);
@@ -35,11 +35,7 @@ namespace Barotrauma
CharacterStateInfo serverPos = character.MemState.Last();
if (!character.isSynced)
{
SetPosition(serverPos.Position, lerp: false);
Collider.LinearVelocity = Vector2.Zero;
character.MemLocalState.Clear();
character.LastNetworkUpdateID = serverPos.ID;
character.isSynced = true;
SyncPosition(serverPos);
return;
}
@@ -198,11 +194,7 @@ namespace Barotrauma
if (!character.isSynced)
{
SetPosition(serverPos.Position, lerp: false);
Collider.LinearVelocity = Vector2.Zero;
character.MemLocalState.Clear();
character.LastNetworkUpdateID = serverPos.ID;
character.isSynced = true;
SyncPosition(serverPos);
return;
}
@@ -319,6 +311,15 @@ namespace Barotrauma
if (character.MemLocalState.Count > 120) { character.MemLocalState.RemoveRange(0, character.MemLocalState.Count - 120); }
character.MemState.Clear();
}
void SyncPosition(CharacterStateInfo serverPos)
{
SetPosition(serverPos.Position, lerp: false);
Collider.LinearVelocity = Vector2.Zero;
character.MemLocalState.Clear();
character.LastNetworkUpdateID = serverPos.ID;
character.isSynced = true;
}
}
/// <summary>
@@ -657,7 +658,7 @@ namespace Barotrauma
public void DebugDraw(SpriteBatch spriteBatch)
{
if (!GameMain.DebugDraw || !character.Enabled) { return; }
if (!GameMain.DebugDraw || !character.Enabled || Screen.Selected?.Cam is { Zoom: < 0.2f }) { return; }
if (simplePhysicsEnabled) { return; }
foreach (Limb limb in Limbs)
@@ -54,15 +54,29 @@ namespace Barotrauma
get { return controlled; }
set
{
if (controlled == value) return;
if ((!(controlled is null)) && (!(Screen.Selected?.Cam is null)) && value is null)
if (controlled == value && controlled == null)
{
Screen.Selected.Cam.TargetPos = Vector2.Zero;
Lights.LightManager.ViewTarget = null;
// Return early, but only when setting the controlled to null, because on controlling a character, we'll want to ensure that the target is both enabled and unfrozen.
return;
}
if (controlled != value)
{
CharacterHealth.OpenHealthWindow = null;
if (controlled != null && value == null)
{
if (Screen.Selected?.Cam is Camera camera)
{
camera.TargetPos = Vector2.Zero;;
}
Lights.LightManager.ViewTarget = null;
}
}
controlled = value;
if (controlled != null) controlled.Enabled = true;
CharacterHealth.OpenHealthWindow = null;
if (controlled != null)
{
controlled.Enabled = true;
controlled.AnimController.Frozen = false;
}
}
}
@@ -442,7 +456,7 @@ namespace Barotrauma
{
cam.OffsetAmount = targetOffsetAmount = maxOffset;
}
else if (SelectedItem != null && ViewTarget == null &&
else if (SelectedItem != null && ViewTarget == null && !IsIncapacitated &&
SelectedItem.Components.Any(ic => ic?.GuiFrame != null && ic.ShouldDrawHUD(this)))
{
cam.OffsetAmount = targetOffsetAmount = 0.0f;
@@ -456,7 +470,7 @@ namespace Barotrauma
}
else if (Lights.LightManager.ViewTarget == this)
{
if (GUI.PauseMenuOpen || IsUnconscious)
if (GUI.PauseMenuOpen || IsIncapacitated)
{
if (deltaTime > 0.0f)
{
@@ -23,8 +23,8 @@ namespace Barotrauma
memState.Clear();
return;
}
//freeze AI characters if more than x seconds have passed since last update from the server
//freeze other characters (than the controlled) if more than x seconds have passed since last update from the server
if (lastRecvPositionUpdateTime < Lidgren.Network.NetTime.Now - NetConfig.FreezeCharacterIfPositionDataMissingDelay)
{
AnimController.Frozen = true;
@@ -104,6 +104,8 @@ namespace Barotrauma
private GUILayoutGroup treatmentLayout;
private GUIListBox recommendedTreatmentContainer;
private LocalizedString prevHighlightedAfflictionDescription;
/// <summary>
/// Timer for updating visuals (limb tints and overlays) caused by the affliction
/// </summary>
@@ -120,7 +122,7 @@ namespace Barotrauma
private float updateDisplayedAfflictionsTimer;
private const float UpdateDisplayedAfflictionsInterval = 0.5f;
private List<Affliction> currentDisplayedAfflictions = new List<Affliction>();
private readonly List<Affliction> currentDisplayedAfflictions = new List<Affliction>();
public float DisplayedVitality, DisplayVitalityDelay;
@@ -662,7 +664,8 @@ namespace Barotrauma
else
{
forceAfflictionContainerUpdate = true;
currentDisplayedAfflictions = GetAllAfflictions(mergeSameAfflictions: true, predicate: a => a.ShouldShowIcon(Character) && a.Prefab.Icon != null);
currentDisplayedAfflictions.Clear();
currentDisplayedAfflictions.AddRange(GetAllAfflictions(mergeSameAfflictions: true, predicate: a => a.ShouldShowIcon(Character) && a.Prefab.Icon != null));
currentDisplayedAfflictions.Sort((a1, a2) =>
{
int dmgPerSecond = Math.Sign(a1.DamagePerSecond - a2.DamagePerSecond);
@@ -1165,7 +1168,6 @@ namespace Barotrauma
statusIconVisibleTime[afflictionPrefab] += deltaTime;
Color color = GetAfflictionIconColor(afflictionPrefab, affliction);
var matchingIcon =
afflictionIconContainer.GetChildByUserData(afflictionPrefab) ??
hiddenAfflictionIconContainer.GetChildByUserData(afflictionPrefab);
@@ -1177,9 +1179,20 @@ namespace Barotrauma
ToolTip = $"‖color:{color.ToStringHex()}‖{affliction.Prefab.Name}‖color:end‖",
CanBeSelected = false
};
new GUIImage(new RectTransform(Vector2.One, matchingIcon.RectTransform, Anchor.BottomCenter), afflictionPrefab.Icon, scaleToFit: true)
{
CanBeFocused = false
};
}
if (afflictionPrefab.HideIconAfterDelay && statusIconVisibleTime[afflictionPrefab] > HideStatusIconDelay)
{
matchingIcon.RectTransform.Parent = hiddenAfflictionIconContainer.RectTransform;
}
else
{
if (affliction.Prefab.ShowDescriptionInTooltip)
{
matchingIcon.ToolTip = matchingIcon.ToolTip + "\n" + affliction.Prefab.GetDescription(affliction.Strength, AfflictionPrefab.Description.TargetType.Self);
matchingIcon.ToolTip = $"‖color:{color.ToStringHex()}‖{affliction.Prefab.Name}‖color:end‖" + "\n" + affliction.Prefab.GetDescription(affliction.Strength, AfflictionPrefab.Description.TargetType.Self);
}
if (affliction == pressureAffliction)
{
@@ -1191,14 +1204,6 @@ namespace Barotrauma
}
matchingIcon.ToolTip = RichString.Rich(matchingIcon.ToolTip);
new GUIImage(new RectTransform(Vector2.One, matchingIcon.RectTransform, Anchor.BottomCenter), afflictionPrefab.Icon, scaleToFit: true)
{
CanBeFocused = false
};
}
if (afflictionPrefab.HideIconAfterDelay && statusIconVisibleTime[afflictionPrefab] > HideStatusIconDelay)
{
matchingIcon.RectTransform.Parent = hiddenAfflictionIconContainer.RectTransform;
}
var image = matchingIcon.GetChild<GUIImage>();
image.Color = color;
@@ -1574,12 +1579,14 @@ namespace Barotrauma
CanBeFocused = false
};
prevHighlightedAfflictionDescription = affliction.Prefab.GetDescription(
affliction.Strength,
Character == Character.Controlled ? AfflictionPrefab.Description.TargetType.Self : AfflictionPrefab.Description.TargetType.OtherCharacter);
var description = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), parent.RectTransform),
RichString.Rich(affliction.Prefab.GetDescription(
affliction.Strength,
Character == Character.Controlled ? AfflictionPrefab.Description.TargetType.Self : AfflictionPrefab.Description.TargetType.OtherCharacter)),
RichString.Rich(prevHighlightedAfflictionDescription),
textAlignment: Alignment.TopLeft, wrap: true)
{
UserData = "description",
CanBeFocused = false
};
@@ -1724,7 +1731,6 @@ namespace Barotrauma
var labelContainer = parent.GetChildByUserData("label");
var strengthText = labelContainer.GetChildByUserData("strength") as GUITextBlock;
strengthText.Text = affliction.GetStrengthText();
strengthText.TextColor = Color.Lerp(GUIStyle.Orange, GUIStyle.Red,
@@ -1743,6 +1749,19 @@ namespace Barotrauma
vitalityText.TextColor = vitalityDecrease <= 0 ? GUIStyle.Green :
Color.Lerp(GUIStyle.Orange, GUIStyle.Red, affliction.Strength / affliction.Prefab.MaxStrength);
}
var newDescription =
affliction.Prefab.GetDescription(
affliction.Strength,
Character == Character.Controlled ? AfflictionPrefab.Description.TargetType.Self : AfflictionPrefab.Description.TargetType.OtherCharacter);
if (newDescription != prevHighlightedAfflictionDescription)
{
if (parent.GetChildByUserData("description") is GUITextBlock descriptionText)
{
descriptionText.Text = RichString.Rich(newDescription);
}
prevHighlightedAfflictionDescription = newDescription;
}
}
public bool OnItemDropped(Item item, bool ignoreMousePos)