Create a mod dll for cnc

This commit is contained in:
Paul Chote
2010-02-05 19:40:39 +13:00
parent 9cdefee403
commit 1ea8e212c4
9 changed files with 12 additions and 112 deletions

View File

@@ -256,7 +256,6 @@
<Compile Include="Traits\StoresOre.cs" />
<Compile Include="Traits\Submarine.cs" />
<Compile Include="Traits\TakeCover.cs" />
<Compile Include="Traits\TiberiumRefinery.cs" />
<Compile Include="Traits\TraitsInterfaces.cs" />
<Compile Include="Traits\Turreted.cs" />
<Compile Include="Traits\Unit.cs" />

View File

@@ -2,7 +2,7 @@
namespace OpenRa.Traits.Activities
{
class Harvest : IActivity
public class Harvest : IActivity
{
public IActivity NextActivity { get; set; }
bool isHarvesting = false;

View File

@@ -1,7 +1,7 @@
namespace OpenRa.Traits.Activities
{
class Turn : IActivity
public class Turn : IActivity
{
public IActivity NextActivity { get; set; }

View File

@@ -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 */

View File

@@ -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<Unit>();
var mobile = harvester.traits.Get<Mobile>();
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<Unit>();
harv.QueueActivity(new Move(self.Location + new int2(1,1), self));
harv.QueueActivity(new Turn(96));
harv.QueueActivity( new CallFunc( () =>
self.traits.Get<RenderBuilding>().PlayCustomAnimThen(self, "active", () => {
harv.traits.Get<Harvester>().Deliver(harv, self);
harv.QueueActivity(new Move(self.Location + DeliverOffset, self));
harv.QueueActivity(new Harvest());
})));
}
}
}