diff --git a/OpenRa.Game/Graphics/Viewport.cs b/OpenRa.Game/Graphics/Viewport.cs index 5af11ba1d5..9a35a4ef5b 100644 --- a/OpenRa.Game/Graphics/Viewport.cs +++ b/OpenRa.Game/Graphics/Viewport.cs @@ -97,7 +97,7 @@ namespace OpenRa.Game.Graphics public void GoToStartLocation() { - Center(Game.world.Actors.Where(a => a.LegacyInfo != null && a.Owner == Game.LocalPlayer)); + Center(Game.world.Actors.Where(a => a.Info != null && a.Owner == Game.LocalPlayer)); } } } diff --git a/OpenRa.Game/Shroud.cs b/OpenRa.Game/Shroud.cs index a34931aa8b..1b0cdfae55 100644 --- a/OpenRa.Game/Shroud.cs +++ b/OpenRa.Game/Shroud.cs @@ -33,7 +33,9 @@ namespace OpenRa.Game public void Explore(Actor a) { - foreach (var t in Game.FindTilesInCircle((1f / Game.CellSize * a.CenterLocation).ToInt2(), a.Info.Traits.Get().Sight)) + foreach (var t in Game.FindTilesInCircle( + (1f / Game.CellSize * a.CenterLocation).ToInt2(), + a.Info.Traits.WithInterface().First().Sight)) explored[t.X, t.Y] = true; dirty = true; diff --git a/OpenRa.Game/Traits/Production.cs b/OpenRa.Game/Traits/Production.cs index b6b2481248..5297112145 100755 --- a/OpenRa.Game/Traits/Production.cs +++ b/OpenRa.Game/Traits/Production.cs @@ -6,6 +6,8 @@ namespace OpenRa.Game.Traits { class ProductionInfo : ITraitInfo { + public readonly int[] SpawnOffset = null; + public object Create(Actor self) { return new Production(self); } } @@ -23,7 +25,7 @@ namespace OpenRa.Game.Traits public virtual int CreationFacing( Actor self, Actor newUnit ) { - return newUnit.LegacyInfo.InitialFacing; + return newUnit.Info.Traits.WithInterface().FirstOrDefault().InitialFacing; } public bool Produce( Actor self, LegacyUnitInfo producee ) @@ -43,10 +45,10 @@ namespace OpenRa.Game.Traits newUnit.QueueActivity( new Activities.Move( rp.rallyPoint, 1 ) ); } - var bi = self.LegacyInfo as LegacyBuildingInfo; - if (bi != null && bi.SpawnOffset != null) + var pi = self.Info.Traits.Get(); + if (pi != null && pi.SpawnOffset != null) newUnit.CenterLocation = self.CenterLocation - + new float2(bi.SpawnOffset[0], bi.SpawnOffset[1]); + + new float2(pi.SpawnOffset[0], pi.SpawnOffset[1]); Game.world.Add( newUnit ); diff --git a/OpenRa.Game/Traits/RenderUnitMuzzleFlash.cs b/OpenRa.Game/Traits/RenderUnitMuzzleFlash.cs index 53211abcf6..fa8f569bbc 100644 --- a/OpenRa.Game/Traits/RenderUnitMuzzleFlash.cs +++ b/OpenRa.Game/Traits/RenderUnitMuzzleFlash.cs @@ -17,13 +17,14 @@ namespace OpenRa.Game.Traits { var unit = self.traits.Get(); var attack = self.traits.WithInterface().First(); + var attackInfo = self.Info.Traits.WithInterface().First(); - var muzzleFlash = new Animation(self.LegacyInfo.Name); + var muzzleFlash = new Animation(GetImage(self)); muzzleFlash.PlayFetchIndex("muzzle", () => (Util.QuantizeFacing(unit.Facing, 8)) * 6 + (int)(attack.primaryRecoil * 5.9f)); anims.Add( "muzzle", new AnimationWithOffset( muzzleFlash, - () => self.LegacyInfo.PrimaryOffset.AbsOffset(), + () => attackInfo.PrimaryOffset.AbsOffset(), () => attack.primaryRecoil <= 0 ) ); } } diff --git a/RulesConverter/Program.cs b/RulesConverter/Program.cs index 5fba5729c5..345476347b 100644 --- a/RulesConverter/Program.cs +++ b/RulesConverter/Program.cs @@ -139,6 +139,10 @@ namespace RulesConverter { "MuzzleFlash", "MuzzleFlash" }, // maybe { "Recoil", "Recoil"} } }, + + { "Production", new PL { + { "SpawnOffset", "SpawnOffset" } } + }, }; traitMap["RenderUnit"] = traitMap["RenderBuilding"]; diff --git a/ra.yaml b/ra.yaml index 4a97483009..32b914b875 100644 --- a/ra.yaml +++ b/ra.yaml @@ -1195,6 +1195,7 @@ HPAD: Sight: 5 RenderBuilding: Production: + SpawnOffset: 0,-4 BelowUnits: Reservable: IronCurtainable: @@ -1571,6 +1572,154 @@ MINV: BelowUnits: InvisibleToOthers: +T01: + Inherits: DefaultBuilding + Building: + Footprint: x_ x_ + Dimensions: 2,2 + RenderBuilding: + +T02: + Inherits: DefaultBuilding + Building: + Footprint: x_ x_ + Dimensions: 2,2 + RenderBuilding: + +T03: + Inherits: DefaultBuilding + Building: + Footprint: x_ x_ + Dimensions: 2,2 + RenderBuilding: + +T05: + Inherits: DefaultBuilding + Building: + Footprint: x_ x_ + Dimensions: 2,2 + RenderBuilding: + +T06: + Inherits: DefaultBuilding + Building: + Footprint: x_ x_ + Dimensions: 2,2 + RenderBuilding: + +T07: + Inherits: DefaultBuilding + Building: + Footprint: x_ x_ + Dimensions: 2,2 + RenderBuilding: + +T08: + Inherits: DefaultBuilding + Building: + Footprint: x_ + Dimensions: 2,1 + RenderBuilding: + +T10: + Inherits: DefaultBuilding + Building: + Footprint: xx xx + Dimensions: 2,2 + RenderBuilding: + +T11: + Inherits: DefaultBuilding + Building: + Footprint: xx xx + Dimensions: 2,2 + RenderBuilding: + +T12: + Inherits: DefaultBuilding + Building: + Footprint: xx xx + Dimensions: 2,2 + RenderBuilding: + +T13: + Inherits: DefaultBuilding + Building: + Footprint: xx xx + Dimensions: 2,2 + RenderBuilding: + +T14: + Inherits: DefaultBuilding + Building: + Footprint: xx xx + Dimensions: 2,2 + RenderBuilding: + +T15: + Inherits: DefaultBuilding + Building: + Footprint: xx xx + Dimensions: 2,2 + RenderBuilding: + +T16: + Inherits: DefaultBuilding + Building: + Footprint: x_ x_ + Dimensions: 2,2 + RenderBuilding: + +T17: + Inherits: DefaultBuilding + Building: + Footprint: x_ x_ + Dimensions: 2,2 + RenderBuilding: + +TC01: + Inherits: DefaultBuilding + Building: + Footprint: xx_ xx_ + Dimensions: 3,2 + RenderBuilding: + +TC02: + Inherits: DefaultBuilding + Building: + Footprint: xx_ xx_ + Dimensions: 3,2 + RenderBuilding: + +TC03: + Inherits: DefaultBuilding + Building: + Footprint: xx_ xx_ + Dimensions: 3,2 + RenderBuilding: + +TC04: + Inherits: DefaultBuilding + Building: + Footprint: xxx_ xxx_ xxx_ + Dimensions: 4,3 + RenderBuilding: + +TC05: + Inherits: DefaultBuilding + Building: + Footprint: xxx_ xxx_ xxx_ + Dimensions: 4,3 + RenderBuilding: + +MINE: + Inherits: DefaultBuilding + Building: + Footprint: x + Dimensions: 1,1 + RenderBuilding: + SeedsOre: + DOG: Inherits: DefaultInfantry Buildable: diff --git a/regen-yaml.cmd b/regen-yaml.cmd index 416408aa0b..f5018afb67 100644 --- a/regen-yaml.cmd +++ b/regen-yaml.cmd @@ -1,2 +1,2 @@ -RulesConverter\bin\debug\RulesConverter.exe units.ini rules.ini ra.yaml +RulesConverter\bin\debug\RulesConverter.exe units.ini rules.ini trees.ini ra.yaml RulesConverter\bin\debug\RulesConverter.exe aftermathUnits.ini aftrmath.ini aftermath.yaml \ No newline at end of file