Selection box size now defaults to Selectable.Bounds if VisualBounds are null
This commit is contained in:
@@ -115,11 +115,13 @@ namespace OpenRA
|
|||||||
visualBounds = Exts.Lazy(() =>
|
visualBounds = Exts.Lazy(() =>
|
||||||
{
|
{
|
||||||
var sd = Info.Traits.GetOrDefault<ISelectionDecorationsInfo>();
|
var sd = Info.Traits.GetOrDefault<ISelectionDecorationsInfo>();
|
||||||
var size = (sd != null && sd.SelectionBoxBounds != null) ? new int2(sd.SelectionBoxBounds[0], sd.SelectionBoxBounds[1]) :
|
if (sd == null || sd.SelectionBoxBounds == null)
|
||||||
TraitsImplementing<IAutoSelectionSize>().Select(x => x.SelectionSize(this)).FirstOrDefault();
|
return bounds.Value;
|
||||||
|
|
||||||
|
var size = new int2(sd.SelectionBoxBounds[0], sd.SelectionBoxBounds[1]);
|
||||||
|
|
||||||
var offset = -size / 2;
|
var offset = -size / 2;
|
||||||
if (sd != null && sd.SelectionBoxBounds != null && sd.SelectionBoxBounds.Length > 2)
|
if (sd.SelectionBoxBounds.Length > 2)
|
||||||
offset += new int2(sd.SelectionBoxBounds[2], sd.SelectionBoxBounds[3]);
|
offset += new int2(sd.SelectionBoxBounds[2], sd.SelectionBoxBounds[3]);
|
||||||
|
|
||||||
return new Rectangle(offset.X, offset.Y, size.X, size.Y);
|
return new Rectangle(offset.X, offset.Y, size.X, size.Y);
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
Beach: 50
|
Beach: 50
|
||||||
ROT: 5
|
ROT: 5
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 24,24
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 24,24
|
Bounds: 24,24
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
@@ -82,7 +81,6 @@
|
|||||||
Beach: 70
|
Beach: 70
|
||||||
ROT: 5
|
ROT: 5
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 24,24
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 24,24
|
Bounds: 24,24
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
@@ -128,7 +126,6 @@
|
|||||||
TargetTypes: Air
|
TargetTypes: Air
|
||||||
GroundedTargetTypes: Ground
|
GroundedTargetTypes: Ground
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 24,24
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 24,24
|
Bounds: 24,24
|
||||||
Helicopter:
|
Helicopter:
|
||||||
@@ -183,7 +180,6 @@
|
|||||||
PathingCost: 300
|
PathingCost: 300
|
||||||
Beach: 80
|
Beach: 80
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 12,17,0,-6
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 12,17,0,-6
|
Bounds: 12,17,0,-6
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
@@ -305,7 +301,6 @@
|
|||||||
BlueTiberium: 70
|
BlueTiberium: 70
|
||||||
Beach: 80
|
Beach: 80
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 24,24
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 24,24
|
Bounds: 24,24
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
@@ -337,7 +332,6 @@
|
|||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
UseLocation: yes
|
UseLocation: yes
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 24,24
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 24,24
|
Bounds: 24,24
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
Dune: 60
|
Dune: 60
|
||||||
ROT: 5
|
ROT: 5
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 32,32
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 32,32
|
Bounds: 32,32
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
@@ -91,7 +90,6 @@
|
|||||||
Dune: 70
|
Dune: 70
|
||||||
ROT: 5
|
ROT: 5
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 32,32
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 32,32
|
Bounds: 32,32
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
@@ -217,7 +215,6 @@
|
|||||||
Dune: 60
|
Dune: 60
|
||||||
Rough: 70
|
Rough: 70
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 12,18,0,-6
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 12,18,0,-6
|
Bounds: 12,18,0,-6
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
@@ -275,7 +272,6 @@
|
|||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
UseLocation: yes
|
UseLocation: yes
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 32,32
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 32,32
|
Bounds: 32,32
|
||||||
TargetableAircraft:
|
TargetableAircraft:
|
||||||
|
|||||||
@@ -181,7 +181,6 @@
|
|||||||
Gems: 80
|
Gems: 80
|
||||||
Beach: 80
|
Beach: 80
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 12,18,0,-8
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 12,18,0,-8
|
Bounds: 12,18,0,-8
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
|
|||||||
@@ -212,7 +212,6 @@
|
|||||||
BlueTiberium: 80
|
BlueTiberium: 80
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
Palette: pips
|
Palette: pips
|
||||||
VisualBounds: 14,23,-1,-9
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 14,23,-1,-9
|
Bounds: 14,23,-1,-9
|
||||||
Voiced:
|
Voiced:
|
||||||
@@ -500,7 +499,6 @@
|
|||||||
BlueTiberium: 100
|
BlueTiberium: 100
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
Palette: pips
|
Palette: pips
|
||||||
VisualBounds: 26,26,0,-3
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 26,26,0,-3
|
Bounds: 26,26,0,-3
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
|
|||||||
Reference in New Issue
Block a user