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,21 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace MoreLevelContent.Shared.Generation
{
public abstract class DefWithDifficultyRange : IComparable<DefWithDifficultyRange>
{
protected DefWithDifficultyRange(string stringContainingDiff) => DifficultyRange = new DifficultyRange(stringContainingDiff);
protected DefWithDifficultyRange(float min, float max) => DifficultyRange = new DifficultyRange(min, max);
public float MinDifficulty => DifficultyRange.MinDiff;
public float MaxDifficulty => DifficultyRange.MaxDiff;
public float AverageDifficulty => (MinDifficulty + MaxDifficulty) / 2;
public DifficultyRange DifficultyRange { get; protected set; }
public int CompareTo([AllowNull] DefWithDifficultyRange other) => other == null ? -1 : other.MinDifficulty < MinDifficulty ? -1 : other.MinDifficulty == MinDifficulty ? 0 : 1;
}
}
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace MoreLevelContent.Shared.Generation
{
public struct DifficultyRange
{
public float MinDiff;
public float MaxDiff;
private static readonly Regex diffRegex = new Regex("diff_([0-9.]+)-([0-9.]+)");
public DifficultyRange(float min, float max)
{
MinDiff = min;
MaxDiff = max;
}
public DifficultyRange(string name)
{
Match match = diffRegex.Match(name);
// Exit if the sub has no difficulty range defined
if (match.Groups.Count < 2)
{
MinDiff = 0;
MaxDiff = 0;
Log.Warn($"Element with name {name} has no diff range defined. Will only spawn when at 0% diff!");
return;
}
string diffStr1 = match.Groups[1].Value;
string diffStr2 = match.Groups[2].Value;
MinDiff = float.Parse(diffStr1);
MaxDiff = float.Parse(diffStr2);
}
public override string ToString() => $"{MinDiff} - {MaxDiff}";
public bool IsInRangeOf(float diff) => MinDiff <= diff && diff < MaxDiff;
}
}
@@ -0,0 +1,13 @@
using Barotrauma;
using System;
using System.Collections.Generic;
using System.Text;
namespace MoreLevelContent.Shared.Generation
{
public class PirateNPCSetDef : DefWithDifficultyRange
{
internal readonly MissionPrefab Prefab;
internal PirateNPCSetDef(MissionPrefab prefab, string stringContainingDiff) : base(stringContainingDiff) => Prefab = prefab;
}
}
@@ -0,0 +1,20 @@
using Barotrauma;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using static Barotrauma.Level;
namespace MoreLevelContent.Shared.Generation
{
internal class PirateOutpostDef : DefWithDifficultyRange
{
internal SubmarineInfo SubInfo;
internal PlacementType PlacementType;
internal PirateOutpostDef(SubmarineInfo subInfo, float min, float max, PlacementType placementType) : base(min, max)
{
SubInfo = subInfo;
PlacementType = placementType;
}
}
}