merged
This commit is contained in:
@@ -414,7 +414,7 @@ namespace OpenRa.Game
|
|||||||
shpRenderer.Flush();
|
shpRenderer.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawChat()
|
void DrawChat()
|
||||||
{
|
{
|
||||||
var chatpos = new int2(400, Game.viewport.Height - 20);
|
var chatpos = new int2(400, Game.viewport.Height - 20);
|
||||||
|
|||||||
@@ -13,6 +13,5 @@ namespace OpenRa.Game.GameRules
|
|||||||
public readonly int TechLevel = -1;
|
public readonly int TechLevel = -1;
|
||||||
public readonly bool GivenAuto = true;
|
public readonly bool GivenAuto = true;
|
||||||
public readonly string Impl = null;
|
public readonly string Impl = null;
|
||||||
public readonly bool AutoActivate = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
<Compile Include="SupportPower.cs" />
|
<Compile Include="SupportPower.cs" />
|
||||||
<Compile Include="SupportPowers\Chronoshift.cs" />
|
<Compile Include="SupportPowers\Chronoshift.cs" />
|
||||||
<Compile Include="SupportPowers\GpsSatellite.cs" />
|
<Compile Include="SupportPowers\GpsSatellite.cs" />
|
||||||
<Compile Include="SupportPowers\IronCurtain.cs" />
|
<Compile Include="SupportPowers\IronCurtainPower.cs" />
|
||||||
<Compile Include="SupportPowers\ISupportPowerImpl.cs" />
|
<Compile Include="SupportPowers\ISupportPowerImpl.cs" />
|
||||||
<Compile Include="SupportPowers\NullPower.cs" />
|
<Compile Include="SupportPowers\NullPower.cs" />
|
||||||
<Compile Include="Support\Stopwatch.cs" />
|
<Compile Include="Support\Stopwatch.cs" />
|
||||||
@@ -318,4 +318,4 @@
|
|||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -4,11 +4,17 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using OpenRa.Game.GameRules;
|
using OpenRa.Game.GameRules;
|
||||||
using OpenRa.Game.Traits;
|
using OpenRa.Game.Traits;
|
||||||
|
using OpenRa.Game.SupportPowers;
|
||||||
namespace OpenRa.Game.Orders
|
namespace OpenRa.Game.Orders
|
||||||
{
|
{
|
||||||
class IronCurtainOrderGenerator : IOrderGenerator
|
class IronCurtainOrderGenerator : IOrderGenerator
|
||||||
{
|
{
|
||||||
|
ISupportPowerImpl power;
|
||||||
|
public IronCurtainOrderGenerator(ISupportPowerImpl power)
|
||||||
|
{
|
||||||
|
this.power = power;
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<Order> Order(int2 xy, MouseInput mi)
|
public IEnumerable<Order> Order(int2 xy, MouseInput mi)
|
||||||
{
|
{
|
||||||
if (mi.Button == MouseButton.Right)
|
if (mi.Button == MouseButton.Right)
|
||||||
@@ -31,7 +37,8 @@ namespace OpenRa.Game.Orders
|
|||||||
|
|
||||||
if (unit != null)
|
if (unit != null)
|
||||||
{
|
{
|
||||||
yield return new Order("IronCurtain", underCursor, null, int2.Zero, null);
|
yield return new Order("IronCurtain", underCursor, this.power);
|
||||||
|
//yield return new Order("IronCurtain", underCursor, null, int2.Zero, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using OpenRa.Game.SupportPowers;
|
||||||
|
|
||||||
namespace OpenRa.Game
|
namespace OpenRa.Game
|
||||||
{
|
{
|
||||||
@@ -31,6 +32,19 @@ 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()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ namespace OpenRa.Game
|
|||||||
public bool IsDone { get { return RemainingTime == 0; } }
|
public bool IsDone { get { return RemainingTime == 0; } }
|
||||||
public int RemainingTime { get; private set; }
|
public int RemainingTime { get; private set; }
|
||||||
public int TotalTime { get; private set; }
|
public int TotalTime { get; private set; }
|
||||||
|
bool notifiedReady = false;
|
||||||
|
bool notifiedCharging = false;
|
||||||
|
|
||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
if (Info.OneShot && IsUsed)
|
if (Info.OneShot && IsUsed)
|
||||||
@@ -56,10 +58,20 @@ namespace OpenRa.Game
|
|||||||
if (IsAvailable && (!Info.Powered || Owner.GetPowerState() == PowerState.Normal))
|
if (IsAvailable && (!Info.Powered || Owner.GetPowerState() == PowerState.Normal))
|
||||||
{
|
{
|
||||||
if (RemainingTime > 0) --RemainingTime;
|
if (RemainingTime > 0) --RemainingTime;
|
||||||
|
if (!notifiedCharging)
|
||||||
|
{
|
||||||
|
Impl.IsChargingNotification(this);
|
||||||
|
notifiedCharging = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RemainingTime == 0 && Info.AutoActivate)
|
if (RemainingTime == 0
|
||||||
Activate();
|
&& Impl != null
|
||||||
|
&& !notifiedReady)
|
||||||
|
{
|
||||||
|
Impl.IsReadyNotification(this);
|
||||||
|
notifiedReady = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
public void Activate()
|
||||||
@@ -76,6 +88,8 @@ namespace OpenRa.Game
|
|||||||
IsAvailable = false;
|
IsAvailable = false;
|
||||||
}
|
}
|
||||||
RemainingTime = TotalTime;
|
RemainingTime = TotalTime;
|
||||||
|
notifiedReady = false;
|
||||||
|
notifiedCharging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Give(bool requireCharge) // called by crate/spy/etc code
|
public void Give(bool requireCharge) // called by crate/spy/etc code
|
||||||
|
|||||||
@@ -11,5 +11,9 @@ namespace OpenRa.Game.SupportPowers
|
|||||||
if (Game.controller.ToggleInputMode<ChronosphereSelectOrderGenerator>())
|
if (Game.controller.ToggleInputMode<ChronosphereSelectOrderGenerator>())
|
||||||
Sound.Play("slcttgt1.aud");
|
Sound.Play("slcttgt1.aud");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnFireNotification(Actor target, int2 xy) {}
|
||||||
|
public void IsChargingNotification(SupportPower p) {}
|
||||||
|
public void IsReadyNotification(SupportPower p) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,16 @@ namespace OpenRa.Game.SupportPowers
|
|||||||
{
|
{
|
||||||
class GpsSatellite : ISupportPowerImpl
|
class GpsSatellite : ISupportPowerImpl
|
||||||
{
|
{
|
||||||
const int revealDelay = 30 * 25;
|
const int revealDelay = 15 * 25;
|
||||||
|
|
||||||
|
public void OnFireNotification(Actor a, int2 xy) { }
|
||||||
|
public void IsChargingNotification(SupportPower p) { }
|
||||||
|
public void IsReadyNotification(SupportPower p)
|
||||||
|
{
|
||||||
|
// Power is auto-activated
|
||||||
|
Activate(p);
|
||||||
|
}
|
||||||
|
|
||||||
public void Activate(SupportPower p)
|
public void Activate(SupportPower p)
|
||||||
{
|
{
|
||||||
var launchSite = Game.world.Actors
|
var launchSite = Game.world.Actors
|
||||||
|
|||||||
@@ -8,5 +8,8 @@ namespace OpenRa.Game.SupportPowers
|
|||||||
interface ISupportPowerImpl
|
interface ISupportPowerImpl
|
||||||
{
|
{
|
||||||
void Activate(SupportPower p);
|
void Activate(SupportPower p);
|
||||||
|
void OnFireNotification(Actor target, int2 xy);
|
||||||
|
void IsChargingNotification(SupportPower p);
|
||||||
|
void IsReadyNotification(SupportPower p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
43
OpenRa.Game/SupportPowers/IronCurtainPower.cs
Normal file
43
OpenRa.Game/SupportPowers/IronCurtainPower.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRa.Game.Orders;
|
||||||
|
using OpenRa.Game.Traits;
|
||||||
|
|
||||||
|
namespace OpenRa.Game.SupportPowers
|
||||||
|
{
|
||||||
|
class IronCurtainPower : ISupportPowerImpl
|
||||||
|
{
|
||||||
|
public void IsReadyNotification(SupportPower p)
|
||||||
|
{
|
||||||
|
Sound.Play("ironrdy1.aud");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void IsChargingNotification(SupportPower p)
|
||||||
|
{
|
||||||
|
Sound.Play("ironchg1.aud");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnFireNotification(Actor target, int2 xy)
|
||||||
|
{
|
||||||
|
p.FinishActivate();
|
||||||
|
Game.controller.CancelInputMode();
|
||||||
|
Sound.Play("ironcur9.aud");
|
||||||
|
|
||||||
|
// Play active anim
|
||||||
|
var ironCurtain = Game.world.Actors
|
||||||
|
.Where(a => a.Owner == p.Owner && a.traits.Contains<IronCurtain>())
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (ironCurtain != null)
|
||||||
|
ironCurtain.traits.Get<RenderBuilding>().PlayCustomAnim(ironCurtain, "active");
|
||||||
|
}
|
||||||
|
SupportPower p;
|
||||||
|
public void Activate(SupportPower p)
|
||||||
|
{
|
||||||
|
this.p = p;
|
||||||
|
// Pick a building to use
|
||||||
|
Game.controller.orderGenerator = new IronCurtainOrderGenerator(this);
|
||||||
|
Sound.Play("slcttgt1.aud");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,9 @@ namespace OpenRa.Game.SupportPowers
|
|||||||
{
|
{
|
||||||
class NullPower : ISupportPowerImpl
|
class NullPower : ISupportPowerImpl
|
||||||
{
|
{
|
||||||
|
public void OnFireNotification(Actor a, int2 xy) { }
|
||||||
|
public void IsReadyNotification(SupportPower p) { }
|
||||||
|
public void IsChargingNotification(SupportPower p) { }
|
||||||
public void Activate(SupportPower p)
|
public void Activate(SupportPower p)
|
||||||
{
|
{
|
||||||
// if this was a real power, i'd do something here!
|
// if this was a real power, i'd do something here!
|
||||||
|
|||||||
@@ -28,16 +28,9 @@ namespace OpenRa.Game.Traits
|
|||||||
{
|
{
|
||||||
if (order.OrderString == "IronCurtain")
|
if (order.OrderString == "IronCurtain")
|
||||||
{
|
{
|
||||||
Game.controller.CancelInputMode();
|
order.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);
|
||||||
Sound.Play("ironcur9.aud");
|
|
||||||
// Play active anim
|
|
||||||
var ironCurtain = Game.world.Actors
|
|
||||||
.Where(a => a.Owner == order.Subject.Owner && a.traits.Contains<IronCurtain>())
|
|
||||||
.FirstOrDefault();
|
|
||||||
if (ironCurtain != null)
|
|
||||||
ironCurtain.traits.Get<RenderBuilding>().PlayCustomAnim(ironCurtain, "active");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -890,7 +890,6 @@ Prerequisite=ATEK
|
|||||||
Image=gpssicon
|
Image=gpssicon
|
||||||
TechLevel=12
|
TechLevel=12
|
||||||
Impl=GpsSatellite
|
Impl=GpsSatellite
|
||||||
AutoActivate=yes
|
|
||||||
|
|
||||||
[InvulnerabilityPower] ; the point of IRON
|
[InvulnerabilityPower] ; the point of IRON
|
||||||
ChargeTime=11
|
ChargeTime=11
|
||||||
@@ -899,4 +898,4 @@ LongDesc=Makes a single unit invulnerable for a \nshort time.
|
|||||||
Image=infxicon
|
Image=infxicon
|
||||||
Prerequisite=IRON
|
Prerequisite=IRON
|
||||||
TechLevel=12
|
TechLevel=12
|
||||||
Impl=IronCurtain
|
Impl=IronCurtainPower
|
||||||
|
|||||||
Reference in New Issue
Block a user