Unstable v0.1300.0.0 (February 19th 2021)

This commit is contained in:
Joonas Rikkonen
2021-02-25 13:44:23 +02:00
parent b772654326
commit 24cbef485a
441 changed files with 21343 additions and 8562 deletions
@@ -16,6 +16,7 @@ namespace Barotrauma
private readonly float maxSonarMarkerDistance = 10000.0f;
private readonly Level.PositionType spawnPosType;
public override IEnumerable<Vector2> SonarPositions
{
@@ -52,6 +53,13 @@ namespace Barotrauma
maxSonarMarkerDistance = prefab.ConfigElement.GetAttributeFloat("maxsonarmarkerdistance", 10000.0f);
var spawnPosTypeStr = prefab.ConfigElement.GetAttributeString("spawntype", "");
if (string.IsNullOrWhiteSpace(spawnPosTypeStr) ||
!Enum.TryParse(spawnPosTypeStr, true, out spawnPosType))
{
spawnPosType = Level.PositionType.MainPath | Level.PositionType.SidePath;
}
foreach (var monsterElement in prefab.ConfigElement.GetChildElements("monster"))
{
speciesName = monsterElement.GetAttributeString("character", string.Empty);
@@ -81,22 +89,32 @@ namespace Barotrauma
TextManager.Get("character." + characterParams.SpeciesName));
}
}
public override void Start(Level level)
protected override void StartMissionSpecific(Level level)
{
if (monsters.Count > 0)
{
#if DEBUG
throw new Exception($"monsters.Count > 0 ({monsters.Count})");
#else
DebugConsole.AddWarning("Monster list was not empty at the start of a monster mission. The mission instance may not have been ended correctly on previous rounds.");
monsters.Clear();
#endif
}
if (tempSonarPositions.Count > 0)
{
#if DEBUG
throw new Exception($"tempSonarPositions.Count > 0 ({tempSonarPositions.Count})");
#else
DebugConsole.AddWarning("Sonar position list was not empty at the start of a monster mission. The mission instance may not have been ended correctly on previous rounds.");
tempSonarPositions.Clear();
#endif
}
if (!IsClient)
{
Level.Loaded.TryGetInterestingPosition(true, Level.PositionType.MainPath | Level.PositionType.SidePath, Level.Loaded.Size.X * 0.3f, out Vector2 spawnPos);
Level.Loaded.TryGetInterestingPosition(true, spawnPosType, Level.Loaded.Size.X * 0.3f, out Vector2 spawnPos);
foreach (var monster in monsterPrefabs)
{
int amount = Rand.Range(monster.Item2.X, monster.Item2.Y + 1);
@@ -115,7 +133,7 @@ namespace Barotrauma
foreach (var monster in monsters)
{
monster.Enabled = false;
if (monster.Params.AI.EnforceAggressiveBehaviorForMissions)
if (monster.Params.AI != null && monster.Params.AI.EnforceAggressiveBehaviorForMissions)
{
foreach (var targetParam in monster.Params.AI.Targets)
{
@@ -203,9 +221,17 @@ namespace Barotrauma
tempSonarPositions.Clear();
monsters.Clear();
if (State < 1) { return; }
if (Prefab.LocationTypeChangeOnCompleted != null)
{
ChangeLocationType(Prefab.LocationTypeChangeOnCompleted);
}
GiveReward();
completed = true;
if (level?.LevelData != null && Prefab.Tags.Any(t => t.Equals("huntinggrounds", StringComparison.OrdinalIgnoreCase)))
{
level.LevelData.HasHuntingGrounds = false;
}
}
public bool IsEliminated(Character enemy) =>