Replace usage of the Stances dict by a method call
This commit is contained in:
@@ -36,24 +36,24 @@ namespace OpenRA.Mods.Common
|
||||
|
||||
public static bool AppearsFriendlyTo(this Actor self, Actor toActor)
|
||||
{
|
||||
var stance = toActor.Owner.Stances[self.Owner];
|
||||
var stance = toActor.Owner.RelationshipWith(self.Owner);
|
||||
if (stance == PlayerRelationship.Ally)
|
||||
return true;
|
||||
|
||||
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.Info.HasTraitInfo<IgnoresDisguiseInfo>())
|
||||
return toActor.Owner.Stances[self.EffectiveOwner.Owner] == PlayerRelationship.Ally;
|
||||
return toActor.Owner.RelationshipWith(self.EffectiveOwner.Owner) == PlayerRelationship.Ally;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool AppearsHostileTo(this Actor self, Actor toActor)
|
||||
{
|
||||
var stance = toActor.Owner.Stances[self.Owner];
|
||||
var stance = toActor.Owner.RelationshipWith(self.Owner);
|
||||
if (stance == PlayerRelationship.Ally)
|
||||
return false; /* otherwise, we'll hate friendly disguised spies */
|
||||
return false;
|
||||
|
||||
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.Info.HasTraitInfo<IgnoresDisguiseInfo>())
|
||||
return toActor.Owner.Stances[self.EffectiveOwner.Owner] == PlayerRelationship.Enemy;
|
||||
return toActor.Owner.RelationshipWith(self.EffectiveOwner.Owner) == PlayerRelationship.Enemy;
|
||||
|
||||
return stance == PlayerRelationship.Enemy;
|
||||
}
|
||||
@@ -61,10 +61,8 @@ namespace OpenRA.Mods.Common
|
||||
public static void NotifyBlocker(this Actor self, IEnumerable<Actor> blockers)
|
||||
{
|
||||
foreach (var blocker in blockers)
|
||||
{
|
||||
foreach (var moveBlocked in blocker.TraitsImplementing<INotifyBlockingMove>())
|
||||
moveBlocked.OnNotifyBlockingMove(blocker, self);
|
||||
}
|
||||
}
|
||||
|
||||
public static void NotifyBlocker(this Actor self, CPos position)
|
||||
|
||||
Reference in New Issue
Block a user