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); var desiredFacing = Util.GetFacing(d, unit.Facing);
if (unit.Altitude == CruiseAltitude) 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 speed = .2f * Util.GetEffectiveSpeed(self);
var angle = unit.Facing / 128f * Math.PI; 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 dist = target.CenterLocation - self.CenterLocation;
var desiredFacing = Util.GetFacing(dist, unit.Facing); 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)) 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); var desiredFacing = Util.GetFacing(dist, unit.Facing);
Util.TickFacing(ref unit.Facing, desiredFacing, Util.TickFacing(ref unit.Facing, desiredFacing,
self.Info.Traits.Get<HelicopterInfo>().ROT); self.Info.Traits.Get<UnitInfo>().ROT);
var rawSpeed = .2f * Util.GetEffectiveSpeed(self); var rawSpeed = .2f * Util.GetEffectiveSpeed(self);
self.CenterLocation += (rawSpeed / dist.Length) * dist; self.CenterLocation += (rawSpeed / dist.Length) * dist;

View File

@@ -28,7 +28,7 @@ namespace OpenRa.Game.Traits.Activities
--unit.Altitude; --unit.Altitude;
var desiredFacing = Util.GetFacing(d, unit.Facing); 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 speed = .2f * Util.GetEffectiveSpeed(self);
var angle = unit.Facing / 128f * Math.PI; 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 unit = self.traits.Get<Unit>();
var speed = .2f * Util.GetEffectiveSpeed(self); var speed = .2f * Util.GetEffectiveSpeed(self);
var approachStart = landPos - new float2(unit.Altitude * speed, 0); 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 */ /* work out the center points */
var fwd = -float2.FromAngle(unit.Facing / 128f * (float)Math.PI); 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 ) if( desiredFacing == unit.Facing )
return NextActivity; 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; return this;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

20
ra.yaml
View File

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

View File

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