Merge branch 'heads/upstream' into OBT/1.2.0(SpringUpdate)

This commit is contained in:
NotAlwaysTrue
2026-04-25 13:08:16 +08:00
420 changed files with 24089 additions and 11191 deletions
@@ -1,16 +1,17 @@
#nullable enable
using Barotrauma.Extensions;
using Barotrauma.IO;
using Barotrauma.Items.Components;
using Barotrauma.Networking;
using Barotrauma.PerkBehaviors;
using FarseerPhysics;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Xml.Linq;
using Barotrauma.Networking;
using Barotrauma.Extensions;
using Barotrauma.PerkBehaviors;
namespace Barotrauma
{
@@ -761,7 +762,6 @@ namespace Barotrauma
GUI.PreventPauseMenuToggle = false;
HintManager.OnRoundStarted();
GameMain.LuaCs.Hook.Call("roundStart");
EnableEventLogNotificationIcon(enabled: false);
LogStartRoundStats();
@@ -955,14 +955,6 @@ namespace Barotrauma
sub.SetPosition(spawnPos);
myPort.Dock(outPostPort);
myPort.Lock(isNetworkMessage: true, applyEffects: false);
foreach (var item in sub.GetItems(alsoFromConnectedSubs: true))
{
//need to refresh position to maintain since the sub was moved to the docking port
if (item.GetComponent<Steering>() is { MaintainPos: true } steering)
{
steering.RefreshPosToMaintain();
}
}
}
else
{
@@ -985,6 +977,16 @@ namespace Barotrauma
sub.EnableMaintainPosition();
}
foreach (var item in sub.GetItems(alsoFromConnectedSubs: true))
{
// Refresh pos to maintain in all steering components maintaining
// position, including ones in shuttles, since the submarines moved
if (item.GetComponent<Steering>() is { MaintainPos: true } steering)
{
steering.RefreshPosToMaintain();
}
}
// Make sure that linked subs which are NOT docked to the main sub
// (but still close enough to NOT be considered as 'left behind')
// are also moved to keep their relative position to the main sub
@@ -1048,9 +1050,6 @@ namespace Barotrauma
/// </remarks>
public static ImmutableHashSet<Character> GetSessionCrewCharacters(CharacterType type)
{
var result = GameMain.LuaCs.Hook.Call<Character[]?>("getSessionCrewCharacters", type);
if (result != null) return ImmutableHashSet.Create(result);
if (GameMain.GameSession?.CrewManager is not { } crewManager) { return ImmutableHashSet<Character>.Empty; }
IEnumerable<Character> players;
@@ -1089,9 +1088,6 @@ namespace Barotrauma
{
RoundEnding = true;
#if CLIENT
GameMain.LuaCs.Hook.Call("roundEnd");
#endif
//Clear the grids to allow for garbage collection
Powered.Grids.Clear();
Powered.ChangedConnections.Clear();
@@ -1103,15 +1099,13 @@ namespace Barotrauma
ImmutableHashSet<Character> crewCharacters = GetSessionCrewCharacters(CharacterType.Both);
int prevMoney = GetAmountOfMoney(crewCharacters);
EndMissions();
EndMissions(transitionType);
foreach (Character character in crewCharacters)
{
character.CheckTalents(AbilityEffectType.OnRoundEnd);
}
GameMain.LuaCs.Hook.Call("missionsEnded", missions);
#if CLIENT
if (GUI.PauseMenuOpen)
{
@@ -1208,12 +1202,12 @@ namespace Barotrauma
}
}
public void EndMissions()
public void EndMissions(CampaignMode.TransitionType transitionType)
{
ImmutableHashSet<Character> crewCharacters = GetSessionCrewCharacters(CharacterType.Both);
foreach (Mission mission in missions)
{
mission.End();
mission.End(transitionType);
}
if (missions.Any())