@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* 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,
|
||||
@@ -8,23 +8,43 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
// for some reason I get yelled at for pbox.e1 not having Cargo, but that's a lie?
|
||||
class EmitCargoOnSellInfo : TraitInfo<EmitCargoOnSell>//, Requires<Cargo>
|
||||
class EmitCargoOnSellInfo : ITraitInfo//, Requires<Cargo> // TODO: this breaks for no apparent reason
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new EmitCargoOnSell(init); }
|
||||
}
|
||||
|
||||
class EmitCargoOnSell : INotifySold
|
||||
{
|
||||
static void Emit(Actor self)
|
||||
readonly Cargo cargo;
|
||||
Actor passenger;
|
||||
|
||||
public EmitCargoOnSell(ActorInitializer init)
|
||||
{
|
||||
// TODO: would like to spill all actors out similar to how we call Unload
|
||||
cargo = init.self.Trait<Cargo>();
|
||||
}
|
||||
|
||||
public void Selling(Actor self) { Emit(self); }
|
||||
public void Sold(Actor self) { }
|
||||
public void Selling(Actor self)
|
||||
{
|
||||
// TODO: support more than one passenger
|
||||
passenger = cargo.Unload(self);
|
||||
}
|
||||
|
||||
public void Sold(Actor self)
|
||||
{
|
||||
if (passenger == null)
|
||||
return;
|
||||
|
||||
self.World.AddFrameEndTask(w => w.CreateActor(passenger.Info.Name, new TypeDictionary
|
||||
{
|
||||
new LocationInit(self.Location),
|
||||
new OwnerInit(self.Owner),
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,6 +439,7 @@ PBOX:
|
||||
PipCount: 1
|
||||
InitialUnits: e1
|
||||
-EmitInfantryOnSell:
|
||||
EmitCargoOnSell:
|
||||
DrawLineToTarget:
|
||||
AttackGarrisoned:
|
||||
Armaments: garrisoned
|
||||
@@ -485,6 +486,7 @@ HBOX:
|
||||
PipCount: 1
|
||||
InitialUnits: e1
|
||||
-EmitInfantryOnSell:
|
||||
EmitCargoOnSell:
|
||||
DrawLineToTarget:
|
||||
DetectCloaked:
|
||||
Range: 6
|
||||
|
||||
Reference in New Issue
Block a user