diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 3ea793d682..af63cacf7b 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -181,6 +181,7 @@ + diff --git a/OpenRa.Game/Traits/Minelayer.cs b/OpenRa.Game/Traits/Minelayer.cs new file mode 100644 index 0000000000..d683961ad6 --- /dev/null +++ b/OpenRa.Game/Traits/Minelayer.cs @@ -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))); + } + } + } +} diff --git a/OpenRa.Game/UnitOrders.cs b/OpenRa.Game/UnitOrders.cs index 459a833627..fa9b2b858f 100755 --- a/OpenRa.Game/UnitOrders.cs +++ b/OpenRa.Game/UnitOrders.cs @@ -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() ) - 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()) + t.ResolveOrder(order.Subject, order); + break; + } } } } diff --git a/sequences.xml b/sequences.xml index fe841d91a2..98e7d26236 100644 --- a/sequences.xml +++ b/sequences.xml @@ -498,12 +498,12 @@ - + - + @@ -981,4 +981,10 @@ + + + + + + \ No newline at end of file diff --git a/units.ini b/units.ini index 63b3ea8524..4dae19790f 100755 --- a/units.ini +++ b/units.ini @@ -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