Release 1.9.7.0 - Summer Update 2025
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Barotrauma.Extensions;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
|
||||
@@ -4481,6 +4481,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool onlyEntrance = LevelData.Type != LevelData.LevelType.Outpost;
|
||||
|
||||
LocationType locationType = location?.Type;
|
||||
if (missionForcedOutpostParamsId != null &&
|
||||
OutpostGenerationParams.OutpostParams.TryGet(missionForcedOutpostParamsId, out var missionForcedOutpostParams))
|
||||
{
|
||||
@@ -4490,6 +4494,13 @@ namespace Barotrauma
|
||||
{
|
||||
outpostGenerationParams = LevelData.ForceOutpostGenerationParams;
|
||||
}
|
||||
else if (locationType != null &&
|
||||
locationType.GetForcedOutpostGenerationParams() is { } forcedOutpostGenerationParams &&
|
||||
//do not use the forced parameters if we want to generate only the entrance, and the parameters define a full, pre-built outpost
|
||||
(!onlyEntrance || forcedOutpostGenerationParams.OutpostFilePath.IsNullOrEmpty()))
|
||||
{
|
||||
outpostGenerationParams = forcedOutpostGenerationParams;
|
||||
}
|
||||
else
|
||||
{
|
||||
outpostGenerationParams =
|
||||
@@ -4497,7 +4508,6 @@ namespace Barotrauma
|
||||
LevelData.GetSuitableOutpostGenerationParams(location, LevelData).GetRandom(Rand.RandSync.ServerAndClient);
|
||||
}
|
||||
|
||||
LocationType locationType = location?.Type;
|
||||
if (locationType == null)
|
||||
{
|
||||
locationType = LocationType.Prefabs.GetRandom(Rand.RandSync.ServerAndClient);
|
||||
@@ -4512,7 +4522,7 @@ namespace Barotrauma
|
||||
if (location != null)
|
||||
{
|
||||
DebugConsole.NewMessage($"Generating an outpost for the {(isStart ? "start" : "end")} of the level... (Location: {location.DisplayName}, level type: {LevelData.Type})");
|
||||
outpost = OutpostGenerator.Generate(outpostGenerationParams, location, onlyEntrance: LevelData.Type != LevelData.LevelType.Outpost, LevelData.AllowInvalidOutpost);
|
||||
outpost = OutpostGenerator.Generate(outpostGenerationParams, location, onlyEntrance: onlyEntrance, LevelData.AllowInvalidOutpost);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -370,19 +370,36 @@ namespace Barotrauma
|
||||
|
||||
public static IEnumerable<OutpostGenerationParams> GetSuitableOutpostGenerationParams(Location location, LevelData levelData)
|
||||
{
|
||||
var suitableParams = OutpostGenerationParams.OutpostParams
|
||||
.Where(p => p.LevelType == null || levelData.Type == p.LevelType)
|
||||
var paramsForGameMode = OutpostGenerationParams.OutpostParams.Where(p =>
|
||||
p.AllowedGameModeIdentifiers.None() || GameMain.GameSession?.GameMode is not GameMode gameMode || p.AllowedGameModeIdentifiers.Contains(gameMode.Preset.Identifier));
|
||||
|
||||
var paramsWithMatchingLevelType = paramsForGameMode
|
||||
.Where(p => p.LevelType == null || levelData.Type == p.LevelType);
|
||||
|
||||
//1. try finding params specifically for this location type
|
||||
var suitableParams = paramsWithMatchingLevelType
|
||||
.Where(p => location == null || p.AllowedLocationTypes.Contains(location.Type.Identifier));
|
||||
if (!suitableParams.Any())
|
||||
{
|
||||
suitableParams = OutpostGenerationParams.OutpostParams
|
||||
.Where(p => p.LevelType == null || levelData.Type == p.LevelType)
|
||||
.Where(p => location == null || !p.AllowedLocationTypes.Any());
|
||||
//2. not found, if the location type is configured to use the modules of some other location type,
|
||||
// see if we could use that location type's generation params
|
||||
if (!location.Type.UseOutpostModulesOfLocationType.IsEmpty)
|
||||
{
|
||||
suitableParams = paramsWithMatchingLevelType
|
||||
.Where(p => p.AllowedLocationTypes.Contains(location.Type.UseOutpostModulesOfLocationType));
|
||||
}
|
||||
if (!suitableParams.Any())
|
||||
{
|
||||
DebugConsole.ThrowError($"No suitable outpost generation parameters found for the location type \"{location.Type.Identifier}\". Selecting random parameters.");
|
||||
suitableParams = OutpostGenerationParams.OutpostParams;
|
||||
//3. still not found, choose some parameters that are suitable for any location type
|
||||
suitableParams = paramsWithMatchingLevelType
|
||||
.Where(p => location == null || !p.AllowedLocationTypes.Any());
|
||||
if (!suitableParams.Any())
|
||||
{
|
||||
DebugConsole.ThrowError($"No suitable outpost generation parameters found for the location type \"{location.Type.Identifier}\". Selecting random parameters.");
|
||||
suitableParams = paramsForGameMode;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return suitableParams;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Barotrauma.RuinGeneration
|
||||
|
||||
public void Generate(Level level, LocationType locationType, Point position, bool mirror = false)
|
||||
{
|
||||
Submarine = OutpostGenerator.Generate(generationParams, locationType, onlyEntrance: false);
|
||||
Submarine = OutpostGenerator.Generate(generationParams, locationType, onlyEntrance: false, allowInvalidOutpost: level.LevelData.AllowInvalidOutpost);
|
||||
Submarine.Info.Name = $"Ruin ({level.Seed})";
|
||||
Submarine.Info.Type = SubmarineType.Ruin;
|
||||
Submarine.TeamID = CharacterTeamType.None;
|
||||
|
||||
Reference in New Issue
Block a user