new syntax in miniyaml: "-Key:" blocks inheritance of Key.
This commit is contained in:
@@ -66,12 +66,23 @@ namespace OpenRa.FileFormats
|
||||
|
||||
var keys = a.Keys.Union( b.Keys ).ToList();
|
||||
|
||||
var noInherit = keys.Where( x => x.Length > 0 && x[ 0 ] == '-' ).Select( x => x.Substring( 1 ) ).ToList();
|
||||
|
||||
foreach( var key in keys )
|
||||
{
|
||||
MiniYaml aa, bb;
|
||||
a.TryGetValue( key, out aa );
|
||||
b.TryGetValue( key, out bb );
|
||||
ret.Add( key, Merge( aa, bb ) );
|
||||
|
||||
if( key.Length > 0 && key[ 0 ] == '-' )
|
||||
continue;
|
||||
else if( noInherit.Contains( key ) )
|
||||
{
|
||||
if( aa != null )
|
||||
ret.Add( key, aa );
|
||||
}
|
||||
else
|
||||
ret.Add( key, Merge( aa, bb ) );
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace OpenRa.Game.Traits
|
||||
class UnitInfo : OwnedActorInfo, ITraitInfo
|
||||
{
|
||||
public readonly int InitialFacing = 128;
|
||||
public readonly int ROT = 0;
|
||||
public readonly int Speed = 0;
|
||||
public readonly int ROT = 255;
|
||||
public readonly int Speed = 1;
|
||||
|
||||
public object Create( Actor self ) { return new Unit( self ); }
|
||||
}
|
||||
|
||||
@@ -52,7 +52,10 @@ namespace RulesConverter
|
||||
if( parent == null )
|
||||
continue;
|
||||
|
||||
y[ key ] = Diff( node, parent );
|
||||
bool remove;
|
||||
y[ key ] = Diff( node, parent, out remove );
|
||||
if( remove )
|
||||
y.Add( "-" + key, new MiniYaml( null ) );
|
||||
if( y[ key ] == null )
|
||||
y.Remove( key );
|
||||
}
|
||||
@@ -81,7 +84,11 @@ namespace RulesConverter
|
||||
MiniYaml aa, bb;
|
||||
a.TryGetValue( key, out aa );
|
||||
b.TryGetValue( key, out bb );
|
||||
var diff = Diff( aa, bb );
|
||||
bool remove;
|
||||
var diff = Diff( aa, bb, out remove );
|
||||
if( remove )
|
||||
ret.Add( "-" + key, new MiniYaml( null ) );
|
||||
|
||||
if( diff != null )
|
||||
ret.Add( key, diff );
|
||||
}
|
||||
@@ -90,12 +97,16 @@ namespace RulesConverter
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static MiniYaml Diff( MiniYaml a, MiniYaml b )
|
||||
public static MiniYaml Diff( MiniYaml a, MiniYaml b, out bool remove )
|
||||
{
|
||||
remove = false;
|
||||
if( a == null && b == null )
|
||||
throw new InvalidOperationException( "can't happen" );
|
||||
else if( a == null )
|
||||
throw new NotImplementedException( "parent has key not in child" );
|
||||
{
|
||||
remove = true;
|
||||
return a;
|
||||
}
|
||||
else if( b == null )
|
||||
return a;
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ SHOK:
|
||||
AttackBase:
|
||||
PrimaryWeapon: PortaTesla
|
||||
TakeCover:
|
||||
-SquishByTank:
|
||||
|
||||
MECH:
|
||||
Inherits: ^Infantry
|
||||
@@ -151,5 +152,5 @@ MECH:
|
||||
AttackBase:
|
||||
PrimaryWeapon: GoodWrench
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
-AutoTarget:
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ MECH
|
||||
|
||||
[SHOK]
|
||||
Description=Tesla Trooper
|
||||
Traits=Unit, Mobile, AttackBase, RenderInfantry, TakeCover, Passenger
|
||||
Traits=Unit, Mobile, AttackBase, RenderInfantry, TakeCover, AutoTarget, Passenger
|
||||
SquadSize=1
|
||||
Voice=ShokVoice
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
MovementType: Foot
|
||||
Selectable:
|
||||
RenderInfantry:
|
||||
SquishByTank:
|
||||
AutoTarget:
|
||||
Passenger:
|
||||
|
||||
^Ship:
|
||||
|
||||
89
ra.yaml
89
ra.yaml
@@ -1384,170 +1384,195 @@ DOMF:
|
||||
Fake:
|
||||
|
||||
MINP:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Unit:
|
||||
HP: 1
|
||||
RenderUnit:
|
||||
APMine:
|
||||
BelowUnits:
|
||||
InvisibleToOthers:
|
||||
-Selectable:
|
||||
-Building:
|
||||
|
||||
MINV:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Unit:
|
||||
HP: 1
|
||||
RenderUnit:
|
||||
ATMine:
|
||||
BelowUnits:
|
||||
InvisibleToOthers:
|
||||
-Selectable:
|
||||
-Building:
|
||||
|
||||
T01:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x_ x_
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T02:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x_ x_
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T03:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x_ x_
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T05:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x_ x_
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T06:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x_ x_
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T07:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x_ x_
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T08:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x_
|
||||
Dimensions: 2,1
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T10:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xx xx
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T11:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xx xx
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T12:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xx xx
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T13:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xx xx
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T14:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xx xx
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T15:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xx xx
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T16:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x_ x_
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
T17:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x_ x_
|
||||
Dimensions: 2,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
TC01:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xx_ xx_
|
||||
Dimensions: 3,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
TC02:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xx_ xx_
|
||||
Dimensions: 3,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
TC03:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xx_ xx_
|
||||
Dimensions: 3,2
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
TC04:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xxx_ xxx_ xxx_
|
||||
Dimensions: 4,3
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
TC05:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: xxx_ xxx_ xxx_
|
||||
Dimensions: 4,3
|
||||
RenderBuilding:
|
||||
-Selectable:
|
||||
|
||||
MINE:
|
||||
Category: Building
|
||||
Inherits: ^Building
|
||||
Building:
|
||||
Footprint: x
|
||||
Dimensions: 1,1
|
||||
RenderBuilding:
|
||||
SeedsOre:
|
||||
-Selectable:
|
||||
|
||||
FCOM:
|
||||
Inherits: ^Building
|
||||
@@ -1991,8 +2016,6 @@ E1:
|
||||
AttackBase:
|
||||
PrimaryWeapon: M1Carbine
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
AutoTarget:
|
||||
|
||||
E2:
|
||||
Inherits: ^Infantry
|
||||
@@ -2012,8 +2035,6 @@ E2:
|
||||
PrimaryOffset: 0,0,0,-13
|
||||
FireDelay: 15
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
AutoTarget:
|
||||
|
||||
E3:
|
||||
Inherits: ^Infantry
|
||||
@@ -2032,8 +2053,6 @@ E3:
|
||||
PrimaryWeapon: RedEye
|
||||
PrimaryOffset: 0,0,0,-13
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
AutoTarget:
|
||||
|
||||
E4:
|
||||
Inherits: ^Infantry
|
||||
@@ -2054,8 +2073,6 @@ E4:
|
||||
PrimaryOffset: 0,0,0,-7
|
||||
FireDelay: 8
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
AutoTarget:
|
||||
|
||||
E6:
|
||||
Inherits: ^Infantry
|
||||
@@ -2073,7 +2090,7 @@ E6:
|
||||
Speed: 4
|
||||
EngineerCapture:
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
-AutoTarget:
|
||||
|
||||
SPY:
|
||||
Inherits: ^Infantry
|
||||
@@ -2092,7 +2109,7 @@ SPY:
|
||||
Sight: 5
|
||||
Speed: 4
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
-AutoTarget:
|
||||
|
||||
THF:
|
||||
Inherits: ^Infantry
|
||||
@@ -2111,8 +2128,8 @@ THF:
|
||||
Sight: 5
|
||||
Speed: 4
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
Thief:
|
||||
-AutoTarget:
|
||||
|
||||
E7:
|
||||
Inherits: ^Infantry
|
||||
@@ -2134,8 +2151,6 @@ E7:
|
||||
AttackBase:
|
||||
PrimaryWeapon: Colt45
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
AutoTarget:
|
||||
|
||||
MEDI:
|
||||
Inherits: ^Infantry
|
||||
@@ -2156,5 +2171,5 @@ MEDI:
|
||||
AttackBase:
|
||||
PrimaryWeapon: Heal
|
||||
TakeCover:
|
||||
SquishByTank:
|
||||
-AutoTarget:
|
||||
|
||||
|
||||
@@ -549,7 +549,7 @@ MEDI
|
||||
Description=Attack Dog
|
||||
BuiltAt=KENN
|
||||
Voice=DogVoice
|
||||
Traits=Unit, Mobile, RenderInfantry, Passenger ;; AttackBase, SquishByTank, AutoTarget, dog??
|
||||
Traits=Unit, Mobile, RenderInfantry, SquishByTank, AutoTarget, Passenger ;; AttackBase, SquishByTank, AutoTarget, dog??
|
||||
LongDesc=Anti-infantry unit. Not fooled by the \nSpy's disguise.\n Strong vs Infantry\n Weak vs Vehicles
|
||||
SelectionSize=12,17,-1,-4
|
||||
[E1]
|
||||
|
||||
Reference in New Issue
Block a user