(eba811de) Unstable 0.9.703.0
This commit is contained in:
@@ -77,6 +77,12 @@ namespace Barotrauma
|
||||
Level.Loaded.TryGetInterestingPosition(true, Level.PositionType.MainPath, Level.Loaded.Size.X * 0.3f, out Vector2 spawnPos);
|
||||
|
||||
bool isClient = IsClient;
|
||||
|
||||
if (monsters.Count > 0)
|
||||
{
|
||||
throw new Exception($"monsters.Count > 0 ({monsters.Count})");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(monsterFile))
|
||||
{
|
||||
for (int i = 0; i < monsterCount; i++)
|
||||
@@ -92,12 +98,22 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (tempSonarPositions.Count > 0)
|
||||
{
|
||||
throw new Exception($"tempSonarPositions.Count > 0 ({tempSonarPositions.Count})");
|
||||
}
|
||||
|
||||
monsters.ForEach(m => m.Enabled = false);
|
||||
SwarmBehavior.CreateSwarm(monsters.Cast<AICharacter>());
|
||||
for (int i = 0; i < monsters.Count; i++)
|
||||
{
|
||||
tempSonarPositions.Add(spawnPos + Rand.Vector(maxSonarMarkerDistance));
|
||||
}
|
||||
|
||||
if (monsters.Count != tempSonarPositions.Count)
|
||||
{
|
||||
throw new Exception($"monsters.Count != tempSonarPositions.Count ({monsters.Count} != {tempSonarPositions.Count})");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
@@ -108,6 +124,16 @@ namespace Barotrauma
|
||||
//keep sonar markers within maxSonarMarkerDistance from the monster(s)
|
||||
for (int i = 0; i < tempSonarPositions.Count; i++)
|
||||
{
|
||||
if (monsters.Count != tempSonarPositions.Count)
|
||||
{
|
||||
throw new Exception($"monsters.Count != tempSonarPositions.Count ({monsters.Count} != {tempSonarPositions.Count})");
|
||||
}
|
||||
|
||||
if (i < 0 || i >= monsters.Count)
|
||||
{
|
||||
throw new Exception($"Index {i} outside of bounds 0-{monsters.Count} ({tempSonarPositions.Count})");
|
||||
}
|
||||
|
||||
if (monsters[i].Removed || monsters[i].IsDead) { continue; }
|
||||
Vector2 diff = tempSonarPositions[i] - monsters[i].Position;
|
||||
|
||||
@@ -148,8 +174,10 @@ namespace Barotrauma
|
||||
|
||||
public override void End()
|
||||
{
|
||||
tempSonarPositions.Clear();
|
||||
monsters.Clear();
|
||||
if (State < 1) { return; }
|
||||
|
||||
|
||||
GiveReward();
|
||||
completed = true;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Barotrauma
|
||||
|
||||
private ScriptedEventSet(XElement element, string debugIdentifier)
|
||||
{
|
||||
DebugIdentifier = debugIdentifier;
|
||||
DebugIdentifier = element.GetAttributeString("identifier", null) ?? debugIdentifier;
|
||||
Commonness = new Dictionary<string, float>();
|
||||
EventPrefabs = new List<ScriptedEventPrefab>();
|
||||
ChildSets = new List<ScriptedEventSet>();
|
||||
|
||||
Reference in New Issue
Block a user