Moved ROT from Mobile/Heli/Plane to Unit.

This commit is contained in:
Bob
2010-01-12 21:11:38 +13:00
parent 06969138aa
commit 901d48edfa
14 changed files with 29 additions and 25 deletions

View File

@@ -31,7 +31,7 @@ namespace OpenRa.Game.Traits.Activities
var desiredFacing = Util.GetFacing(d, unit.Facing);
if (unit.Altitude == CruiseAltitude)
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<PlaneInfo>().ROT);
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<UnitInfo>().ROT);
var speed = .2f * Util.GetEffectiveSpeed(self);
var angle = unit.Facing / 128f * Math.PI;

View File

@@ -34,7 +34,7 @@ namespace OpenRa.Game.Traits.Activities
var dist = target.CenterLocation - self.CenterLocation;
var desiredFacing = Util.GetFacing(dist, unit.Facing);
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<HelicopterInfo>().ROT);
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<UnitInfo>().ROT);
if (!float2.WithinEpsilon(float2.Zero, dist, range * Game.CellSize))
{

View File

@@ -40,7 +40,7 @@ namespace OpenRa.Game.Traits.Activities
var desiredFacing = Util.GetFacing(dist, unit.Facing);
Util.TickFacing(ref unit.Facing, desiredFacing,
self.Info.Traits.Get<HelicopterInfo>().ROT);
self.Info.Traits.Get<UnitInfo>().ROT);
var rawSpeed = .2f * Util.GetEffectiveSpeed(self);
self.CenterLocation += (rawSpeed / dist.Length) * dist;

View File

@@ -28,7 +28,7 @@ namespace OpenRa.Game.Traits.Activities
--unit.Altitude;
var desiredFacing = Util.GetFacing(d, unit.Facing);
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<PlaneInfo>().ROT);
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<UnitInfo>().ROT);
var speed = .2f * Util.GetEffectiveSpeed(self);
var angle = unit.Facing / 128f * Math.PI;

View File

@@ -41,7 +41,7 @@ namespace OpenRa.Game.Traits.Activities
var unit = self.traits.Get<Unit>();
var speed = .2f * Util.GetEffectiveSpeed(self);
var approachStart = landPos - new float2(unit.Altitude * speed, 0);
var turnRadius = (128f / self.Info.Traits.Get<PlaneInfo>().ROT) * speed / (float)Math.PI;
var turnRadius = (128f / self.Info.Traits.Get<UnitInfo>().ROT) * speed / (float)Math.PI;
/* work out the center points */
var fwd = -float2.FromAngle(unit.Facing / 128f * (float)Math.PI);

View File

@@ -19,7 +19,7 @@ namespace OpenRa.Game.Traits.Activities
if( desiredFacing == unit.Facing )
return NextActivity;
Util.TickFacing( ref unit.Facing, desiredFacing, self.Info.Traits.Get<MobileInfo>().ROT );
Util.TickFacing( ref unit.Facing, desiredFacing, self.Info.Traits.Get<UnitInfo>().ROT );
return this;
}

View File

@@ -7,7 +7,6 @@ namespace OpenRa.Game.Traits
{
class HelicopterInfo : ITraitInfo
{
public readonly int ROT = 0;
public readonly int Speed = 0;
public object Create(Actor self) { return new Helicopter(self); }

View File

@@ -5,7 +5,6 @@ namespace OpenRa.Game.Traits
{
class PlaneInfo : ITraitInfo
{
public readonly int ROT = 0;
public readonly int Speed = 0;
public object Create(Actor self) { return new Plane(self); }

View File

@@ -4,6 +4,8 @@ namespace OpenRa.Game.Traits
{
class UnitInfo : OwnedActorInfo, ITraitInfo
{
public readonly int ROT = 0;
public object Create( Actor self ) { return new Unit( self ); }
}

View File

@@ -41,6 +41,7 @@ namespace RulesConverter
{ "Armor", "Armor" },
{ "Crewed", "Crewed" },
{ "InitialFacing", "InitialFacing" },
{ "ROT", "ROT" },
{ "Sight", "Sight" },
{ "WaterBound", "WaterBound" } }
},
@@ -52,18 +53,15 @@ namespace RulesConverter
},
{ "Mobile", new PL {
{ "ROT", "ROT" },
{ "Speed", "Speed" } }
//{ "MovementType", ... },
},
{ "Plane", new PL {
{ "ROT", "ROT" },
{ "Speed", "Speed" } }
},
{ "Helicopter", new PL {
{ "ROT", "ROT" },
{ "Speed", "Speed" } }
},

View File

@@ -105,10 +105,10 @@ MSUB:
Unit:
HP: 150
Armor: light
ROT: 7
Sight: 6
WaterBound: yes
Mobile:
ROT: 7
Speed: 5
AttackBase:
PrimaryWeapon: SubSCUD

View File

@@ -1,6 +1,7 @@
DefaultVehicle:
Mobile:
Unit:
ROT: 5
Mobile:
Selectable:
Voice: VehicleVoice
Repairable:

20
ra.yaml
View File

@@ -358,10 +358,10 @@ SS:
Unit:
HP: 120
Armor: light
ROT: 7
Sight: 6
WaterBound: yes
Mobile:
ROT: 7
Speed: 6
RenderUnit:
Submarine:
@@ -386,10 +386,10 @@ DD:
Unit:
HP: 400
Armor: heavy
ROT: 7
Sight: 6
WaterBound: yes
Mobile:
ROT: 7
Speed: 6
Turreted:
AttackTurreted:
@@ -415,10 +415,10 @@ CA:
Unit:
HP: 700
Armor: heavy
ROT: 5
Sight: 7
WaterBound: yes
Mobile:
ROT: 5
Speed: 4
Turreted:
AttackTurreted:
@@ -444,10 +444,10 @@ LST:
Unit:
HP: 350
Armor: heavy
ROT: 10
Sight: 6
WaterBound: yes
Mobile:
ROT: 10
Speed: 14
RenderUnit:
Cargo:
@@ -470,10 +470,10 @@ PT:
Unit:
HP: 200
Armor: heavy
ROT: 7
Sight: 7
WaterBound: yes
Mobile:
ROT: 7
Speed: 9
Turreted:
AttackTurreted:
@@ -500,11 +500,11 @@ MIG:
HP: 50
Armor: light
InitialFacing: 192
ROT: 5
Sight: 0
AttackPlane:
PrimaryWeapon: Maverick
Plane:
ROT: 5
Speed: 20
RenderUnit:
WithShadow:
@@ -529,11 +529,11 @@ YAK:
Armor: light
Crewed: yes
InitialFacing: 192
ROT: 5
Sight: 0
AttackPlane:
PrimaryWeapon: ChainGun
Plane:
ROT: 5
Speed: 16
RenderUnit:
WithShadow:
@@ -557,9 +557,9 @@ TRAN:
HP: 90
Armor: light
InitialFacing: 20
ROT: 5
Sight: 0
Helicopter:
ROT: 5
Speed: 12
RenderUnitRotor:
PrimaryOffset: 0,14,0,-4
@@ -587,13 +587,13 @@ HELI:
Armor: heavy
Crewed: yes
InitialFacing: 20
ROT: 4
Sight: 0
AttackHeli:
PrimaryWeapon: Hellfire
PrimaryOffset: -5,0,0,2
SecondaryOffset: 5,0,0,2
Helicopter:
ROT: 4
Speed: 16
RenderUnitRotor:
PrimaryOffset: 0,0,0,-2
@@ -619,13 +619,13 @@ HIND:
Armor: heavy
Crewed: yes
InitialFacing: 20
ROT: 4
Sight: 0
AttackHeli:
PrimaryWeapon: ChainGun
PrimaryOffset: -5,0,0,2
SecondaryOffset: 5,0,0,2
Helicopter:
ROT: 4
Speed: 12
RenderUnitRotor:
WithShadow:

View File

@@ -11,3 +11,8 @@ s2=Multi1,mcv,600,12505,0,Guard,None
s3=Multi3,mcv,600,2910,0,Guard,None
;s4=Multi1,ctnk,600,12506,Gaurd,None
s5=Multi1,apc,600,12510,Gaurd,None
s6=Multi0,heli,600,2842,0,Guard,None