Refactor Shape.Rectangle.RotateToIsometry
And fixes TS wall and gate shapes.
This commit is contained in:
@@ -33,10 +33,9 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
[Desc("Defines the bottom offset relative to the actor's target point.")]
|
||||
public readonly int VerticalBottomOffset = 0;
|
||||
|
||||
// This is just a temporary work-around until we have a customizable PolygonShape
|
||||
[Desc("Rotates shape by 90 degree relative to actor facing. Mostly required for buildings on isometric terrain.",
|
||||
[Desc("Rotates shape by an angle relative to actor facing. Mostly required for buildings on isometric terrain.",
|
||||
"Mobile actors do NOT need this!")]
|
||||
public readonly bool RotateToIsometry = false;
|
||||
public readonly WAngle LocalYaw = WAngle.Zero;
|
||||
|
||||
// This is just a temporary work-around until we have a customizable PolygonShape
|
||||
[Desc("Applies shape to every TargetablePosition instead of just CenterPosition.")]
|
||||
@@ -98,8 +97,7 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
public WDist DistanceFromEdge(WPos pos, Actor actor)
|
||||
{
|
||||
var actorPos = actor.CenterPosition;
|
||||
var orientation = new WRot(actor.Orientation.Roll, actor.Orientation.Pitch,
|
||||
new WAngle(actor.Orientation.Yaw.Angle + (RotateToIsometry ? 128 : 0)));
|
||||
var orientation = actor.Orientation + WRot.FromYaw(LocalYaw);
|
||||
|
||||
var targetablePositions = actor.TraitsImplementing<ITargetablePositions>();
|
||||
if (ApplyToAllTargetablePositions && targetablePositions.Any())
|
||||
@@ -120,8 +118,7 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
public void DrawCombatOverlay(WorldRenderer wr, RgbaColorRenderer wcr, Actor actor)
|
||||
{
|
||||
var actorPos = actor.CenterPosition;
|
||||
var orientation = new WRot(actor.Orientation.Roll, actor.Orientation.Pitch,
|
||||
new WAngle(actor.Orientation.Yaw.Angle + (RotateToIsometry ? 128 : 0)));
|
||||
var orientation = actor.Orientation + WRot.FromYaw(LocalYaw);
|
||||
|
||||
var targetablePositions = actor.TraitsImplementing<ITargetablePositions>();
|
||||
if (ApplyToAllTargetablePositions && targetablePositions.Any())
|
||||
|
||||
@@ -651,6 +651,18 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
// Refactor Rectangle shape RotateToIsometry bool into WAngle LocalYaw
|
||||
if (engineVersion < 20170509)
|
||||
{
|
||||
if (node.Key.StartsWith("RotateToIsometry", StringComparison.Ordinal))
|
||||
{
|
||||
var value = FieldLoader.GetValue<bool>("RotateToIsometry", node.Value.Value);
|
||||
node.Value.Value = value ? "128" : "0";
|
||||
|
||||
node.Key = "LocalYaw";
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -284,9 +284,9 @@
|
||||
ConditionManager:
|
||||
Health:
|
||||
Shape: Rectangle
|
||||
RotateToIsometry: true
|
||||
TopLeft: -384, -384
|
||||
BottomRight: 384, 384
|
||||
LocalYaw: 128
|
||||
TopLeft: -512, -512
|
||||
BottomRight: 512, 512
|
||||
VerticalTopOffset: 512
|
||||
|
||||
^BuildingPlug:
|
||||
@@ -899,6 +899,11 @@
|
||||
Cost: 250
|
||||
Health:
|
||||
HP: 350
|
||||
Shape: Rectangle
|
||||
LocalYaw: 128
|
||||
TopLeft: -512, -512
|
||||
BottomRight: 512, 512
|
||||
VerticalTopOffset: 640
|
||||
Armor:
|
||||
Type: Heavy
|
||||
LineBuildNode:
|
||||
@@ -923,6 +928,10 @@
|
||||
|
||||
^Gate_A:
|
||||
Inherits: ^Gate
|
||||
Health:
|
||||
Shape: Rectangle
|
||||
TopLeft: -512, -1536
|
||||
BottomRight: 512, 1536
|
||||
Gate:
|
||||
Dimensions: 3,1
|
||||
Footprint: xxx
|
||||
@@ -933,6 +942,10 @@
|
||||
|
||||
^Gate_B:
|
||||
Inherits: ^Gate
|
||||
Health:
|
||||
Shape: Rectangle
|
||||
TopLeft: -1536, -512
|
||||
BottomRight: 1536, 512
|
||||
Gate:
|
||||
Dimensions: 1,3
|
||||
Footprint: x x x
|
||||
|
||||
Reference in New Issue
Block a user