3 using System.Collections.Generic;
4 using System.Collections.Immutable;
20 private readonly
float maxDifficulty;
28 private readonly ImmutableHashSet<SubmarineAvailability> submarineAvailabilityOverrides;
54 var submarineAvailabilityOverrides =
new HashSet<SubmarineAvailability>();
57 submarineAvailability = GetAvailability(availabilityElement);
58 foreach (var overrideElement
in availabilityElement.GetChildElements(
"override"))
60 var availabilityOverride = GetAvailability(overrideElement);
61 submarineAvailabilityOverrides.Add(availabilityOverride);
64 this.submarineAvailabilityOverrides = submarineAvailabilityOverrides.ToImmutableHashSet();
70 Class: element.GetAttributeEnum(
"class",
SubmarineClass.Undefined),
78 if (identifier.IsEmpty)
81 DebugConsole.ThrowError(
"Error in biome \"" + identifier +
"\": identifier missing, using name as the identifier.");
88 if (!submarineAvailability.HasValue)
93 int maxTier = submarineAvailability.Value.MaxTier;
94 if (submarineAvailabilityOverrides.FirstOrNull(a => a.LocationType == locationType && a.Class == subClass) is
SubmarineAvailability locationAndClassOverride)
96 maxTier = locationAndClassOverride.MaxTier;
100 maxTier = locationOverride.MaxTier;
102 else if (submarineAvailabilityOverrides.FirstOrNull(a => a.LocationType ==
Identifier.Empty && a.Class == subClass) is
SubmarineAvailability classOverride)
104 maxTier = classOverride.MaxTier;
readonly LocalizedString Description
readonly ImmutableHashSet< int > AllowedZones
static readonly PrefabCollection< Biome > Prefabs
static Identifier ParseIdentifier(ContentXElement element)
int HighestSubmarineTierAvailable(SubmarineClass subClass, Identifier locationType)
bool IsSubmarineAvailable(SubmarineInfo info, Identifier locationType)
readonly float MinDifficulty
float AdjustedMaxDifficulty
readonly Identifier OldIdentifier
readonly LocalizedString DisplayName
readonly record struct SubmarineAvailability(Identifier LocationType, SubmarineClass Class=SubmarineClass.Undefined, int MaxTier=0)
Biome(ContentXElement element, LevelGenerationParametersFile file)
float ActualMaxDifficulty
readonly int EndBiomeLocationCount
string? GetAttributeString(string key, string? def)
int?[] GetAttributeIntArray(string key, int[]? def)
float GetAttributeFloat(string key, float def)
ContentXElement? GetChildElement(string name)
bool GetAttributeBool(string key, bool def)
int GetAttributeInt(string key, int def)
Identifier GetAttributeIdentifier(string key, string def)
LocalizedString Fallback(LocalizedString fallback, bool useDefaultLanguageIfFound=true)
Use this text instead if the original text cannot be found.
readonly Identifier Identifier
Prefab that has a property serves as a deterministic hash of a prefab's identifier....