(e704a7904) Fixed "lone sailor" achievement not unlocking because the watchmen were counted as members of the crew

This commit is contained in:
Joonas Rikkonen
2019-04-23 15:37:09 +03:00
parent 2cb4de7dc5
commit de87f84ba4

View File

@@ -336,9 +336,12 @@ namespace Barotrauma
UnlockAchievement("survivereactormeltdown");
}
#endif
var charactersInSub = Character.CharacterList.FindAll(c => !c.IsDead &&
var charactersInSub = Character.CharacterList.FindAll(c =>
!c.IsDead &&
c.TeamID != Character.TeamType.FriendlyNPC &&
!(c.AIController is EnemyAIController) &&
(c.Submarine == gameSession.Submarine || (Level.Loaded?.EndOutpost != null && c.Submarine == Level.Loaded.EndOutpost)));
if (charactersInSub.Count == 1)
{
//there must be some non-enemy casualties to get the last mant standing achievement
@@ -346,7 +349,11 @@ namespace Barotrauma
{
UnlockAchievement(charactersInSub[0], "lastmanstanding");
}
else if (!Character.CharacterList.Any(c => !(c.AIController is EnemyAIController)))
//lone sailor achievement if alone in the sub and there are no other characters with the same team ID
else if (!Character.CharacterList.Any(c =>
c != charactersInSub[0] &&
c.TeamID == charactersInSub[0].TeamID &&
!(c.AIController is EnemyAIController)))
{
UnlockAchievement(charactersInSub[0], "lonesailor");
}