Unstable 0.1300.0.8

This commit is contained in:
Markus Isberg
2021-04-09 15:07:09 +03:00
parent 538c3dbfc3
commit 29bd4d6f49
38 changed files with 162 additions and 76 deletions
@@ -27,25 +27,24 @@ namespace Barotrauma
if (string.IsNullOrWhiteSpace(Identifier) || string.IsNullOrWhiteSpace(TargetTag)) { return false; }
List<Character> targets = ParentEvent.GetTargets(TargetTag).OfType<Character>().ToList();
if (!(targets.FirstOrDefault() is { } target)) { return false; }
if (TargetLimb == LimbType.None)
foreach (var target in targets)
{
Affliction? affliction = target.CharacterHealth?.GetAffliction(Identifier, AllowLimbAfflictions);
return affliction != null;
if (target.CharacterHealth == null) { continue; }
if (TargetLimb == LimbType.None)
{
if (target.CharacterHealth.GetAffliction(Identifier, AllowLimbAfflictions) != null) { return true; }
}
IEnumerable<Affliction> afflictions = target.CharacterHealth.GetAllAfflictions().Where(affliction =>
{
LimbType? limbType = target.CharacterHealth.GetAfflictionLimb(affliction)?.type;
if (limbType == null) { return false; }
return limbType == TargetLimb || true;
});
if (afflictions.Any(a => a.Identifier.Equals(Identifier, StringComparison.OrdinalIgnoreCase))) { return true; }
}
if (target.CharacterHealth == null) { return false; }
IEnumerable<Affliction> afflictions = target.CharacterHealth.GetAllAfflictions().Where(affliction =>
{
LimbType? limbType = target.CharacterHealth.GetAfflictionLimb(affliction)?.type;
if (limbType == null) { return false; }
return limbType == TargetLimb || true;
});
return afflictions.Any(a => a.Identifier.Equals(Identifier, StringComparison.OrdinalIgnoreCase));
return false;
}
public override string ToDebugString()
@@ -190,6 +190,7 @@ namespace Barotrauma
humanAI.ClearForcedOrder();
if (prevIdleObjective != null) { humanAI.ObjectiveManager.AddObjective(prevIdleObjective); }
if (prevGotoObjective != null) { humanAI.ObjectiveManager.AddObjective(prevGotoObjective); }
humanAI.ObjectiveManager.SortObjectives();
}
}
@@ -117,6 +117,7 @@ namespace Barotrauma
foreach (Item item in newCharacter.Inventory.AllItems)
{
item.SpawnedInOutpost = true;
item.AllowStealing = false;
}
}
humanPrefab.InitializeCharacter(newCharacter, spawnPos);
@@ -45,15 +45,15 @@ namespace Barotrauma
}
}
private void TagBots()
private void TagBots(bool playerCrewOnly)
{
if (IgnoreIncapacitatedCharacters)
{
ParentEvent.AddTargetPredicate(Tag, e => e is Character c && c.IsBot && !c.IsIncapacitated);
ParentEvent.AddTargetPredicate(Tag, e => e is Character c && c.IsBot && !c.IsIncapacitated && (!playerCrewOnly || c.TeamID == CharacterTeamType.Team1));
}
else
{
ParentEvent.AddTargetPredicate(Tag, e => e is Character c && c.IsBot);
ParentEvent.AddTargetPredicate(Tag, e => e is Character c && c.IsBot && (!playerCrewOnly || c.TeamID == CharacterTeamType.Team1));
}
}
@@ -62,7 +62,8 @@ namespace Barotrauma
#if CLIENT
GameMain.GameSession.CrewManager.GetCharacters().ForEach(c => ParentEvent.AddTarget(Tag, c));
#else
TagPlayers(); TagBots(); //TODO: this seems like it would tag more than it should, fix
TagPlayers();
TagBots(playerCrewOnly: true);
#endif
}
@@ -116,7 +117,7 @@ namespace Barotrauma
TagPlayers();
break;
case "bot":
TagBots();
TagBots(playerCrewOnly: false);
break;
case "crew":
TagCrew();