Rename methods/activities with Visual in them

While they may be only 'visual' in terms of influence/cell grid,
they all do update CenterPosition, which is essentially the
actual world position of the actor.
'Visual' would imply that it only affects the position where the
actor is drawn, which is inaccurate.
Furthermore, using the term 'Visual' here would make
naming future methods/properties related to visual interpolation
unnecessarily complicated, because that's where we might
need a real 'Visual(Only)Position'.
This commit is contained in:
reaperrr
2021-03-06 13:40:18 +01:00
committed by Matthias Mailänder
parent 7073279ab8
commit 2473b8763b
18 changed files with 80 additions and 80 deletions

View File

@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Cnc.Activities
targetPosition = target.CenterPosition;
var position = length > 1 ? WPos.Lerp(origin, targetPosition, ticks, length - 1) : targetPosition;
mobile.SetVisualPosition(self, position);
mobile.SetCenterPosition(self, position);
// We are at the destination
if (++ticks >= length)
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Cnc.Activities
attack.DoAttack(self, target);
jumpComplete = true;
QueueChild(mobile.VisualMove(self, position, self.World.Map.CenterOfSubCell(destinationCell, destinationSubCell)));
QueueChild(mobile.LocalMove(self, position, self.World.Map.CenterOfSubCell(destinationCell, destinationSubCell)));
}
return false;

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Cnc.Traits
static readonly WAngle Right = new WAngle(768);
IEnumerable<int> speedModifiers;
INotifyVisualPositionChanged[] notifyVisualPositionChanged;
INotifyCenterPositionChanged[] notifyCenterPositionChanged;
WRot orientation;
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Cnc.Traits
{
speedModifiers = self.TraitsImplementing<ISpeedModifier>().ToArray().Select(sm => sm.GetSpeedModifier());
cachedLocation = self.Location;
notifyVisualPositionChanged = self.TraitsImplementing<INotifyVisualPositionChanged>().ToArray();
notifyCenterPositionChanged = self.TraitsImplementing<INotifyCenterPositionChanged>().ToArray();
}
void INotifyAddedToWorld.AddedToWorld(Actor self)
@@ -134,7 +134,7 @@ namespace OpenRA.Mods.Cnc.Traits
cachedLocation = self.Location;
SetVisualPosition(self, self.CenterPosition + MoveStep(Facing));
SetCenterPosition(self, self.CenterPosition + MoveStep(Facing));
}
void Turn()
@@ -172,7 +172,7 @@ namespace OpenRA.Mods.Cnc.Traits
return SubCell.Invalid;
}
public void SetVisualPosition(Actor self, WPos pos) { SetPosition(self, pos); }
public void SetCenterPosition(Actor self, WPos pos) { SetPosition(self, pos); }
public void SetPosition(Actor self, CPos cell, SubCell subCell = SubCell.Any)
{
@@ -192,10 +192,10 @@ namespace OpenRA.Mods.Cnc.Traits
self.World.UpdateMaps(self, this);
self.World.ActorMap.AddInfluence(self, this);
// This can be called from the constructor before notifyVisualPositionChanged is assigned.
if (notifyVisualPositionChanged != null)
foreach (var n in notifyVisualPositionChanged)
n.VisualPositionChanged(self, 0, 0);
// This can be called from the constructor before notifyCenterPositionChanged is assigned.
if (notifyCenterPositionChanged != null)
foreach (var n in notifyCenterPositionChanged)
n.CenterPositionChanged(self, 0, 0);
}
public Activity MoveTo(CPos cell, int nearEnough = 0, Actor ignoreActor = null,
@@ -210,7 +210,7 @@ namespace OpenRA.Mods.Cnc.Traits
public Activity MoveToTarget(Actor self, in Target target,
WPos? initialTargetPosition = null, Color? targetLineColor = null) { return null; }
public Activity MoveIntoTarget(Actor self, in Target target) { return null; }
public Activity VisualMove(Actor self, WPos fromPos, WPos toPos) { return null; }
public Activity LocalMove(Actor self, WPos fromPos, WPos toPos) { return null; }
public int EstimatedMoveDuration(Actor self, WPos fromPos, WPos toPos)
{