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