Added some trait [Desc()]s.
This commit is contained in:
@@ -17,19 +17,20 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("This actor can enter Cargo actors.")]
|
||||
public class PassengerInfo : ITraitInfo
|
||||
{
|
||||
public readonly string CargoType = null;
|
||||
public readonly PipType PipType = PipType.Green;
|
||||
public int Weight = 1;
|
||||
|
||||
public object Create( ActorInitializer init ) { return new Passenger( this ); }
|
||||
public object Create(ActorInitializer init) { return new Passenger(this); }
|
||||
}
|
||||
|
||||
public class Passenger : IIssueOrder, IResolveOrder, IOrderVoice
|
||||
{
|
||||
public readonly PassengerInfo info;
|
||||
public Passenger( PassengerInfo info ) { this.info = info; }
|
||||
public Passenger(PassengerInfo info) { this.info = info; }
|
||||
public Actor Transport;
|
||||
|
||||
public IEnumerable<IOrderTargeter> Orders
|
||||
@@ -41,21 +42,21 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
public Order IssueOrder( Actor self, IOrderTargeter order, Target target, bool queued )
|
||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
{
|
||||
if( order.OrderID == "EnterTransport" )
|
||||
if (order.OrderID == "EnterTransport")
|
||||
return new Order(order.OrderID, self, queued) { TargetActor = target.Actor };
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
bool IsCorrectCargoType( Actor target )
|
||||
bool IsCorrectCargoType(Actor target)
|
||||
{
|
||||
var ci = target.Info.Traits.Get<CargoInfo>();
|
||||
return ci.Types.Contains( info.CargoType );
|
||||
return ci.Types.Contains(info.CargoType);
|
||||
}
|
||||
|
||||
bool CanEnter( Actor target )
|
||||
bool CanEnter(Actor target)
|
||||
{
|
||||
var cargo = target.TraitOrDefault<Cargo>();
|
||||
return cargo != null && cargo.HasSpace(info.Weight);
|
||||
|
||||
Reference in New Issue
Block a user