v1.4.4.1 (Blood in the Water Update)

This commit is contained in:
Regalis11
2024-04-24 18:09:05 +03:00
parent 89b91d1c3e
commit ff1b8951a7
397 changed files with 15250 additions and 6479 deletions
@@ -57,7 +57,7 @@ namespace Barotrauma.Items.Components
RelativeSpacing = 0.08f
};
new GUITextBlock(new RectTransform(new Vector2(1f, 0.07f), paddedFrame.RectTransform) { MinSize = new Point(0, GUI.IntScale(25)) }, item.Name, font: GUIStyle.SubHeadingFont)
new GUITextBlock(new RectTransform(new Vector2(1f, 0.07f), paddedFrame.RectTransform) { MinSize = new Point(0, GUI.IntScale(25)) }, item.Prefab.Name, font: GUIStyle.SubHeadingFont)
{
TextAlignment = Alignment.Center,
AutoScaleHorizontal = true
@@ -341,7 +341,7 @@ namespace Barotrauma.Items.Components
GUIFrame itemFrame = new GUIFrame(new RectTransform(new Vector2(0.1f, 1f), parent.RectTransform), style: null)
{
UserData = identifier,
ToolTip = GetTooltip(prefab)
ToolTip = prefab.CreateTooltipText()
};
Sprite icon = prefab.InventoryIcon ?? prefab.Sprite;
@@ -372,21 +372,6 @@ namespace Barotrauma.Items.Components
textBlock.Text = TextManager.GetWithVariable("campaignstore.quantity", "[amount]", count.ToString());
}
static RichString GetTooltip(ItemPrefab prefab)
{
LocalizedString toolTip = $"‖color:{Color.White.ToStringHex()}‖{prefab.Name}‖color:end‖";
LocalizedString description = prefab.Description;
if (!description.IsNullOrEmpty()) { toolTip += '\n' + description; }
if (prefab.ContentPackage != GameMain.VanillaContent && prefab.ContentPackage != null)
{
toolTip += $"\n‖color:{Color.MediumPurple.ToStringHex()}‖{prefab.ContentPackage.Name}‖color:end‖";
}
return RichString.Rich(toolTip);
}
}
partial void OnItemLoadedProjSpecific()
@@ -134,11 +134,11 @@ namespace Barotrauma.Items.Components
spriteIndex += (force / 100.0f) * AnimSpeed * deltaTime;
if (spriteIndex < 0)
{
spriteIndex = propellerSprite.FrameCount;
spriteIndex = propellerSprite.FrameCount - Math.Abs(spriteIndex) % propellerSprite.FrameCount;
}
if (spriteIndex >= propellerSprite.FrameCount)
else
{
spriteIndex = 0.0f;
spriteIndex = spriteIndex % propellerSprite.FrameCount;
}
}
@@ -80,7 +80,7 @@ namespace Barotrauma.Items.Components
var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), GuiFrame.RectTransform, Anchor.Center), childAnchor: Anchor.TopCenter);
// === LABEL === //
new GUITextBlock(new RectTransform(new Vector2(1f, 0.05f), paddedFrame.RectTransform), item.Name, font: GUIStyle.SubHeadingFont)
new GUITextBlock(new RectTransform(new Vector2(1f, 0.05f), paddedFrame.RectTransform), item.Prefab.Name, font: GUIStyle.SubHeadingFont)
{
TextAlignment = Alignment.Center,
AutoScaleVertical = true
@@ -326,7 +326,7 @@ namespace Barotrauma.Items.Components
UserData = fi,
HoverColor = Color.Gold * 0.2f,
SelectedColor = Color.Gold * 0.5f,
ToolTip = fi.TargetItem.Description
ToolTip = RichString.Rich(fi.TargetItem.Description)
};
var container = new GUILayoutGroup(new RectTransform(Vector2.One, frame.RectTransform),
@@ -339,7 +339,7 @@ namespace Barotrauma.Items.Components
itemIcon, scaleToFit: true)
{
Color = fi.TargetItem.InventoryIconColor,
ToolTip = fi.TargetItem.Description
ToolTip = RichString.Rich(fi.TargetItem.Description)
};
}
@@ -347,7 +347,7 @@ namespace Barotrauma.Items.Components
{
Padding = Vector4.Zero,
AutoScaleVertical = true,
ToolTip = fi.TargetItem.Description
ToolTip = RichString.Rich(fi.TargetItem.Description)
};
new GUITextBlock(new RectTransform(new Vector2(0.85f, 1f), frame.RectTransform, Anchor.BottomRight),
@@ -925,8 +925,6 @@ namespace Barotrauma.Items.Components
nameBlock.Padding = new Vector4(0, nameBlock.Padding.Y, GUI.IntScale(5), nameBlock.Padding.W);
if (nameBlock.TextScale < 0.7f)
{
nameBlock.SetRichText(TextManager.GetWithVariable("itemname.quality" + (int)quality, "[itemname]", itemName)
.Fallback(TextManager.GetWithVariable("itemname.quality3", "[itemname]", itemName)));
nameBlock.AutoScaleHorizontal = false;
nameBlock.TextScale = 0.7f;
nameBlock.Wrap = true;
@@ -937,7 +935,7 @@ namespace Barotrauma.Items.Components
if (!selectedItem.TargetItem.Description.IsNullOrEmpty())
{
var description = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform),
selectedItem.TargetItem.Description,
RichString.Rich(selectedItem.TargetItem.Description),
font: GUIStyle.SmallFont, wrap: true);
description.Padding = new Vector4(0, description.Padding.Y, description.Padding.Z, description.Padding.W);
@@ -1090,7 +1090,12 @@ namespace Barotrauma.Items.Components
float totalVolume = 0.0f;
foreach (Hull linkedHull in hullData.LinkedHulls)
{
waterVolume += linkedHull.WaterVolume;
//water detector ignores very small amounts of water,
//do it here too so the nav terminal doesn't display the water
if (WaterDetector.GetWaterPercentage(linkedHull) > 0.0f)
{
waterVolume += linkedHull.WaterVolume;
}
totalVolume += linkedHull.Volume;
}
hullData.HullWaterAmount =
@@ -7,7 +7,7 @@ namespace Barotrauma.Items.Components
public override bool Select(Character character)
{
if (GameMain.GameSession?.Campaign == null)
if (GameMain.GameSession?.Campaign == null || !Level.IsLoadedFriendlyOutpost)
{
return false;
}
@@ -1446,7 +1446,7 @@ namespace Barotrauma.Items.Components
//only relevant in the end levels or maybe custom subs with some kind of non-hulled parts
Rectangle worldBorders = submarine.GetDockedBorders();
worldBorders.Location += submarine.WorldPosition.ToPoint();
if (Submarine.RectContains(worldBorders, pingSource))
if (Submarine.RectContains(worldBorders, pingSource) || submarine.Info.OutpostGenerationParams is { AlwaysShowStructuresOnSonar: true })
{
CreateBlipsForSubmarineWalls(submarine, pingSource, transducerPos, pingRadius, prevPingRadius, range, passive);
continue;
@@ -1502,7 +1502,9 @@ namespace Barotrauma.Items.Components
foreach (Voronoi2.GraphEdge edge in cell.Edges)
{
if (!edge.IsSolid) { continue; }
float cellDot = Vector2.Dot(cell.Center - pingSource, (edge.Center + cell.Translation) - cell.Center);
//the normal of the edge must be pointing towards the ping source to be visible
float cellDot = Vector2.Dot((edge.Center + cell.Translation) - pingSource, edge.GetNormal(cell));
if (cellDot > 0) { continue; }
float facingDot = Vector2.Dot(
@@ -1543,6 +1545,7 @@ namespace Barotrauma.Items.Components
{
if (c.AnimController.CurrentHull != null || !c.Enabled) { continue; }
if (!c.IsUnconscious && c.Params.HideInSonar) { continue; }
if (c.InDetectable) { continue; }
if (DetectSubmarineWalls && c.AnimController.CurrentHull == null && item.CurrentHull != null) { continue; }
if (c.AnimController.SimplePhysicsEnabled)
@@ -316,28 +316,28 @@ namespace Barotrauma.Items.Components
{
case 0:
leftText = TextManager.Get("DescentVelocity");
centerText = $"({TextManager.Get("KilometersPerHour")})";
centerText = TextManager.Get("KilometersPerHour");
rightTextGetter = () =>
{
Vector2 vel = controlledSub == null ? Vector2.Zero : controlledSub.Velocity;
var realWorldVel = ConvertUnits.ToDisplayUnits(vel.Y * Physics.DisplayToRealWorldRatio) * 3.6f;
return ((int)(-realWorldVel)).ToString();
return (-realWorldVel).ToString("0.0");
};
break;
case 1:
leftText = TextManager.Get("Velocity");
centerText = $"({TextManager.Get("KilometersPerHour")})";
centerText = TextManager.Get("KilometersPerHour");
rightTextGetter = () =>
{
Vector2 vel = controlledSub == null ? Vector2.Zero : controlledSub.Velocity;
var realWorldVel = ConvertUnits.ToDisplayUnits(vel.X * Physics.DisplayToRealWorldRatio) * 3.6f;
if (controlledSub != null && controlledSub.FlippedX) { realWorldVel *= -1; }
return ((int)realWorldVel).ToString();
return realWorldVel.ToString("0.0");
};
break;
case 2:
leftText = TextManager.Get("Depth");
centerText = $"({TextManager.Get("Meter")})";
centerText = TextManager.Get("Meter");
rightTextGetter = () =>
{
if (Level.Loaded is { IsEndBiome: true })
@@ -789,9 +789,9 @@ namespace Barotrauma.Items.Components
}
pressureWarningText.Visible = item.Submarine != null && Timing.TotalTime % 1.0f < 0.8f;
float depthEffectThreshold = 500.0f;
if (Level.Loaded != null && pressureWarningText.Visible &&
item.Submarine.RealWorldDepth > Level.Loaded.RealWorldCrushDepth - depthEffectThreshold && item.Submarine.RealWorldDepth > item.Submarine.RealWorldCrushDepth - depthEffectThreshold)
item.Submarine.RealWorldDepth > Level.Loaded.RealWorldCrushDepth - PressureWarningThreshold &&
item.Submarine.RealWorldDepth > item.Submarine.RealWorldCrushDepth - PressureWarningThreshold)
{
pressureWarningText.Visible = true;
pressureWarningText.Text =