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