Merge pull request #6152 from Mailaender/money-crate

Added money crates to be spawned by destroyed supply trucks
This commit is contained in:
Chris Forbes
2014-08-04 10:39:29 +12:00
8 changed files with 45 additions and 34 deletions

View File

@@ -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),
}));
}
}
}

View File

@@ -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)

View File

@@ -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)
{

View File

@@ -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" />