minelayer maybe works

This commit is contained in:
Chris Forbes
2009-12-28 10:09:43 +13:00
parent ba16424bc1
commit eab8b653fd
5 changed files with 59 additions and 22 deletions

View File

@@ -181,6 +181,7 @@
<Compile Include="Traits\Harvester.cs" />
<Compile Include="Traits\Helicopter.cs" />
<Compile Include="Traits\Infantry.cs" />
<Compile Include="Traits\Minelayer.cs" />
<Compile Include="Traits\Plane.cs" />
<Compile Include="Traits\ProductionQueue.cs" />
<Compile Include="Traits\ProductionSurround.cs" />

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRa.Game.Traits
{
class Minelayer : IOrder
{
public Minelayer(Actor self) { }
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
{
// todo: check for ammo
if (mi.Button == MouseButton.Right && underCursor == self)
return new Order("DeployMine", self, null, int2.Zero, null);
return null;
}
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "DeployMine")
{
// todo: check for and adjust ammo
// todo: delay a bit?
Game.world.AddFrameEndTask(
w => w.Add(new Actor(Rules.UnitInfo[self.Info.Primary], self.Location, self.Owner)));
}
}
}
}

View File

@@ -13,22 +13,6 @@ namespace OpenRa.Game
{
switch( order.OrderString )
{
case "Move":
case "Attack":
case "DeployMcv":
case "Enter":
case "Harvest":
case "SetRallyPoint":
case "StartProduction":
case "PauseProduction":
case "CancelProduction":
case "ActivatePortableChronoshift":
case "UsePortableChronoshift":
{
foreach( var t in order.Subject.traits.WithInterface<IOrder>() )
t.ResolveOrder( order.Subject, order );
break;
}
case "PlaceBuilding":
{
Game.world.AddFrameEndTask( _ =>
@@ -114,7 +98,11 @@ namespace OpenRa.Game
}
default:
throw new NotImplementedException();
{
foreach (var t in order.Subject.traits.WithInterface<IOrder>())
t.ResolveOrder(order.Subject, order);
break;
}
}
}
}

View File

@@ -498,12 +498,12 @@
<sequence name="standup-5" start="124" length="2" />
<sequence name="standup-6" start="126" length="2" />
<sequence name="standup-7" start="128" length="2" />
<sequence name="die1" start="196" length="5" />
<sequence name="die1" start="196" length="5" />
<sequence name="die2" start="201" length="8" />
<sequence name="die3" start="209" length="8" />
<sequence name="die4" start="217" length="12" />
<sequence name="die5" start="229" length="18" />
<sequence name="die6" start="0" length="14" src="electro" />
<sequence name="die6" start="0" length="14" src="electro" />
<sequence name="crawl-0" start="130" length="4" />
<sequence name="crawl-1" start="134" length="4" />
<sequence name="crawl-2" start="138" length="4" />
@@ -981,4 +981,10 @@
<sequence name="idle" start="0" length="1" />
<sequence name="damaged-idle" start="2" length="1" />
</unit>
<unit name="minp">
<sequence name="idle" start="0" length="1" />
</unit>
<unit name="minv">
<sequence name="idle" start="0" length="1" />
</unit>
</sequences>

View File

@@ -88,9 +88,10 @@ Voice=VehicleVoice
LongDesc=Tough infantry transport.\n Strong vs Infantry, Light Vehicles\n Weak vs Tanks, Aircraft
[MNLY]
Description=Minelayer
Traits=Unit, Mobile, RenderUnit
Traits=Unit, Mobile, RenderUnit, Minelayer
Voice=VehicleVoice
LongDesc=Lays mines to destroy unwary enemy units.\n Unarmed
Primary=MINV ;; temporary hack
@@ -312,7 +313,10 @@ WEAF
SYRF
SPEF
DOMF
; TODO? : campaign-specific stuff - FCOM, civilian buildings, etc
; pseudo-buildings
MINP
MINV
; `Dimensions` is the size of a box that will include the whole building, excluding bib.
@@ -503,8 +507,13 @@ LongDesc=Looks like a Radar Dome
;SelectionPriority=3
[MINV]
Traits=Unit,RenderUnit,ATMine
Selectable=no
[MINP]
Traits=Unit,RenderUnit,APMine
Selectable=no
[InfantryTypes]
DOG