Merge pull request #6152 from Mailaender/money-crate
Added money crates to be spawned by destroyed supply trucks
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 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.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Leave a \"crate\" actor after destruction.")]
|
||||
public class ContainsCrateInfo : TraitInfo<ContainsCrate> { }
|
||||
|
||||
public class ContainsCrate : INotifyKilled
|
||||
{
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
self.World.AddFrameEndTask(w => w.CreateActor("crate", new TypeDictionary
|
||||
{
|
||||
new LocationInit(self.Location),
|
||||
new OwnerInit(self.World.WorldActor.Owner),
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,15 @@ namespace OpenRA.Mods.RA
|
||||
[Desc("Seconds")]
|
||||
public readonly int Lifetime = 5;
|
||||
|
||||
[Desc("Allowed to land on.")]
|
||||
public readonly string[] TerrainTypes = { };
|
||||
|
||||
[Desc("Define actors that can collect crates by setting this into the Crushes field from the Mobile trait.")]
|
||||
public readonly string CrushClass = "crate";
|
||||
|
||||
public object Create(ActorInitializer init) { return new Crate(init, this); }
|
||||
}
|
||||
|
||||
// ITeleportable is required for paradrop
|
||||
class Crate : ITick, IPositionable, ICrushable, ISync, INotifyParachuteLanded, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||
{
|
||||
readonly Actor self;
|
||||
@@ -128,7 +131,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public bool CrushableBy(string[] crushClasses, Player owner)
|
||||
{
|
||||
return crushClasses.Contains("crate");
|
||||
return crushClasses.Contains(info.CrushClass);
|
||||
}
|
||||
|
||||
public void AddedToWorld(Actor self)
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Crates
|
||||
public SupportPowerCrateAction(Actor self, SupportPowerCrateActionInfo info)
|
||||
: base(self, info) { Info = info; }
|
||||
|
||||
// The free unit crate requires same race, and the actor to be at least ITeleportable.
|
||||
// The free unit crate requires same race and the actor needs to be mobile.
|
||||
// We want neither of these properties for crate power proxies.
|
||||
public override void Activate(Actor collector)
|
||||
{
|
||||
|
||||
@@ -190,7 +190,6 @@
|
||||
<Compile Include="Chronoshiftable.cs" />
|
||||
<Compile Include="Cloak.cs" />
|
||||
<Compile Include="ConquestVictoryConditions.cs" />
|
||||
<Compile Include="ContainsCrate.cs" />
|
||||
<Compile Include="Crate.cs" />
|
||||
<Compile Include="CrateAction.cs" />
|
||||
<Compile Include="CrateSpawner.cs" />
|
||||
|
||||
@@ -354,6 +354,16 @@ namespace OpenRA.Utility
|
||||
}
|
||||
}
|
||||
|
||||
if (engineVersion < 20140803)
|
||||
{
|
||||
// ContainsCrate was removed (use LeavesHusk instead)
|
||||
if (depth == 1 && node.Key == "ContainsCrate")
|
||||
{
|
||||
node.Key = "LeavesHusk";
|
||||
node.Value.Nodes.Add(new MiniYamlNode("HuskActor", new MiniYaml("crate")));
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +160,28 @@ CRATE:
|
||||
Passenger:
|
||||
BodyOrientation:
|
||||
|
||||
MONEYCRATE:
|
||||
Tooltip:
|
||||
Name: Money Crate
|
||||
Crate:
|
||||
Lifetime: 180
|
||||
TerrainTypes: Clear, Rough, Road, Ore, Beach
|
||||
GiveCashCrateAction:
|
||||
Amount: 500
|
||||
SelectionShares: 1
|
||||
UseCashTick: true
|
||||
RenderSprites:
|
||||
Palette: effect
|
||||
WithCrateBody:
|
||||
Images: wcrate
|
||||
XmasImages: xcratea, xcrateb, xcratec, xcrated
|
||||
Selectable:
|
||||
Selectable: false
|
||||
Bounds: 15,15,-1,-1
|
||||
ProximityCaptor:
|
||||
Types: Crate
|
||||
BodyOrientation:
|
||||
|
||||
CAMERA:
|
||||
Immobile:
|
||||
OccupiesSpace: false
|
||||
|
||||
@@ -480,6 +480,8 @@ TRUK:
|
||||
Explodes:
|
||||
Weapon: UnitExplodeSmall
|
||||
EmptyWeapon: UnitExplodeSmall
|
||||
LeavesHusk:
|
||||
HuskActor: moneycrate
|
||||
|
||||
MGG:
|
||||
Inherits: ^Vehicle
|
||||
|
||||
@@ -268,6 +268,11 @@ scrate:
|
||||
Tick: 500
|
||||
ZOffset: -511
|
||||
|
||||
wcrate:
|
||||
idle:
|
||||
Start: 0
|
||||
ZOffset: -511
|
||||
|
||||
xcratea:
|
||||
idle:
|
||||
Start: 0
|
||||
|
||||
Reference in New Issue
Block a user