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