Inline TryGetComponent completely, for real
This commit is contained in:
@@ -55,7 +55,7 @@ namespace Content.Server.AI.EntitySystems
|
||||
public Faction GetHostileFactions(Faction faction) => _hostileFactions.TryGetValue(faction, out var hostiles) ? hostiles : Faction.None;
|
||||
|
||||
public Faction GetFactions(IEntity entity) =>
|
||||
entity.TryGetComponent(out AiFactionTagComponent? factionTags)
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out AiFactionTagComponent? factionTags)
|
||||
? factionTags.Factions
|
||||
: Faction.None;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Content.Server.AI.EntitySystems
|
||||
{
|
||||
// TODO: Need to generecise this but that will be part of a larger cleanup later anyway.
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(message.Entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(message.Entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
!message.Entity.TryGetComponent(out UtilityAi? controller))
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(message.Entity.Uid, out UtilityAi? controller))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user