Merge branch 'minelayer'
This commit is contained in:
@@ -181,6 +181,9 @@
|
|||||||
<Compile Include="Traits\Fake.cs" />
|
<Compile Include="Traits\Fake.cs" />
|
||||||
<Compile Include="Traits\Harvester.cs" />
|
<Compile Include="Traits\Harvester.cs" />
|
||||||
<Compile Include="Traits\Helicopter.cs" />
|
<Compile Include="Traits\Helicopter.cs" />
|
||||||
|
<Compile Include="Traits\InvisibleToOthers.cs" />
|
||||||
|
<Compile Include="Traits\MineImmune.cs" />
|
||||||
|
<Compile Include="Traits\Minelayer.cs" />
|
||||||
<Compile Include="Traits\SquishByTank.cs" />
|
<Compile Include="Traits\SquishByTank.cs" />
|
||||||
<Compile Include="Traits\Plane.cs" />
|
<Compile Include="Traits\Plane.cs" />
|
||||||
<Compile Include="Traits\ProductionQueue.cs" />
|
<Compile Include="Traits\ProductionQueue.cs" />
|
||||||
@@ -256,11 +259,11 @@
|
|||||||
<None Include="Graphics\Graphics.cd" />
|
<None Include="Graphics\Graphics.cd" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
@@ -5,16 +5,20 @@ using OpenRa.Game.GameRules;
|
|||||||
using OpenRa.Game.Effects;
|
using OpenRa.Game.Effects;
|
||||||
namespace OpenRa.Game.Traits
|
namespace OpenRa.Game.Traits
|
||||||
{
|
{
|
||||||
class APMine : ICrushable
|
class APMine : ICrushable, IOccupySpace
|
||||||
{
|
{
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
public APMine(Actor self)
|
public APMine(Actor self)
|
||||||
{
|
{
|
||||||
this.self = self;
|
this.self = self;
|
||||||
|
Game.UnitInfluence.Add(self, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnCrush(Actor crusher)
|
public void OnCrush(Actor crusher)
|
||||||
{
|
{
|
||||||
|
if (crusher.traits.Contains<MineImmune>() && crusher.Owner == self.Owner)
|
||||||
|
return;
|
||||||
|
|
||||||
Game.world.AddFrameEndTask(_ =>
|
Game.world.AddFrameEndTask(_ =>
|
||||||
{
|
{
|
||||||
Game.world.Remove(self);
|
Game.world.Remove(self);
|
||||||
@@ -33,9 +37,15 @@ namespace OpenRa.Game.Traits
|
|||||||
// Mines should explode indiscriminantly of player
|
// Mines should explode indiscriminantly of player
|
||||||
switch (umt)
|
switch (umt)
|
||||||
{
|
{
|
||||||
case UnitMovementType.Foot: return true;
|
case UnitMovementType.Foot:
|
||||||
|
case UnitMovementType.Wheel:
|
||||||
|
case UnitMovementType.Track:
|
||||||
|
return true;
|
||||||
|
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<int2> OccupiedCells() { yield return self.Location; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,20 @@ using OpenRa.Game.Effects;
|
|||||||
|
|
||||||
namespace OpenRa.Game.Traits
|
namespace OpenRa.Game.Traits
|
||||||
{
|
{
|
||||||
class ATMine : ICrushable
|
class ATMine : ICrushable, IOccupySpace
|
||||||
{
|
{
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
public ATMine(Actor self)
|
public ATMine(Actor self)
|
||||||
{
|
{
|
||||||
this.self = self;
|
this.self = self;
|
||||||
|
Game.UnitInfluence.Add(self, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnCrush(Actor crusher)
|
public void OnCrush(Actor crusher)
|
||||||
{
|
{
|
||||||
|
if (crusher.traits.Contains<MineImmune>() && crusher.Owner == self.Owner)
|
||||||
|
return;
|
||||||
|
|
||||||
Game.world.AddFrameEndTask(_ =>
|
Game.world.AddFrameEndTask(_ =>
|
||||||
{
|
{
|
||||||
Game.world.Remove(self);
|
Game.world.Remove(self);
|
||||||
@@ -39,5 +43,7 @@ namespace OpenRa.Game.Traits
|
|||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<int2> OccupiedCells() { yield return self.Location; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
OpenRa.Game/Traits/InvisibleToOthers.cs
Normal file
18
OpenRa.Game/Traits/InvisibleToOthers.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenRa.Game.Traits
|
||||||
|
{
|
||||||
|
class InvisibleToOthers : IRenderModifier
|
||||||
|
{
|
||||||
|
public InvisibleToOthers(Actor self) { }
|
||||||
|
|
||||||
|
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||||
|
{
|
||||||
|
return Game.LocalPlayer == self.Owner
|
||||||
|
? r : new Renderable[] { };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
OpenRa.Game/Traits/MineImmune.cs
Normal file
8
OpenRa.Game/Traits/MineImmune.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
namespace OpenRa.Game.Traits
|
||||||
|
{
|
||||||
|
class MineImmune
|
||||||
|
{
|
||||||
|
public MineImmune(Actor self) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
33
OpenRa.Game/Traits/Minelayer.cs
Normal file
33
OpenRa.Game/Traits/Minelayer.cs
Normal 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("Deploy", self, null, int2.Zero, null);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
{
|
||||||
|
if (order.OrderString == "Deploy")
|
||||||
|
{
|
||||||
|
// 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)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -83,7 +83,7 @@ namespace OpenRa.Game.Traits
|
|||||||
case "Plane":
|
case "Plane":
|
||||||
return UnitMovementType.Fly;
|
return UnitMovementType.Fly;
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("GetMovementType on unit that shouldn't be aable to move.");
|
throw new InvalidOperationException("GetMovementType on unit that shouldn't be able to move.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
rules.ini
23
rules.ini
@@ -369,14 +369,33 @@ Tracked=yes
|
|||||||
Passengers=5
|
Passengers=5
|
||||||
|
|
||||||
; mine layer
|
; mine layer
|
||||||
[MNLY]
|
[MNLY.AP]
|
||||||
Prerequisite=weap,fix
|
Prerequisite=weap,fix
|
||||||
Strength=100
|
Strength=100
|
||||||
Armor=heavy
|
Armor=heavy
|
||||||
|
Image=MNLY
|
||||||
|
Icon=MNLYICON
|
||||||
TechLevel=3
|
TechLevel=3
|
||||||
Sight=5
|
Sight=5
|
||||||
Speed=9
|
Speed=9
|
||||||
Owner=allies,soviet
|
Owner=soviet
|
||||||
|
Cost=800
|
||||||
|
Points=50
|
||||||
|
ROT=5
|
||||||
|
Tracked=yes
|
||||||
|
Ammo=5 ; number of mines carried
|
||||||
|
Crewed=yes
|
||||||
|
|
||||||
|
[MNLY.AT]
|
||||||
|
Prerequisite=weap,fix
|
||||||
|
Strength=100
|
||||||
|
Armor=heavy
|
||||||
|
Image=MNLY
|
||||||
|
Icon=MNLYICON
|
||||||
|
TechLevel=3
|
||||||
|
Sight=5
|
||||||
|
Speed=9
|
||||||
|
Owner=allies
|
||||||
Cost=800
|
Cost=800
|
||||||
Points=50
|
Points=50
|
||||||
ROT=5
|
ROT=5
|
||||||
|
|||||||
@@ -981,4 +981,10 @@
|
|||||||
<sequence name="idle" start="0" length="1" />
|
<sequence name="idle" start="0" length="1" />
|
||||||
<sequence name="damaged-idle" start="2" length="1" />
|
<sequence name="damaged-idle" start="2" length="1" />
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit name="minp">
|
||||||
|
<sequence name="idle" start="0" length="1" />
|
||||||
|
</unit>
|
||||||
|
<unit name="minv">
|
||||||
|
<sequence name="idle" start="0" length="1" />
|
||||||
|
</unit>
|
||||||
</sequences>
|
</sequences>
|
||||||
30
units.ini
30
units.ini
@@ -11,7 +11,8 @@ HARV
|
|||||||
MCV
|
MCV
|
||||||
JEEP
|
JEEP
|
||||||
APC
|
APC
|
||||||
MNLY
|
MNLY.AP
|
||||||
|
MNLY.AT
|
||||||
|
|
||||||
[V2RL]
|
[V2RL]
|
||||||
Description=V2 Rocket
|
Description=V2 Rocket
|
||||||
@@ -88,12 +89,19 @@ Traits=Unit, Mobile, McvDeploy, RenderUnit
|
|||||||
SelectionPriority=3
|
SelectionPriority=3
|
||||||
Voice=VehicleVoice
|
Voice=VehicleVoice
|
||||||
LongDesc=Deploys into another Construction Yard.\n Unarmed
|
LongDesc=Deploys into another Construction Yard.\n Unarmed
|
||||||
[MNLY]
|
|
||||||
Description=Minelayer
|
[MNLY.AP]
|
||||||
Traits=Unit, Mobile, RenderUnit
|
Description=Minelayer (Anti-Personnel)
|
||||||
|
Traits=Unit, Mobile, RenderUnit, Minelayer, MineImmune
|
||||||
Voice=VehicleVoice
|
Voice=VehicleVoice
|
||||||
LongDesc=Lays mines to destroy unwary enemy units.\n Unarmed
|
LongDesc=Lays mines to destroy unwary enemy units.\n Unarmed
|
||||||
|
Primary=MINP ;; temporary hack
|
||||||
|
[MNLY.AT]
|
||||||
|
Description=Minelayer (Anti-Tank)
|
||||||
|
Traits=Unit, Mobile, RenderUnit, Minelayer, MineImmune
|
||||||
|
Voice=VehicleVoice
|
||||||
|
LongDesc=Lays mines to destroy unwary enemy units.\n Unarmed
|
||||||
|
Primary=MINV ;; temporary hack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -314,7 +322,10 @@ WEAF
|
|||||||
SYRF
|
SYRF
|
||||||
SPEF
|
SPEF
|
||||||
DOMF
|
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.
|
; `Dimensions` is the size of a box that will include the whole building, excluding bib.
|
||||||
@@ -505,8 +516,13 @@ LongDesc=Looks like a Radar Dome
|
|||||||
;SelectionPriority=3
|
;SelectionPriority=3
|
||||||
|
|
||||||
|
|
||||||
|
[MINV]
|
||||||
|
Traits=Unit,RenderUnit,ATMine,BelowUnits,InvisibleToOthers
|
||||||
|
Selectable=no
|
||||||
|
|
||||||
|
[MINP]
|
||||||
|
Traits=Unit,RenderUnit,APMine,BelowUnits,InvisibleToOthers
|
||||||
|
Selectable=no
|
||||||
|
|
||||||
[InfantryTypes]
|
[InfantryTypes]
|
||||||
DOG
|
DOG
|
||||||
|
|||||||
Reference in New Issue
Block a user