v1.0.13.1 (first post-1.0 patch)

This commit is contained in:
Regalis11
2023-05-10 15:07:17 +03:00
parent 96fb49ba14
commit ee1db852b1
272 changed files with 5738 additions and 2413 deletions
@@ -65,28 +65,28 @@ namespace Barotrauma
set { maxHeight = Math.Max(value, minHeight); }
}
[Serialize(2, IsPropertySaveable.Yes), Editable(MinValueInt = 0, MaxValueInt = 10)]
[Serialize(2, IsPropertySaveable.Yes, description: "Minimum number of tunnel branches in the cave."), Editable(MinValueInt = 0, MaxValueInt = 10)]
public int MinBranchCount
{
get { return minBranchCount; }
set { minBranchCount = Math.Max(value, 0); }
}
[Serialize(4, IsPropertySaveable.Yes), Editable(MinValueInt = 0, MaxValueInt = 10)]
[Serialize(4, IsPropertySaveable.Yes, description: "Maximum number of tunnel branches in the cave."), Editable(MinValueInt = 0, MaxValueInt = 10)]
public int MaxBranchCount
{
get { return maxBranchCount; }
set { maxBranchCount = Math.Max(value, minBranchCount); }
}
[Serialize(50, IsPropertySaveable.Yes), Editable(MinValueInt = 0, MaxValueInt = 10000)]
[Serialize(50, IsPropertySaveable.Yes, description: "Total amount of level objects in the cave."), Editable(MinValueInt = 0, MaxValueInt = 10000)]
public int LevelObjectAmount
{
get;
set;
}
[Serialize(0.1f, IsPropertySaveable.Yes), Editable(MinValueFloat = 0, MaxValueFloat = 1.0f, DecimalCount = 2 )]
[Serialize(0.1f, IsPropertySaveable.Yes, description: "What portion of the empty cells in the cave should be turned into destructible walls? For example, 0.1 = 10%."), Editable(MinValueFloat = 0, MaxValueFloat = 1.0f, DecimalCount = 2 )]
public float DestructibleWallRatio
{
get;
@@ -429,7 +429,7 @@ namespace Barotrauma
public static bool IsLoadedOutpost => Loaded?.Type == LevelData.LevelType.Outpost;
/// <summary>
/// Is there a loaded level set, and is it a friendly outpost (FriendlyNPC or Team1)
/// Is there a loaded level set, and is it a friendly outpost (FriendlyNPC or Team1). Does not take reputation into account.
/// </summary>
public static bool IsLoadedFriendlyOutpost =>
loaded?.Type == LevelData.LevelType.Outpost &&
@@ -468,8 +468,7 @@ namespace Barotrauma
(StartOutpost.Info.OutpostGenerationParams?.SpawnCrewInsideOutpost ?? false) &&
StartOutpost.GetConnectedSubs().Any(s => s.Info.Type == SubmarineType.Player))
{
var reputation = GameMain.GameSession?.Campaign?.Map?.CurrentLocation?.Reputation;
return reputation == null || reputation.NormalizedValue >= Reputation.HostileThreshold;
return GameMain.GameSession.Campaign?.CurrentLocation is not { IsFactionHostile: true };
}
return false;
}
@@ -508,6 +507,8 @@ namespace Barotrauma
StartLocation = startLocation;
EndLocation = endLocation;
Rand.SetSyncedSeed(ToolBox.StringToInt(Seed));
GenerateEqualityCheckValue(LevelGenStage.GenStart);
SetEqualityCheckValue(LevelGenStage.LevelGenParams, unchecked((int)GenerationParams.UintIdentifier));
SetEqualityCheckValue(LevelGenStage.Size, borders.Width ^ borders.Height << 16);
@@ -535,7 +536,6 @@ namespace Barotrauma
List<Vector2> sites = new List<Vector2>();
Voronoi voronoi = new Voronoi(1.0);
Rand.SetSyncedSeed(ToolBox.StringToInt(Seed));
#if CLIENT
renderer = new LevelRenderer(this);
@@ -838,14 +838,6 @@ namespace Barotrauma
foreach (var pathCell in tunnel.Cells)
{
MarkEdges(pathCell, tunnel.Type);
foreach (GraphEdge edge in pathCell.Edges)
{
var adjacent = edge.AdjacentCell(pathCell);
if (adjacent != null)
{
MarkEdges(adjacent, tunnel.Type);
}
}
if (!pathCells.Contains(pathCell))
{
pathCells.Add(pathCell);
@@ -1813,6 +1805,7 @@ namespace Barotrauma
if (AbyssArea.Height < islandSize.Y) { return; }
int createdCaves = 0;
int islandCount = GenerationParams.AbyssIslandCount;
for (int i = 0; i < islandCount; i++)
{
@@ -1842,8 +1835,13 @@ namespace Barotrauma
break;
}
if (Rand.Range(0.0f, 1.0f, Rand.RandSync.ServerAndClient) > GenerationParams.AbyssIslandCaveProbability)
bool createCave =
//force at least one abyss cave
(i == islandCount - 1 && createdCaves == 0) ||
Rand.Range(0.0f, 1.0f, Rand.RandSync.ServerAndClient) < GenerationParams.AbyssIslandCaveProbability;
if (!createCave)
{
//just create a chunk with no cave
float radiusVariance = Math.Min(islandArea.Width, islandArea.Height) * 0.1f;
var vertices = CaveGenerator.CreateRandomChunk(islandArea.Width - (int)(radiusVariance * 2), islandArea.Height - (int)(radiusVariance * 2), 16, radiusVariance: radiusVariance);
Vector2 position = islandArea.Center.ToVector2();
@@ -1901,6 +1899,7 @@ namespace Barotrauma
new Point(islandArea.Center.X, islandArea.Center.Y + (int)(islandArea.Size.Y * (1.0f - caveScaleRelativeToIsland)) / 2),
new Point((int)(islandArea.Size.X * caveScaleRelativeToIsland), (int)(islandArea.Size.Y * caveScaleRelativeToIsland)));
AbyssIslands.Add(new AbyssIsland(islandArea, islandCells));
createdCaves++;
}
}
@@ -3013,10 +3012,12 @@ namespace Barotrauma
if (PositionsOfInterest.None(p => p.PositionType == positionType))
{
DebugConsole.AddWarning($"Failed to find a position of the type \"{positionType}\" for mission resources.");
foreach (var validType in MineralMission.ValidPositionTypes)
{
if (validType != positionType && PositionsOfInterest.Any(p => p.PositionType == validType))
{
DebugConsole.AddWarning($"Placing in \"{validType}\" instead.");
positionType = validType;
break;
}
@@ -67,6 +67,8 @@ namespace Barotrauma
/// </summary>
public readonly List<Identifier> NonRepeatableEvents = new List<Identifier>();
public readonly Dictionary<EventSet, int> FinishedEvents = new Dictionary<EventSet, int>();
/// <summary>
/// 'Exhaustible' sets won't appear in the same level until after one world step (~10 min, see Map.ProgressWorld) has passed. <see cref="EventSet.Exhaustible"/>.
/// </summary>
@@ -155,6 +157,47 @@ namespace Barotrauma
string[] nonRepeatablePrefabNames = element.GetAttributeStringArray("nonrepeatableevents", Array.Empty<string>());
NonRepeatableEvents.AddRange(EventPrefab.Prefabs.Where(p => nonRepeatablePrefabNames.Any(n => p.Identifier == n)).Select(p => p.Identifier));
string finishedEventsName = nameof(FinishedEvents);
if (element.GetChildElement(finishedEventsName) is { } finishedEventsElement)
{
foreach (var childElement in finishedEventsElement.GetChildElements(finishedEventsName))
{
Identifier eventSetIdentifier = childElement.GetAttributeIdentifier("set", Identifier.Empty);
if (eventSetIdentifier.IsEmpty) { continue; }
if (!EventSet.Prefabs.TryGet(eventSetIdentifier, out EventSet eventSet))
{
foreach (var prefab in EventSet.Prefabs)
{
if (FindSetRecursive(prefab, eventSetIdentifier) is { } foundSet)
{
eventSet = foundSet;
break;
}
}
}
if (eventSet is null) { continue; }
int count = childElement.GetAttributeInt("count", 0);
if (count < 1) { continue; }
FinishedEvents.Add(eventSet, count);
}
static EventSet FindSetRecursive(EventSet parentSet, Identifier setIdentifier)
{
foreach (var childSet in parentSet.ChildSets)
{
if (childSet.Identifier == setIdentifier)
{
return childSet;
}
if (FindSetRecursive(childSet, setIdentifier) is { } foundSet)
{
return foundSet;
}
}
return null;
}
}
EventsExhausted = element.GetAttributeBool(nameof(EventsExhausted).ToLower(), false);
}
@@ -319,6 +362,18 @@ namespace Barotrauma
{
newElement.Add(new XAttribute("nonrepeatableevents", string.Join(',', NonRepeatableEvents)));
}
if (FinishedEvents.Any())
{
var finishedEventsElement = new XElement(nameof(FinishedEvents));
foreach (var (set, count) in FinishedEvents)
{
var element = new XElement(nameof(FinishedEvents),
new XAttribute("set", set.Identifier),
new XAttribute("count", count));
finishedEventsElement.Add(element);
}
newElement.Add(finishedEventsElement);
}
}
parentElement.Add(newElement);
@@ -95,7 +95,7 @@ namespace Barotrauma
set;
}
[Serialize("20,40,50", IsPropertySaveable.Yes), Editable()]
[Serialize("20,40,50", IsPropertySaveable.Yes), Editable]
public Color BackgroundTextureColor
{
get;
@@ -176,7 +176,7 @@ namespace Barotrauma
set;
}
[Serialize(false, IsPropertySaveable.Yes, ""), Editable]
[Serialize(false, IsPropertySaveable.Yes, description: "If enabled, no walls generate in the level. Can be useful for e.g. levels that are just supposed to consist of a pre-built outpost."), Editable]
public bool NoLevelGeometry
{
get;
@@ -218,21 +218,21 @@ namespace Barotrauma
set { height = MathHelper.Clamp(value, 2000, 1000000); }
}
[Serialize(80000, IsPropertySaveable.Yes), Editable(MinValueInt = 0, MaxValueInt = 1000000)]
[Serialize(80000, IsPropertySaveable.Yes, description: "Minimum depth at the top of the level (100 corresponds to 1 meter)."), Editable(MinValueInt = 0, MaxValueInt = 1000000)]
public int InitialDepthMin
{
get { return initialDepthMin; }
set { initialDepthMin = Math.Max(value, 0); }
}
[Serialize(80000, IsPropertySaveable.Yes), Editable(MinValueInt = 0, MaxValueInt = 1000000)]
[Serialize(80000, IsPropertySaveable.Yes, description: "Maximum depth at the top of the level (100 corresponds to 1 meter)."), Editable(MinValueInt = 0, MaxValueInt = 1000000)]
public int InitialDepthMax
{
get { return initialDepthMax; }
set { initialDepthMax = Math.Max(value, initialDepthMin); }
}
[Serialize(6500, IsPropertySaveable.Yes), Editable(MinValueInt = 5000, MaxValueInt = 1000000)]
[Serialize(6500, IsPropertySaveable.Yes, description: "Minimum width of the main tunnel going through the level, in pixels. Can be automatically increased by the level editor if the submarine is larger than this."), Editable(MinValueInt = 5000, MaxValueInt = 1000000)]
public int MinTunnelRadius
{
get;
@@ -240,7 +240,7 @@ namespace Barotrauma
}
[Serialize("0,1", IsPropertySaveable.Yes), Editable]
[Serialize("0,1", IsPropertySaveable.Yes, description: "Amount of side tunnels in the level (min,max)."), Editable]
public Point SideTunnelCount
{
get;
@@ -248,14 +248,14 @@ namespace Barotrauma
}
[Serialize(0.5f, IsPropertySaveable.Yes), Editable(MinValueFloat = 0.0f, MaxValueFloat = 1.0f)]
[Serialize(0.5f, IsPropertySaveable.Yes, description: "How much the side tunnels can \"zigzag\". 0 = completely straight tunnel, 1 = can go all the way from the top of the level to the bottom."), Editable(MinValueFloat = 0.0f, MaxValueFloat = 1.0f)]
public float SideTunnelVariance
{
get;
set;
}
[Serialize("2000,6000", IsPropertySaveable.Yes), Editable]
[Serialize("2000,6000", IsPropertySaveable.Yes, description: "Minimum width of the side tunnels, in pixels. Unlike the main tunnel, does not get adjusted based on the size of the submarine."), Editable]
public Point MinSideTunnelRadius
{
get;
@@ -336,7 +336,7 @@ namespace Barotrauma
}
}
[Serialize(0.5f, IsPropertySaveable.Yes), Editable(MinValueFloat = 0.0f, MaxValueFloat = 1.0f)]
[Serialize(0.5f, IsPropertySaveable.Yes, description: "How much the side tunnels can \"zigzag\". 0 = completely straight tunnel, 1 = can go all the way from the top of the level to the bottom."), Editable(MinValueFloat = 0.0f, MaxValueFloat = 1.0f)]
public float MainPathVariance
{
get;
@@ -385,28 +385,28 @@ namespace Barotrauma
[Serialize(1.0f, IsPropertySaveable.Yes, description: "How likely a resource spawn point on a cave path is to contain resources."), Editable(MinValueFloat = 0, MaxValueFloat = 1)]
public float CaveResourceSpawnChance { get; set; }
[Serialize(0, IsPropertySaveable.Yes), Editable(MinValueInt = 0, MaxValueInt = 20)]
[Serialize(0, IsPropertySaveable.Yes, description: "Number of floating, destructible ice chunks in the level."), Editable(MinValueInt = 0, MaxValueInt = 20)]
public int FloatingIceChunkCount
{
get;
set;
}
[Serialize(0, IsPropertySaveable.Yes), Editable(MinValueInt = 0, MaxValueInt = 100)]
[Serialize(0, IsPropertySaveable.Yes, description: "Number of islands (static wall chunks along the main path) in the level."), Editable(MinValueInt = 0, MaxValueInt = 100)]
public int IslandCount
{
get;
set;
}
[Serialize(0, IsPropertySaveable.Yes), Editable(MinValueInt = 0, MaxValueInt = 20)]
[Serialize(0, IsPropertySaveable.Yes, description: "Number of ice spires in the level."), Editable(MinValueInt = 0, MaxValueInt = 20)]
public int IceSpireCount
{
get;
set;
}
[Serialize(5, IsPropertySaveable.Yes), Editable(MinValueInt = 0, MaxValueInt = 20)]
[Serialize(5, IsPropertySaveable.Yes, description: "Number of abyss islands in the level."), Editable(MinValueInt = 0, MaxValueInt = 20)]
public int AbyssIslandCount
{
get;
@@ -427,7 +427,7 @@ namespace Barotrauma
set;
}
[Serialize(0.5f, IsPropertySaveable.Yes), Editable()]
[Serialize(0.5f, IsPropertySaveable.Yes, description: "The probability of an abyss island having a cave. There is always a cave in at least one of the islands regardless of this setting."), Editable()]
public float AbyssIslandCaveProbability
{
get;
@@ -532,7 +532,7 @@ namespace Barotrauma
public float WreckFloodingHullMaxWaterPercentage { get; set; }
#endregion
[Serialize("", IsPropertySaveable.Yes)]
[Serialize("", IsPropertySaveable.Yes, description: "Should a beacon station always spawn in this type of level?")]
public string ForceBeaconStation { get; set; }
[Serialize(0.4f, IsPropertySaveable.Yes, description: "The probability for wall cells to be removed from the bottom of the map. A value of 0 will produce a completely enclosed tunnel and 1 will make the entire bottom of the level completely open."), Editable()]
@@ -571,21 +571,21 @@ namespace Barotrauma
private set;
}
[Serialize("0,0", IsPropertySaveable.Yes), Editable]
[Serialize("0,0", IsPropertySaveable.Yes, description: "Interval of lightning-like flashes of light in the level."), Editable]
public Vector2 FlashInterval
{
get;
set;
}
[Serialize("0,0,0,0", IsPropertySaveable.Yes), Editable]
[Serialize("0,0,0,0", IsPropertySaveable.Yes, description: "Color of lightning-like flashes of light in the level."), Editable]
public Color FlashColor
{
get;
set;
}
[Serialize(false, IsPropertySaveable.Yes), Editable]
[Serialize(false, IsPropertySaveable.Yes, description: "Should the \"ambient noise\" of the biome play in this level if it's an outpost level."), Editable]
public bool PlayNoiseLoopInOutpostLevel
{
get;
@@ -129,7 +129,7 @@ namespace Barotrauma
private set;
}
[Serialize("0.0,1.0", IsPropertySaveable.Yes), Editable]
[Serialize("0.0,1.0", IsPropertySaveable.Yes, description: "The sprite depth of the object (min, max). Values of 0 or less make the object render in front of walls, values larger than 0 make it render behind walls with a parallax effect."), Editable]
public Vector2 DepthRange
{
get;
@@ -273,14 +273,14 @@ namespace Barotrauma
private set;
}
[Serialize(false, IsPropertySaveable.Yes), Editable]
[Serialize(false, IsPropertySaveable.Yes, description: "Should the object disappear if the object is destroyed? Only relevant if TakeLevelWallDamage is true."), Editable]
public bool HideWhenBroken
{
get;
private set;
}
[Serialize(100.0f, IsPropertySaveable.Yes), Editable]
[Serialize(100.0f, IsPropertySaveable.Yes, description: "Amount of health the object has. Only relevant if TakeLevelWallDamage is true."), Editable]
public float Health
{
get;
@@ -1,4 +1,5 @@
using Barotrauma.Networking;
using Barotrauma.Extensions;
using Barotrauma.Networking;
using FarseerPhysics;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;
@@ -658,6 +659,10 @@ namespace Barotrauma
{
effect.Apply(effect.type, deltaTime, triggerer, item.AllPropertyObjects, position);
}
else if (triggerer is Submarine sub)
{
effect.Apply(effect.type, deltaTime, sub, Array.Empty<ISerializableEntity>(), position);
}
if (effect.HasTargetType(StatusEffect.TargetType.NearbyItems) || effect.HasTargetType(StatusEffect.TargetType.NearbyCharacters))
{
targets.Clear();