Merge branch 'master' of git://github.com/chrisforbes/OpenRA
This commit is contained in:
@@ -767,7 +767,7 @@ namespace OpenRa.Game
|
|||||||
var seconds = ticks / 25;
|
var seconds = ticks / 25;
|
||||||
var minutes = seconds / 60;
|
var minutes = seconds / 60;
|
||||||
|
|
||||||
return "{0}:{1}".F(minutes, seconds % 60);
|
return "{0:D2}:{1:D2}".F(minutes, seconds % 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSupportPowerTooltip(string sp, int2 pos)
|
void DrawSupportPowerTooltip(string sp, int2 pos)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace OpenRa.Game.GameRules
|
|||||||
{
|
{
|
||||||
public readonly bool Powered = true;
|
public readonly bool Powered = true;
|
||||||
public readonly bool OneShot = false;
|
public readonly bool OneShot = false;
|
||||||
public readonly int ChargeTime = 0;
|
public readonly float ChargeTime = 0;
|
||||||
public readonly string Image;
|
public readonly string Image;
|
||||||
public readonly string Description = "";
|
public readonly string Description = "";
|
||||||
public readonly string LongDesc = "";
|
public readonly string LongDesc = "";
|
||||||
|
|||||||
@@ -122,6 +122,7 @@
|
|||||||
<Compile Include="Smudge.cs" />
|
<Compile Include="Smudge.cs" />
|
||||||
<Compile Include="Sound.cs" />
|
<Compile Include="Sound.cs" />
|
||||||
<Compile Include="SupportPower.cs" />
|
<Compile Include="SupportPower.cs" />
|
||||||
|
<Compile Include="SupportPowers\GpsSatellite.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" />
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ using OpenRa.Game.SupportPowers;
|
|||||||
|
|
||||||
namespace OpenRa.Game
|
namespace OpenRa.Game
|
||||||
{
|
{
|
||||||
|
// todo: fix this to route Activate through the orders system (otherwise desync in netplay)
|
||||||
|
|
||||||
class SupportPower
|
class SupportPower
|
||||||
{
|
{
|
||||||
public readonly SupportPowerInfo Info;
|
public readonly SupportPowerInfo Info;
|
||||||
@@ -26,7 +28,7 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
Info = info;
|
Info = info;
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
RemainingTime = TotalTime = (int)info.ChargeTime * 60 * 25;
|
RemainingTime = TotalTime = (int)(info.ChargeTime * 60 * 25);
|
||||||
Impl = ConstructPowerImpl(info.Impl);
|
Impl = ConstructPowerImpl(info.Impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
30
OpenRa.Game/SupportPowers/GpsSatellite.cs
Normal file
30
OpenRa.Game/SupportPowers/GpsSatellite.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using OpenRa.Game.Effects;
|
||||||
|
|
||||||
|
namespace OpenRa.Game.SupportPowers
|
||||||
|
{
|
||||||
|
class GpsSatellite : ISupportPowerImpl
|
||||||
|
{
|
||||||
|
const int revealDelay = 30 * 25;
|
||||||
|
|
||||||
|
public void Activate(SupportPower p)
|
||||||
|
{
|
||||||
|
var launchSite = Game.world.Actors
|
||||||
|
.FirstOrDefault( a => a.Owner == p.Owner && a.traits.Contains<Traits.GpsSatellite>() );
|
||||||
|
|
||||||
|
if (launchSite == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Game.world.AddFrameEndTask(w =>
|
||||||
|
{
|
||||||
|
w.Add(new SatelliteLaunch(launchSite));
|
||||||
|
w.Add(new DelayedAction(revealDelay, () => p.Owner.Shroud.HasGPS = true));
|
||||||
|
});
|
||||||
|
|
||||||
|
p.FinishActivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,28 +2,5 @@
|
|||||||
|
|
||||||
namespace OpenRa.Game.Traits
|
namespace OpenRa.Game.Traits
|
||||||
{
|
{
|
||||||
class GpsSatellite : ITick
|
class GpsSatellite { public GpsSatellite(Actor self) { } }
|
||||||
{
|
|
||||||
int frame = 0;
|
|
||||||
int revealTicks = 30 * 25; // 30 second delay between launch and reveal
|
|
||||||
bool fired = false;
|
|
||||||
|
|
||||||
public GpsSatellite(Actor self) {}
|
|
||||||
public void Tick(Actor self)
|
|
||||||
{
|
|
||||||
// HACK: Launch after 5 seconds
|
|
||||||
if (++frame == 150)
|
|
||||||
Activate(self);
|
|
||||||
|
|
||||||
if (fired && --revealTicks == 0)
|
|
||||||
{
|
|
||||||
self.Owner.Shroud.HasGPS = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void Activate(Actor self)
|
|
||||||
{
|
|
||||||
Game.world.AddFrameEndTask(w => w.Add(new SatelliteLaunch(self)));
|
|
||||||
fired = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user