Track LocalMods as part of monolith

This commit is contained in:
2026-06-08 18:50:16 +03:00
parent 143f2fed7c
commit 1b214b44c2
1287 changed files with 139255 additions and 1 deletions
@@ -0,0 +1,14 @@
using Barotrauma;
using System;
using System.Collections.Generic;
using System.Text;
namespace MoreLevelContent.Missions
{
partial class BeaconConstMission : Mission
{
public override bool DisplayAsCompleted => State > 0;
public override bool DisplayAsFailed => false;
}
}
@@ -0,0 +1,20 @@
using Barotrauma;
using Barotrauma.Items.Components;
using Barotrauma.Networking;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoreLevelContent.Missions
{
// Client
internal partial class CablePuzzleMission : Mission
{
public override bool DisplayAsCompleted => State == 2;
public override bool DisplayAsFailed => false;
}
}
@@ -0,0 +1,24 @@
using Barotrauma;
using Barotrauma.Networking;
using MoreLevelContent.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoreLevelContent.Missions
{
// Client
partial class DistressEscortMission : DistressMission
{
public override bool DisplayAsFailed => State == 1;
public override void ClientReadInitial(IReadMessage msg)
{
base.ClientReadInitial(msg);
missionNPCs.Read(msg);
InitCharacters();
}
}
}
@@ -0,0 +1,100 @@
using Barotrauma;
using Barotrauma.Networking;
using MoreLevelContent.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace MoreLevelContent.Missions
{
partial class DistressGhostshipMission : DistressMission
{
private readonly Identifier EXPLORE_SUB = "MLCDISTRESS_GHOSTSHIP_EXPLORE_SUB";
private readonly Identifier SALVAGE_SUB = "MLCDISTRESS_GHOSTSHIP_SALVAGE";
public override bool DisplayAsFailed => false;
public override bool DisplayAsCompleted => State >= 2;
public override void ClientReadInitial(IReadMessage msg)
{
base.ClientReadInitial(msg);
Log.Debug("message read init");
missionNPCs.Read(msg);
}
public override RichString GetMissionRewardText(Submarine sub) => !SubSalvaged ? base.GetMissionRewardText(sub) : GetBaseMissionRewardText(sub);
private GhostshipState CurrentState = GhostshipState.WaitForBoardSub;
private ObjectiveManager.Segment ExploreSegment;
private List<Hull> HullToExplore = new();
private List<Hull> ExploredHulls = new();
private enum GhostshipState
{
WaitForBoardSub,
WaitForExplore,
WaitForSalvage,
Salvage
}
private bool _salvaged = false;
partial void UpdateProjSpecific(float deltaTime)
{
if (SubSalvaged && !_salvaged)
{
ObjectiveManager.CompleteSegment(SALVAGE_SUB);
_salvaged = true;
CoroutineManager.StartCoroutine(_showMessageBox(TextManager.Get("missionheader0.distress_ghostship"), TextManager.Get("dgs.inrageforsalvage")));
}
IEnumerable<CoroutineStatus> _showMessageBox(LocalizedString header, LocalizedString message)
{
while (GUIMessageBox.VisibleBox?.UserData is RoundSummary)
{
yield return new WaitForSeconds(1.0f);
}
CreateMessageBox(header, message);
yield return CoroutineStatus.Success;
}
switch (State)
{
case 2:
if (CurrentState == GhostshipState.WaitForSalvage)
{
return;
}
if (CurrentState == GhostshipState.WaitForExplore)
{
foreach (var crewMember in GameSession.GetSessionCrewCharacters(CharacterType.Player))
{
if (HullToExplore.Contains(crewMember.CurrentHull))
{
if (!ExploredHulls.Contains(crewMember.CurrentHull))
{
ExploredHulls.Add(crewMember.CurrentHull);
}
}
}
if (ExploredHulls.Count >= HullToExplore.Count / 2)
{
CurrentState = GhostshipState.WaitForSalvage;
ObjectiveManager.CompleteSegment(EXPLORE_SUB);
ObjectiveManager.TriggerSegment(ObjectiveManager.Segment.CreateObjectiveSegment(SALVAGE_SUB, "dgs.obj.optionalsalvage"));
}
return;
}
HullToExplore = ghostship.GetHulls(false).Where(h => h.AvoidStaying == false).ToList();
CurrentState = GhostshipState.WaitForExplore;
ExploreSegment = ObjectiveManager.Segment.CreateObjectiveSegment(EXPLORE_SUB, "dgs.obj.exploreship");
ExploreSegment.CanBeCompleted = true;
ObjectiveManager.TriggerSegment(ExploreSegment);
Log.Debug("Triggered state");
break;
}
}
}
}
@@ -0,0 +1,19 @@
using Barotrauma;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoreLevelContent.Missions
{
// Client
abstract partial class DistressMission : Mission
{
public override bool DisplayAsCompleted => false;
// Hide reward until the end of the round
public override RichString GetMissionRewardText(Submarine sub) => RichString.Rich(TextManager.GetWithVariable("missionreward", "[reward]", $"‖color:gui.orange‖{(GameMain.GameSession.RoundEnding || DisplayReward ? Reward : "???")}‖end‖"));
protected RichString GetBaseMissionRewardText(Submarine sub) => base.GetMissionRewardText(sub);
}
}
@@ -0,0 +1,35 @@
using Barotrauma;
using Barotrauma.Networking;
using HarmonyLib;
using MoreLevelContent.Shared;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace MoreLevelContent.Missions
{
// Client
partial class DistressSubmarineMission : DistressMission
{
public override bool DisplayAsFailed => false;
public override RichString GetMissionRewardText(Submarine sub) => State == 0 ? base.GetMissionRewardText(sub) : GetBaseMissionRewardText(sub);
public override void ClientReadInitial(IReadMessage msg)
{
base.ClientReadInitial(msg);
missionNPCs.Read(msg);
foreach (var character in missionNPCs.characters)
{
int reward = msg.ReadUInt16();
rewardLookup.Add(character, reward);
character.Info.Title = TextManager.GetWithVariable("currencyformat", "[credits]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", reward));
}
}
}
}
@@ -0,0 +1,48 @@
using Barotrauma.Networking;
using Barotrauma;
using MoreLevelContent.Shared;
namespace MoreLevelContent.Missions
{
// Client
partial class MissionNPCCollection
{
internal void Read(IReadMessage msg)
{
bool hasCharacters = msg.ReadBoolean();
if (!hasCharacters)
{
Log.Debug("Mission has no characters");
return;
}
byte characterCount = msg.ReadByte();
for (int i = 0; i < characterCount; i++)
{
Character character = Character.ReadSpawnData(msg);
bool allowOrdering = msg.ReadBoolean();
characters.Add(character);
if (allowOrdering)
{
_ = GameMain.GameSession.CrewManager.AddCharacterToCrewList(character);
Log.InternalDebug($"Added character {character.Name} to crew list");
}
ushort itemCount = msg.ReadUInt16();
for (int j = 0; j < itemCount; j++)
{
Item.ReadSpawnData(msg);
}
}
if (characters.Contains(null))
{
throw new System.Exception("Error in EscortMission.ClientReadInitial: character list contains null (mission: " + mission.Prefab.Identifier + ")");
}
if (characters.Count != characterCount)
{
throw new System.Exception("Error in EscortMission.ClientReadInitial: character count does not match the server count (" + characterCount + " != " + characters.Count + "mission: " + mission.Prefab.Identifier + ")");
}
InitCharacters();
}
}
}
@@ -0,0 +1,11 @@
using Barotrauma;
namespace MoreLevelContent.Missions
{
// Client
internal partial class TriangulationMission : Mission
{
public override bool DisplayAsCompleted => false;
public override bool DisplayAsFailed => false;
}
}