movementtype
This commit is contained in:
@@ -7,6 +7,8 @@ namespace OpenRa.Game.Traits
|
|||||||
{
|
{
|
||||||
class MobileInfo : ITraitInfo
|
class MobileInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
|
public readonly UnitMovementType MovementType = UnitMovementType.Wheel;
|
||||||
|
|
||||||
public object Create(Actor self) { return new Mobile(self); }
|
public object Create(Actor self) { return new Mobile(self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,19 +85,7 @@ namespace OpenRa.Game.Traits
|
|||||||
|
|
||||||
public UnitMovementType GetMovementType()
|
public UnitMovementType GetMovementType()
|
||||||
{
|
{
|
||||||
switch (Rules.UnitCategory[self.Info.Name])
|
return self.Info.Traits.Get<MobileInfo>().MovementType;
|
||||||
{
|
|
||||||
case "Infantry":
|
|
||||||
return UnitMovementType.Foot;
|
|
||||||
case "Vehicle":
|
|
||||||
return (self.LegacyInfo as VehicleInfo).Tracked ? UnitMovementType.Track : UnitMovementType.Wheel;
|
|
||||||
case "Ship":
|
|
||||||
return UnitMovementType.Float;
|
|
||||||
case "Plane":
|
|
||||||
return UnitMovementType.Fly;
|
|
||||||
default:
|
|
||||||
throw new InvalidOperationException("GetMovementType on unit that shouldn't be able to move.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanEnterCell(int2 a)
|
public bool CanEnterCell(int2 a)
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ namespace RulesConverter
|
|||||||
},
|
},
|
||||||
|
|
||||||
{ "Mobile", new PL {
|
{ "Mobile", new PL {
|
||||||
//{ "MovementType", ... },
|
{ "MovementType", "$MovementType" } }
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "RenderBuilding", new PL {
|
{ "RenderBuilding", new PL {
|
||||||
@@ -186,7 +185,9 @@ namespace RulesConverter
|
|||||||
if (traitMap.ContainsKey(t))
|
if (traitMap.ContainsKey(t))
|
||||||
foreach (var kv in traitMap[t])
|
foreach (var kv in traitMap[t])
|
||||||
{
|
{
|
||||||
var v = kv.Value == "$Tab" ? cat.Value.Second : iniSection.GetValue(kv.Value, "");
|
var v = iniSection.GetValue(kv.Value, "");
|
||||||
|
if (kv.Value == "$Tab") v = cat.Value.Second;
|
||||||
|
if (kv.Value == "$MovementType") v = GetMovementType(iniSection, traits);
|
||||||
var fmt = "\t\t{0}: {1}";
|
var fmt = "\t\t{0}: {1}";
|
||||||
var k = kv.Key;
|
var k = kv.Key;
|
||||||
if (k.StartsWith("@")) { k = k.Substring(1); /*fmt = "\t\t{0}: [{1}]";*/ }
|
if (k.StartsWith("@")) { k = k.Substring(1); /*fmt = "\t\t{0}: [{1}]";*/ }
|
||||||
@@ -206,5 +207,19 @@ namespace RulesConverter
|
|||||||
yaml.OptimizeInherits( MiniYaml.FromFile( "defaults.yaml" ) );
|
yaml.OptimizeInherits( MiniYaml.FromFile( "defaults.yaml" ) );
|
||||||
yaml.WriteToFile( outputFile );
|
yaml.WriteToFile( outputFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string GetMovementType(IniSection unit, List<string> traits)
|
||||||
|
{
|
||||||
|
if (unit.GetValue("WaterBound", "no") == "yes")
|
||||||
|
return "Float";
|
||||||
|
if (unit.GetValue("Tracked", "no") == "yes")
|
||||||
|
return "Track";
|
||||||
|
if (traits.Contains("Plane") || traits.Contains("Helicopter"))
|
||||||
|
return "Fly";
|
||||||
|
if (traits.Contains("RenderInfantry"))
|
||||||
|
return "Foot";
|
||||||
|
|
||||||
|
return "Wheel";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ MSUB:
|
|||||||
Owner: soviet
|
Owner: soviet
|
||||||
Cost: 1650
|
Cost: 1650
|
||||||
Description: "Missile Submarine"
|
Description: "Missile Submarine"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 150
|
HP: 150
|
||||||
Armor: light
|
Armor: light
|
||||||
@@ -104,7 +103,6 @@ MSUB:
|
|||||||
Sight: 6
|
Sight: 6
|
||||||
Speed: 5
|
Speed: 5
|
||||||
WaterBound: yes
|
WaterBound: yes
|
||||||
Mobile:
|
|
||||||
AttackBase:
|
AttackBase:
|
||||||
PrimaryWeapon: SubSCUD
|
PrimaryWeapon: SubSCUD
|
||||||
FireDelay: 2
|
FireDelay: 2
|
||||||
@@ -128,7 +126,6 @@ SHOK:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 4
|
Sight: 4
|
||||||
Speed: 3
|
Speed: 3
|
||||||
Mobile:
|
|
||||||
AttackBase:
|
AttackBase:
|
||||||
PrimaryWeapon: PortaTesla
|
PrimaryWeapon: PortaTesla
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
@@ -153,7 +150,6 @@ MECH:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 3
|
Sight: 3
|
||||||
Speed: 4
|
Speed: 4
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
AutoHeal:
|
AutoHeal:
|
||||||
AttackBase:
|
AttackBase:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ DefaultVehicle:
|
|||||||
Unit:
|
Unit:
|
||||||
ROT: 5
|
ROT: 5
|
||||||
Mobile:
|
Mobile:
|
||||||
|
MovementType: Wheel
|
||||||
Selectable:
|
Selectable:
|
||||||
Voice: VehicleVoice
|
Voice: VehicleVoice
|
||||||
Repairable:
|
Repairable:
|
||||||
@@ -9,3 +10,18 @@ DefaultVehicle:
|
|||||||
Passenger:
|
Passenger:
|
||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
|
|
||||||
|
DefaultInfantry:
|
||||||
|
Unit:
|
||||||
|
Mobile:
|
||||||
|
MovementType: Foot
|
||||||
|
Selectable:
|
||||||
|
|
||||||
|
DefaultShip:
|
||||||
|
Unit:
|
||||||
|
Mobile:
|
||||||
|
MovementType: Float
|
||||||
|
Selectable:
|
||||||
|
|
||||||
|
DefaultPlane:
|
||||||
|
Unit:
|
||||||
|
Selectable:
|
||||||
25
ra.yaml
25
ra.yaml
@@ -339,7 +339,6 @@ SS:
|
|||||||
Cost: 950
|
Cost: 950
|
||||||
Description: "Submarine"
|
Description: "Submarine"
|
||||||
LongDesc: "Submerged anti-ship unit armed with \ntorpedoes.\n Strong vs Ships\n Weak vs Everything\n Special Ability: Submerge"
|
LongDesc: "Submerged anti-ship unit armed with \ntorpedoes.\n Strong vs Ships\n Weak vs Everything\n Special Ability: Submerge"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 120
|
HP: 120
|
||||||
Armor: light
|
Armor: light
|
||||||
@@ -347,7 +346,6 @@ SS:
|
|||||||
Sight: 6
|
Sight: 6
|
||||||
Speed: 6
|
Speed: 6
|
||||||
WaterBound: yes
|
WaterBound: yes
|
||||||
Mobile:
|
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
Submarine:
|
Submarine:
|
||||||
AttackBase:
|
AttackBase:
|
||||||
@@ -367,7 +365,6 @@ DD:
|
|||||||
Cost: 1000
|
Cost: 1000
|
||||||
Description: "Destroyer"
|
Description: "Destroyer"
|
||||||
LongDesc: "Fast multi-role ship. \n Strong vs Submarines, Aircraft\n Weak vs Infantry, Tanks"
|
LongDesc: "Fast multi-role ship. \n Strong vs Submarines, Aircraft\n Weak vs Infantry, Tanks"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 400
|
HP: 400
|
||||||
Armor: heavy
|
Armor: heavy
|
||||||
@@ -375,7 +372,6 @@ DD:
|
|||||||
Sight: 6
|
Sight: 6
|
||||||
Speed: 6
|
Speed: 6
|
||||||
WaterBound: yes
|
WaterBound: yes
|
||||||
Mobile:
|
|
||||||
Turreted:
|
Turreted:
|
||||||
AttackTurreted:
|
AttackTurreted:
|
||||||
PrimaryWeapon: Stinger
|
PrimaryWeapon: Stinger
|
||||||
@@ -396,7 +392,6 @@ CA:
|
|||||||
Cost: 2000
|
Cost: 2000
|
||||||
Description: "Cruiser"
|
Description: "Cruiser"
|
||||||
LongDesc: "Very slow long-range ship. \n Strong vs Buildings\n Weak vs Ships, Submarines"
|
LongDesc: "Very slow long-range ship. \n Strong vs Buildings\n Weak vs Ships, Submarines"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 700
|
HP: 700
|
||||||
Armor: heavy
|
Armor: heavy
|
||||||
@@ -404,7 +399,6 @@ CA:
|
|||||||
Sight: 7
|
Sight: 7
|
||||||
Speed: 4
|
Speed: 4
|
||||||
WaterBound: yes
|
WaterBound: yes
|
||||||
Mobile:
|
|
||||||
Turreted:
|
Turreted:
|
||||||
AttackTurreted:
|
AttackTurreted:
|
||||||
PrimaryWeapon: 8Inch
|
PrimaryWeapon: 8Inch
|
||||||
@@ -425,7 +419,6 @@ LST:
|
|||||||
Cost: 700
|
Cost: 700
|
||||||
Description: "Transport"
|
Description: "Transport"
|
||||||
LongDesc: "General-purpose naval transport.\nCan carry infantry and tanks.\n Unarmed"
|
LongDesc: "General-purpose naval transport.\nCan carry infantry and tanks.\n Unarmed"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 350
|
HP: 350
|
||||||
Armor: heavy
|
Armor: heavy
|
||||||
@@ -433,7 +426,6 @@ LST:
|
|||||||
Sight: 6
|
Sight: 6
|
||||||
Speed: 14
|
Speed: 14
|
||||||
WaterBound: yes
|
WaterBound: yes
|
||||||
Mobile:
|
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
Cargo:
|
Cargo:
|
||||||
PassengerTypes: Foot,Wheel,Track
|
PassengerTypes: Foot,Wheel,Track
|
||||||
@@ -451,7 +443,6 @@ PT:
|
|||||||
Cost: 500
|
Cost: 500
|
||||||
Description: "Gunboat"
|
Description: "Gunboat"
|
||||||
LongDesc: "Light scout & support ship. \n Strong vs Ships, Submarines\n Weak vs Aircraft"
|
LongDesc: "Light scout & support ship. \n Strong vs Ships, Submarines\n Weak vs Aircraft"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 200
|
HP: 200
|
||||||
Armor: heavy
|
Armor: heavy
|
||||||
@@ -459,7 +450,6 @@ PT:
|
|||||||
Sight: 7
|
Sight: 7
|
||||||
Speed: 9
|
Speed: 9
|
||||||
WaterBound: yes
|
WaterBound: yes
|
||||||
Mobile:
|
|
||||||
Turreted:
|
Turreted:
|
||||||
AttackTurreted:
|
AttackTurreted:
|
||||||
PrimaryWeapon: 2Inch
|
PrimaryWeapon: 2Inch
|
||||||
@@ -480,7 +470,6 @@ MIG:
|
|||||||
Cost: 1200
|
Cost: 1200
|
||||||
Description: "Mig Attack Plane"
|
Description: "Mig Attack Plane"
|
||||||
LongDesc: "Fast Ground-Attack Plane.\n Strong vs Buildings\n Weak vs Infantry, Light Vehicles"
|
LongDesc: "Fast Ground-Attack Plane.\n Strong vs Buildings\n Weak vs Infantry, Light Vehicles"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 50
|
HP: 50
|
||||||
Armor: light
|
Armor: light
|
||||||
@@ -508,7 +497,6 @@ YAK:
|
|||||||
Cost: 800
|
Cost: 800
|
||||||
Description: "Yak Attack Plane"
|
Description: "Yak Attack Plane"
|
||||||
LongDesc: "Anti-Tanks & Anti-Infantry Plane.\n Strong vs Infantry, Tanks\n Weak vs Buildings"
|
LongDesc: "Anti-Tanks & Anti-Infantry Plane.\n Strong vs Infantry, Tanks\n Weak vs Buildings"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 60
|
HP: 60
|
||||||
Armor: light
|
Armor: light
|
||||||
@@ -537,7 +525,6 @@ TRAN:
|
|||||||
Cost: 1200
|
Cost: 1200
|
||||||
Description: "Transport Helicopter"
|
Description: "Transport Helicopter"
|
||||||
LongDesc: "Fast Infantry Transport Helicopter.\n Unarmed"
|
LongDesc: "Fast Infantry Transport Helicopter.\n Unarmed"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 90
|
HP: 90
|
||||||
Armor: light
|
Armor: light
|
||||||
@@ -566,7 +553,6 @@ HELI:
|
|||||||
Cost: 1200
|
Cost: 1200
|
||||||
Description: "Longbow"
|
Description: "Longbow"
|
||||||
LongDesc: "Helicopter Gunship with AG Missiles.\n Strong vs Buildings, Tanks\n Weak vs Infantry"
|
LongDesc: "Helicopter Gunship with AG Missiles.\n Strong vs Buildings, Tanks\n Weak vs Infantry"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 225
|
HP: 225
|
||||||
Armor: heavy
|
Armor: heavy
|
||||||
@@ -598,7 +584,6 @@ HIND:
|
|||||||
Cost: 1200
|
Cost: 1200
|
||||||
Description: "Hind"
|
Description: "Hind"
|
||||||
LongDesc: "Helicopter Gunship with Chainguns.\n Strong vs Infantry, Light Vehicles.\n Weak vs Tanks"
|
LongDesc: "Helicopter Gunship with Chainguns.\n Strong vs Infantry, Light Vehicles.\n Weak vs Tanks"
|
||||||
Selectable:
|
|
||||||
Unit:
|
Unit:
|
||||||
HP: 225
|
HP: 225
|
||||||
Armor: heavy
|
Armor: heavy
|
||||||
@@ -2152,7 +2137,6 @@ DOG:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 5
|
Sight: 5
|
||||||
Speed: 4
|
Speed: 4
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
Passenger:
|
Passenger:
|
||||||
|
|
||||||
@@ -2172,7 +2156,6 @@ E1:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 4
|
Sight: 4
|
||||||
Speed: 4
|
Speed: 4
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
AttackBase:
|
AttackBase:
|
||||||
PrimaryWeapon: M1Carbine
|
PrimaryWeapon: M1Carbine
|
||||||
@@ -2197,7 +2180,6 @@ E2:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 4
|
Sight: 4
|
||||||
Speed: 5
|
Speed: 5
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
AttackBase:
|
AttackBase:
|
||||||
PrimaryWeapon: Grenade
|
PrimaryWeapon: Grenade
|
||||||
@@ -2224,7 +2206,6 @@ E3:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 4
|
Sight: 4
|
||||||
Speed: 3
|
Speed: 3
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
AttackBase:
|
AttackBase:
|
||||||
PrimaryWeapon: RedEye
|
PrimaryWeapon: RedEye
|
||||||
@@ -2251,7 +2232,6 @@ E4:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 4
|
Sight: 4
|
||||||
Speed: 3
|
Speed: 3
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
AttackBase:
|
AttackBase:
|
||||||
PrimaryWeapon: Flamer
|
PrimaryWeapon: Flamer
|
||||||
@@ -2279,7 +2259,6 @@ E6:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 4
|
Sight: 4
|
||||||
Speed: 4
|
Speed: 4
|
||||||
Mobile:
|
|
||||||
EngineerCapture:
|
EngineerCapture:
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
TakeCover:
|
TakeCover:
|
||||||
@@ -2304,7 +2283,6 @@ SPY:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 5
|
Sight: 5
|
||||||
Speed: 4
|
Speed: 4
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
TakeCover:
|
TakeCover:
|
||||||
SquishByTank:
|
SquishByTank:
|
||||||
@@ -2328,7 +2306,6 @@ THF:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 5
|
Sight: 5
|
||||||
Speed: 4
|
Speed: 4
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
TakeCover:
|
TakeCover:
|
||||||
SquishByTank:
|
SquishByTank:
|
||||||
@@ -2353,7 +2330,6 @@ E7:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 6
|
Sight: 6
|
||||||
Speed: 5
|
Speed: 5
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
C4Demolition:
|
C4Demolition:
|
||||||
AttackBase:
|
AttackBase:
|
||||||
@@ -2380,7 +2356,6 @@ MEDI:
|
|||||||
Armor: none
|
Armor: none
|
||||||
Sight: 3
|
Sight: 3
|
||||||
Speed: 4
|
Speed: 4
|
||||||
Mobile:
|
|
||||||
RenderInfantry:
|
RenderInfantry:
|
||||||
AutoHeal:
|
AutoHeal:
|
||||||
AttackBase:
|
AttackBase:
|
||||||
|
|||||||
Reference in New Issue
Block a user