From 1ea8e212c4f925f28e6a4d42ecda60922ef6ed35 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 5 Feb 2010 19:40:39 +1300 Subject: [PATCH] Create a mod dll for cnc --- OpenRa.Game/OpenRa.Game.csproj | 1 - OpenRa.Game/Traits/Activities/Harvest.cs | 2 +- OpenRa.Game/Traits/Activities/Turn.cs | 2 +- OpenRa.Game/Traits/Harvester.cs | 2 +- OpenRa.Game/Traits/TiberiumRefinery.cs | 42 ---------------- OpenRa.Mods.RA/OpenRa.Mods.RA.csproj | 1 - OpenRa.Mods.RA/ProductionAirdrop.cs | 63 ------------------------ OpenRa.sln | 6 +++ mods/cnc/mod.yaml | 5 +- 9 files changed, 12 insertions(+), 112 deletions(-) delete mode 100644 OpenRa.Game/Traits/TiberiumRefinery.cs delete mode 100644 OpenRa.Mods.RA/ProductionAirdrop.cs diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 5633fc7070..3e77f366f9 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -256,7 +256,6 @@ - diff --git a/OpenRa.Game/Traits/Activities/Harvest.cs b/OpenRa.Game/Traits/Activities/Harvest.cs index 587836a8fe..bf972b3d81 100644 --- a/OpenRa.Game/Traits/Activities/Harvest.cs +++ b/OpenRa.Game/Traits/Activities/Harvest.cs @@ -2,7 +2,7 @@ namespace OpenRa.Traits.Activities { - class Harvest : IActivity + public class Harvest : IActivity { public IActivity NextActivity { get; set; } bool isHarvesting = false; diff --git a/OpenRa.Game/Traits/Activities/Turn.cs b/OpenRa.Game/Traits/Activities/Turn.cs index d5c2338b48..960b417003 100755 --- a/OpenRa.Game/Traits/Activities/Turn.cs +++ b/OpenRa.Game/Traits/Activities/Turn.cs @@ -1,7 +1,7 @@  namespace OpenRa.Traits.Activities { - class Turn : IActivity + public class Turn : IActivity { public IActivity NextActivity { get; set; } diff --git a/OpenRa.Game/Traits/Harvester.cs b/OpenRa.Game/Traits/Harvester.cs index 12f98825d0..10d6bc41ae 100644 --- a/OpenRa.Game/Traits/Harvester.cs +++ b/OpenRa.Game/Traits/Harvester.cs @@ -8,7 +8,7 @@ namespace OpenRa.Traits public object Create(Actor self) { return new Harvester(); } } - class Harvester : IIssueOrder, IResolveOrder, IPips + public class Harvester : IIssueOrder, IResolveOrder, IPips { [Sync] public int oreCarried = 0; /* sum of these must not exceed capacity */ diff --git a/OpenRa.Game/Traits/TiberiumRefinery.cs b/OpenRa.Game/Traits/TiberiumRefinery.cs deleted file mode 100644 index f2654f2644..0000000000 --- a/OpenRa.Game/Traits/TiberiumRefinery.cs +++ /dev/null @@ -1,42 +0,0 @@ -using OpenRa.Traits.Activities; - -namespace OpenRa.Traits -{ - class TiberiumRefineryInfo : ITraitInfo - { - public object Create(Actor self) { return new TiberiumRefinery(self); } - } - - class TiberiumRefinery : IAcceptOre - { - Actor self; - public TiberiumRefinery(Actor self) - { - this.self = self; - self.World.AddFrameEndTask( - w => - { /* create the free harvester! */ - var harvester = w.CreateActor("harv", self.Location + new int2(0, 2), self.Owner); - var unit = harvester.traits.Get(); - var mobile = harvester.traits.Get(); - unit.Facing = 64; - harvester.QueueActivity(new Harvest()); - }); - } - - public int2 DeliverOffset { get { return new int2(0, 2); } } - public void OnDock(Actor harv, DeliverOre dockOrder) - { - // Todo: need to be careful about cancellation and multiple harvs - var unit = harv.traits.Get(); - harv.QueueActivity(new Move(self.Location + new int2(1,1), self)); - harv.QueueActivity(new Turn(96)); - harv.QueueActivity( new CallFunc( () => - self.traits.Get().PlayCustomAnimThen(self, "active", () => { - harv.traits.Get().Deliver(harv, self); - harv.QueueActivity(new Move(self.Location + DeliverOffset, self)); - harv.QueueActivity(new Harvest()); - }))); - } - } -} diff --git a/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj b/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj index b5f469f36f..4b5b5b0782 100644 --- a/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj +++ b/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj @@ -51,7 +51,6 @@ - diff --git a/OpenRa.Mods.RA/ProductionAirdrop.cs b/OpenRa.Mods.RA/ProductionAirdrop.cs deleted file mode 100644 index e57554a6fd..0000000000 --- a/OpenRa.Mods.RA/ProductionAirdrop.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using OpenRa.GameRules; -using OpenRa.Traits.Activities; -using OpenRa.Traits; - -namespace OpenRa.Mods.RA -{ - public class ProductionAirdropInfo : ProductionInfo - { - public override object Create(Actor self) { return new ProductionAirdrop(self); } - } - - class ProductionAirdrop : Production - { - public ProductionAirdrop(Actor self) : base(self) { } - - public override bool Produce( Actor self, ActorInfo producee ) - { - var location = CreationLocation(self, producee); - var owner = self.Owner; - - // Start at the edge of the map, to the right of the airfield - var startPos = new int2(owner.World.Map.XOffset + owner.World.Map.Width, self.Location.Y); - var endPos = new int2(owner.World.Map.XOffset, self.Location.Y); - var unloadOffset = new int2(1,1); - var exitOffset = new int2(3,1); - - var rp = self.traits.GetOrDefault(); - owner.World.AddFrameEndTask(w => - { - var a = w.CreateActor("C17", startPos, owner); - var cargo = a.traits.Get(); - - var newUnit = new Actor(self.World, producee.Name, new int2(0, 0), self.Owner); - cargo.Load(a, newUnit); - - a.CancelActivity(); - a.QueueActivity(new Land(self.CenterLocation)); - a.QueueActivity(new CallFunc(() => - { - var actor = cargo.Unload(self); - self.World.AddFrameEndTask(ww => - { - ww.Add(actor); - actor.traits.Get().TeleportTo(actor, self.Location + unloadOffset); - newUnit.traits.Get().Facing = 192; - actor.CancelActivity(); - actor.QueueActivity(new Move(self.Location + exitOffset, self)); - actor.QueueActivity(new Move(rp.rallyPoint, 0)); - - foreach (var t in self.traits.WithInterface()) - t.UnitProduced(self, actor); - }); - })); - a.QueueActivity(new Fly(endPos)); - a.QueueActivity(new RemoveSelf()); - }); - - return true; - } - } -} diff --git a/OpenRa.sln b/OpenRa.sln index 5321e0be6c..61a524b1d3 100644 --- a/OpenRa.sln +++ b/OpenRa.sln @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Mods.RA", "OpenRa.Mo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Mods.Aftermath", "OpenRa.Mods.Aftermath\OpenRa.Mods.Aftermath.csproj", "{2E1F8D8B-AEF5-4BCE-A95C-50223A0C7331}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Mods.Cnc", "OpenRa.Mods.Cnc\OpenRa.Mods.Cnc.csproj", "{2881135D-4D62-493E-8F83-5EEE92CCC6BE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -61,6 +63,10 @@ Global {2E1F8D8B-AEF5-4BCE-A95C-50223A0C7331}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E1F8D8B-AEF5-4BCE-A95C-50223A0C7331}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E1F8D8B-AEF5-4BCE-A95C-50223A0C7331}.Release|Any CPU.Build.0 = Release|Any CPU + {2881135D-4D62-493E-8F83-5EEE92CCC6BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2881135D-4D62-493E-8F83-5EEE92CCC6BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2881135D-4D62-493E-8F83-5EEE92CCC6BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2881135D-4D62-493E-8F83-5EEE92CCC6BE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml index 68d0bf27bd..aaf2cf47bb 100644 --- a/mods/cnc/mod.yaml +++ b/mods/cnc/mod.yaml @@ -8,7 +8,7 @@ Packages: mods/cnc/packages/cclocal.mix mods/cnc/packages/speech.mix mods/cnc/packages/conquer.mix - mods/cnc/packages/general.mix +# mods/cnc/packages/general.mix mods/cnc/packages/sounds.mix mods/cnc/packages/tempicnh.mix ~main.mix @@ -47,7 +47,8 @@ Sequences: mods/cnc/sequences.xml: Obsolete; will disappear once done converting Assemblies: - mods/ra/OpenRa.Mods.RA.dll: Use the red alert traits + mods/cnc/OpenRa.Mods.Cnc.dll: Cnc mod traits + mods/ra/OpenRa.Mods.RA.dll: Red alert mod traits Maps: