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
@@ -832,7 +832,7 @@ namespace Barotrauma.Items.Components
public float FabricationDegreeOfSuccess(Character character, ImmutableArray<Skill> skills)
{
if (skills.Length == 0) { return 1.0f; }
if (skills.Length == 0) { return 0.5f; }
if (character == null) { return 0.0f; }
float minDegreeOfSuccess = 1.0f;
@@ -0,0 +1,46 @@
using Barotrauma.Extensions;
using System;
using System.Collections.Generic;
namespace Barotrauma.Items.Components
{
/// <summary>
/// Makes the item inherit the condition from a linked wall or multiple - or in other words, makes it essentially treat the health of the wall as its own health.
/// The wall section with the most damage determines the condition (i.e. the item will be fully broken if there's at least one fully broken wall section).
/// </summary>
class InheritConditionFromLinkedWall(Item item, ContentXElement element) : ItemComponent(item, element)
{
private readonly List<Structure> linkedWalls = [];
public override void OnMapLoaded()
{
foreach (var linkedTo in item.linkedTo)
{
if (linkedTo is Structure structure &&
structure.HasBody)
{
linkedWalls.Add(structure);
structure.OnHealthChanged += (_, _) => UpdateCondition();
}
}
if (linkedWalls.None())
{
DebugConsole.AddWarning($"The item {item.Name} ({item.Prefab.Identifier}) is not linked to any walls with a physics body. The {nameof(InheritConditionFromLinkedWall)} component will do nothing.");
}
}
private void UpdateCondition()
{
float lowestHealthPercent = 1.0f;
foreach (var wall in linkedWalls)
{
foreach (var section in wall.Sections)
{
lowestHealthPercent = Math.Min(lowestHealthPercent, 1.0f - section.damage / wall.MaxHealth);
}
}
item.Condition = item.MaxCondition * lowestHealthPercent;
}
}
}
@@ -136,6 +136,7 @@ namespace Barotrauma.Items.Components
item.CurrentHull.GetLinkedHulls(linkedHulls, includeHiddenHulls: true);
foreach (var linkedHull in linkedHulls)
{
if (linkedHull == item.CurrentHull) { continue; }
hullWaterVolume += linkedHull.WaterVolume;
totalHullVolume += linkedHull.Volume;
}
@@ -148,7 +149,7 @@ namespace Barotrauma.Items.Components
if (!IsActive || Disabled) { return; }
if (flowPercentage <= 0f && item.CurrentHull.WaterVolume <= 0f) { return; }
float powerFactor = Math.Min(currPowerConsumption <= 0.0f || MinVoltage <= 0.0f ? 1.0f : Voltage, MaxOverVoltageFactor);
float powerFactor = Math.Min(PowerConsumption <= 0.0f || MinVoltage <= 0.0f ? 1.0f : Voltage, MaxOverVoltageFactor);
currFlow = flowPercentage / 100.0f * MaxFlow * powerFactor;
if (item.GetComponent<Repairable>() is { IsTinkering: true } repairable)
@@ -247,9 +247,13 @@ namespace Barotrauma.Items.Components
}
}
bool fissionRateControlledBySignals = signalControlledTargetFissionRate.HasValue && lastReceivedFissionRateSignalTime > Timing.TotalTime - 1;
bool turbineOutputRateControlledBySignals = signalControlledTargetTurbineOutput.HasValue && lastReceivedTurbineOutputSignalTime > Timing.TotalTime - 1;
//rapidly adjust the reactor in the first few seconds of the round to prevent overvoltages if the load changed between rounds
//(unless the reactor is being operated by a player)
if (GameMain.GameSession is { RoundDuration: <5 } && lastUser is not { IsPlayer: true })
if (GameMain.GameSession is { RoundDuration: < 5 } && lastUser is not { IsPlayer: true } && PowerOn && AutoTemp &&
!fissionRateControlledBySignals && !turbineOutputRateControlledBySignals)
{
UpdateAutoTemp(100.0f, (float)(Timing.Step * 10.0f));
}
@@ -263,7 +267,7 @@ namespace Barotrauma.Items.Components
float maxPowerOut = GetMaxOutput();
if (signalControlledTargetFissionRate.HasValue && lastReceivedFissionRateSignalTime > Timing.TotalTime - 1)
if (fissionRateControlledBySignals)
{
TargetFissionRate = adjustValueWithoutOverShooting(TargetFissionRate, signalControlledTargetFissionRate.Value, deltaTime * 5.0f);
#if CLIENT
@@ -274,7 +278,7 @@ namespace Barotrauma.Items.Components
{
signalControlledTargetFissionRate = null;
}
if (signalControlledTargetTurbineOutput.HasValue && lastReceivedTurbineOutputSignalTime > Timing.TotalTime - 1)
if (turbineOutputRateControlledBySignals)
{
TargetTurbineOutput = adjustValueWithoutOverShooting(TargetTurbineOutput, signalControlledTargetTurbineOutput.Value, deltaTime * 5.0f);
#if CLIENT