unfailing order stuff
This commit is contained in:
@@ -9,8 +9,8 @@ namespace OpenRa.Game.Orders
|
||||
{
|
||||
class IronCurtainOrderGenerator : IOrderGenerator
|
||||
{
|
||||
ISupportPowerImpl power;
|
||||
public IronCurtainOrderGenerator(ISupportPowerImpl power)
|
||||
SupportPower power;
|
||||
public IronCurtainOrderGenerator(SupportPower power)
|
||||
{
|
||||
this.power = power;
|
||||
}
|
||||
@@ -36,10 +36,7 @@ namespace OpenRa.Game.Orders
|
||||
var unit = underCursor != null ? underCursor.Info as UnitInfo : null;
|
||||
|
||||
if (unit != null)
|
||||
{
|
||||
yield return new Order("IronCurtain", underCursor, this.power);
|
||||
//yield return new Order("IronCurtain", underCursor, null, int2.Zero, null);
|
||||
}
|
||||
yield return new Order("IronCurtain", underCursor, null, int2.Zero, power.Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,19 +32,6 @@ namespace OpenRa.Game
|
||||
this.TargetLocation = targetLocation;
|
||||
this.TargetString = targetString;
|
||||
}
|
||||
// This is a hack - fix me
|
||||
public readonly ISupportPowerImpl Power;
|
||||
public Order(string orderString, Actor subject, ISupportPowerImpl power)
|
||||
{
|
||||
this.OrderString = orderString;
|
||||
this.SubjectId = UIntFromActor( subject );
|
||||
|
||||
this.Power = power;
|
||||
|
||||
this.TargetActorId = UIntFromActor(null);
|
||||
this.TargetLocation = int2.Zero;
|
||||
this.TargetString = null;
|
||||
}
|
||||
|
||||
public bool Validate()
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRa.Game
|
||||
|
||||
SupportPowers = Rules.SupportPowerInfo.ToDictionary(
|
||||
spi => spi.Key,
|
||||
spi => new SupportPower(spi.Value, this));
|
||||
spi => new SupportPower(spi.Key, spi.Value, this));
|
||||
}
|
||||
|
||||
void UpdatePower()
|
||||
|
||||
@@ -11,7 +11,8 @@ namespace OpenRa.Game
|
||||
{
|
||||
public readonly SupportPowerInfo Info;
|
||||
public readonly Player Owner;
|
||||
readonly ISupportPowerImpl Impl;
|
||||
public readonly ISupportPowerImpl Impl;
|
||||
public readonly string Name;
|
||||
|
||||
static ISupportPowerImpl ConstructPowerImpl(string implName)
|
||||
{
|
||||
@@ -21,8 +22,9 @@ namespace OpenRa.Game
|
||||
return (ISupportPowerImpl)ctor.Invoke(new object[] { });
|
||||
}
|
||||
|
||||
public SupportPower(SupportPowerInfo info, Player owner)
|
||||
public SupportPower(string name, SupportPowerInfo info, Player owner)
|
||||
{
|
||||
Name = name;
|
||||
Info = info;
|
||||
Owner = owner;
|
||||
RemainingTime = TotalTime = (int)(info.ChargeTime * 60 * 25);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRa.Game.SupportPowers
|
||||
{
|
||||
this.p = p;
|
||||
// Pick a building to use
|
||||
Game.controller.orderGenerator = new IronCurtainOrderGenerator(this);
|
||||
Game.controller.orderGenerator = new IronCurtainOrderGenerator(p);
|
||||
Sound.Play("slcttgt1.aud");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace OpenRa.Game.Traits
|
||||
{
|
||||
if (order.OrderString == "IronCurtain")
|
||||
{
|
||||
order.Power.OnFireNotification(self, self.Location);
|
||||
var power = self.Owner.SupportPowers[order.TargetString].Impl;
|
||||
power.OnFireNotification(self, self.Location);
|
||||
Game.world.AddFrameEndTask(w => w.Add(new InvulnEffect(self)));
|
||||
RemainingTicks = (int)(Rules.General.IronCurtain * 60 * 25);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user