Adds TRUK to both sides - donates cash to others
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -9,3 +9,4 @@ The OpenRA developers are:
|
|||||||
* Joakim Lindberg
|
* Joakim Lindberg
|
||||||
* Andrew Riedi
|
* Andrew Riedi
|
||||||
* Tim Mylemans
|
* Tim Mylemans
|
||||||
|
* Curtis Shmyr
|
||||||
18
OpenRA.Mods.RA/AcceptsSupplies.cs
Normal file
18
OpenRA.Mods.RA/AcceptsSupplies.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class AcceptsSuppliesInfo : TraitInfo<AcceptsSupplies> {}
|
||||||
|
|
||||||
|
class AcceptsSupplies {}
|
||||||
|
}
|
||||||
43
OpenRA.Mods.RA/Activities/DonateSupplies.cs
Normal file
43
OpenRA.Mods.RA/Activities/DonateSupplies.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Traits.Activities;
|
||||||
|
using OpenRA.Mods.RA.Effects;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Activities
|
||||||
|
{
|
||||||
|
class DonateSupplies : CancelableActivity
|
||||||
|
{
|
||||||
|
Actor target;
|
||||||
|
int payload;
|
||||||
|
|
||||||
|
public DonateSupplies(Actor target, int payload)
|
||||||
|
{
|
||||||
|
this.target = target;
|
||||||
|
this.payload = payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IActivity Tick(Actor self)
|
||||||
|
{
|
||||||
|
if (IsCanceled) return NextActivity;
|
||||||
|
if (target == null || !target.IsInWorld || target.IsDead()) return NextActivity;
|
||||||
|
if (!target.Trait<IOccupySpace>().OccupiedCells().Any(x => x.First == self.Location))
|
||||||
|
return NextActivity;
|
||||||
|
|
||||||
|
target.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(payload);
|
||||||
|
self.Destroy();
|
||||||
|
self.World.AddFrameEndTask(w => w.Add(new CashTick(payload, 30, 2, target.CenterLocation, target.Owner.ColorRamp.GetColor(0))));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,9 +52,11 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AcceptsSupplies.cs" />
|
||||||
<Compile Include="Activities\Attack.cs" />
|
<Compile Include="Activities\Attack.cs" />
|
||||||
<Compile Include="Activities\CallFunc.cs" />
|
<Compile Include="Activities\CallFunc.cs" />
|
||||||
<Compile Include="Activities\CaptureBuilding.cs" />
|
<Compile Include="Activities\CaptureBuilding.cs" />
|
||||||
|
<Compile Include="Activities\DonateSupplies.cs" />
|
||||||
<Compile Include="Activities\QueuedActivity.cs" />
|
<Compile Include="Activities\QueuedActivity.cs" />
|
||||||
<Compile Include="Activities\DeliverOre.cs" />
|
<Compile Include="Activities\DeliverOre.cs" />
|
||||||
<Compile Include="Activities\Demolish.cs" />
|
<Compile Include="Activities\Demolish.cs" />
|
||||||
@@ -106,6 +108,7 @@
|
|||||||
<Compile Include="Buildings\TechTree.cs" />
|
<Compile Include="Buildings\TechTree.cs" />
|
||||||
<Compile Include="Buildings\Util.cs" />
|
<Compile Include="Buildings\Util.cs" />
|
||||||
<Compile Include="ProximityCaptor.cs" />
|
<Compile Include="ProximityCaptor.cs" />
|
||||||
|
<Compile Include="SupplyTruck.cs" />
|
||||||
<Compile Include="SupportPowers\SupportPowerChargeBar.cs" />
|
<Compile Include="SupportPowers\SupportPowerChargeBar.cs" />
|
||||||
<Compile Include="Valued.cs" />
|
<Compile Include="Valued.cs" />
|
||||||
<Compile Include="Combat.cs" />
|
<Compile Include="Combat.cs" />
|
||||||
|
|||||||
83
OpenRA.Mods.RA/SupplyTruck.cs
Normal file
83
OpenRA.Mods.RA/SupplyTruck.cs
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
|
using OpenRA.Mods.RA.Orders;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class SupplyTruckInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public readonly int Payload = 500;
|
||||||
|
public object Create(ActorInitializer init) { return new SupplyTruck(this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
class SupplyTruck : IIssueOrder, IResolveOrder, IOrderVoice
|
||||||
|
{
|
||||||
|
int payload;
|
||||||
|
SupplyTruckInfo Info;
|
||||||
|
public SupplyTruck(SupplyTruckInfo info)
|
||||||
|
{
|
||||||
|
payload = info.Payload;
|
||||||
|
Info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IOrderTargeter> Orders
|
||||||
|
{
|
||||||
|
get { yield return new SupplyTruckOrderTargeter(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||||
|
{
|
||||||
|
if (order.OrderID == "SupplyTruck")
|
||||||
|
return new Order(order.OrderID, self, queued) { TargetActor = target.Actor };
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
|
{
|
||||||
|
return "Move";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
{
|
||||||
|
if (order.OrderString == "SupplyTruck")
|
||||||
|
{
|
||||||
|
self.SetTargetLine(Target.FromOrder(order), Color.Yellow);
|
||||||
|
self.CancelActivity();
|
||||||
|
self.QueueActivity(new Enter(order.TargetActor));
|
||||||
|
self.QueueActivity(new DonateSupplies(order.TargetActor, payload));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SupplyTruckOrderTargeter : UnitTraitOrderTargeter<Building>
|
||||||
|
{
|
||||||
|
public SupplyTruckOrderTargeter()
|
||||||
|
: base("SupplyTruck", 5, "enter", false, true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
|
||||||
|
{
|
||||||
|
if (!base.CanTargetActor(self, target, forceAttack, forceMove, forceQueued, ref cursor)) return false;
|
||||||
|
if (target.AppearsHostileTo(self)) return false;
|
||||||
|
if (!target.HasTrait<AcceptsSupplies>()) return false;
|
||||||
|
|
||||||
|
IsQueued = forceQueued;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -164,6 +164,7 @@
|
|||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:Building
|
Types:Building
|
||||||
Sellable:
|
Sellable:
|
||||||
|
AcceptsSupplies:
|
||||||
|
|
||||||
^Wall:
|
^Wall:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -207,6 +208,7 @@
|
|||||||
Name: Civilian Building
|
Name: Civilian Building
|
||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:CivilianBuilding
|
Types:CivilianBuilding
|
||||||
|
-AcceptsSupplies:
|
||||||
|
|
||||||
^CivField:
|
^CivField:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^CivBuilding
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ PDOX:
|
|||||||
Duration: 30
|
Duration: 30
|
||||||
KillCargo: yes
|
KillCargo: yes
|
||||||
SupportPowerChargeBar:
|
SupportPowerChargeBar:
|
||||||
|
-AcceptsSupplies:
|
||||||
|
|
||||||
TSLA:
|
TSLA:
|
||||||
RequiresPower:
|
RequiresPower:
|
||||||
@@ -289,6 +290,7 @@ TSLA:
|
|||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
-RenderBuilding:
|
-RenderBuilding:
|
||||||
RenderRangeCircle:
|
RenderRangeCircle:
|
||||||
|
-AcceptsSupplies:
|
||||||
|
|
||||||
AGUN:
|
AGUN:
|
||||||
RequiresPower:
|
RequiresPower:
|
||||||
@@ -328,6 +330,7 @@ AGUN:
|
|||||||
-RenderBuilding:
|
-RenderBuilding:
|
||||||
RenderRangeCircle:
|
RenderRangeCircle:
|
||||||
RangeCircleType: aa
|
RangeCircleType: aa
|
||||||
|
-AcceptsSupplies:
|
||||||
|
|
||||||
DOME:
|
DOME:
|
||||||
RequiresPower:
|
RequiresPower:
|
||||||
@@ -386,6 +389,7 @@ PBOX:
|
|||||||
AutoTarget:
|
AutoTarget:
|
||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
RenderRangeCircle:
|
RenderRangeCircle:
|
||||||
|
-AcceptsSupplies:
|
||||||
|
|
||||||
HBOX:
|
HBOX:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
@@ -414,6 +418,7 @@ HBOX:
|
|||||||
AutoTarget:
|
AutoTarget:
|
||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
RenderRangeCircle:
|
RenderRangeCircle:
|
||||||
|
-AcceptsSupplies:
|
||||||
|
|
||||||
GUN:
|
GUN:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
@@ -447,6 +452,7 @@ GUN:
|
|||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
-RenderBuilding:
|
-RenderBuilding:
|
||||||
RenderRangeCircle:
|
RenderRangeCircle:
|
||||||
|
-AcceptsSupplies:
|
||||||
|
|
||||||
FTUR:
|
FTUR:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
@@ -476,6 +482,7 @@ FTUR:
|
|||||||
AutoTarget:
|
AutoTarget:
|
||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
RenderRangeCircle:
|
RenderRangeCircle:
|
||||||
|
-AcceptsSupplies:
|
||||||
|
|
||||||
SAM:
|
SAM:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
@@ -514,6 +521,7 @@ SAM:
|
|||||||
RangeCircleType: aa
|
RangeCircleType: aa
|
||||||
RequiresPower:
|
RequiresPower:
|
||||||
CanPowerDown:
|
CanPowerDown:
|
||||||
|
-AcceptsSupplies:
|
||||||
|
|
||||||
ATEK:
|
ATEK:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
|
|||||||
@@ -464,15 +464,27 @@ MNLY.AT:
|
|||||||
|
|
||||||
TRUK:
|
TRUK:
|
||||||
Inherits: ^Vehicle
|
Inherits: ^Vehicle
|
||||||
|
Buildable:
|
||||||
|
Queue: Vehicle
|
||||||
|
BuildPaletteOrder: 120
|
||||||
|
Prerequisites: weap
|
||||||
|
Owner: allies, soviet
|
||||||
|
Valued:
|
||||||
|
Cost: 500
|
||||||
|
Tooltip:
|
||||||
|
Name: Supply Truck
|
||||||
|
Description: Transports cash to other players.\n Unarmed
|
||||||
Health:
|
Health:
|
||||||
HP: 110
|
HP: 110
|
||||||
Armor:
|
Armor:
|
||||||
Type: Light
|
Type: Light
|
||||||
Mobile:
|
Mobile:
|
||||||
Speed: 10
|
Speed: 9
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 3
|
Range: 3
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
|
SupplyTruck:
|
||||||
|
Payload: 500
|
||||||
|
|
||||||
SS:
|
SS:
|
||||||
Inherits: ^Ship
|
Inherits: ^Ship
|
||||||
|
|||||||
Reference in New Issue
Block a user