Merge branch 'master' of git://github.com/chrisforbes/OpenRA

This commit is contained in:
Paul Chote
2010-01-08 22:28:12 +13:00
7 changed files with 38 additions and 28 deletions

View File

@@ -767,7 +767,7 @@ namespace OpenRa.Game
var seconds = ticks / 25;
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)

View File

@@ -9,7 +9,7 @@ namespace OpenRa.Game.GameRules
{
public readonly bool Powered = true;
public readonly bool OneShot = false;
public readonly int ChargeTime = 0;
public readonly float ChargeTime = 0;
public readonly string Image;
public readonly string Description = "";
public readonly string LongDesc = "";

View File

@@ -122,6 +122,7 @@
<Compile Include="Smudge.cs" />
<Compile Include="Sound.cs" />
<Compile Include="SupportPower.cs" />
<Compile Include="SupportPowers\GpsSatellite.cs" />
<Compile Include="SupportPowers\ISupportPowerImpl.cs" />
<Compile Include="SupportPowers\NullPower.cs" />
<Compile Include="Support\Stopwatch.cs" />

View File

@@ -8,6 +8,8 @@ using OpenRa.Game.SupportPowers;
namespace OpenRa.Game
{
// todo: fix this to route Activate through the orders system (otherwise desync in netplay)
class SupportPower
{
public readonly SupportPowerInfo Info;
@@ -26,7 +28,7 @@ namespace OpenRa.Game
{
Info = info;
Owner = owner;
RemainingTime = TotalTime = (int)info.ChargeTime * 60 * 25;
RemainingTime = TotalTime = (int)(info.ChargeTime * 60 * 25);
Impl = ConstructPowerImpl(info.Impl);
}

View 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();
}
}
}

View File

@@ -2,28 +2,5 @@
namespace OpenRa.Game.Traits
{
class GpsSatellite : ITick
{
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;
}
}
class GpsSatellite { public GpsSatellite(Actor self) { } }
}

View File

@@ -889,7 +889,7 @@ OneShot=yes
Prerequisite=ATEK
Image=gpssicon
TechLevel=12
Impl=NullPower
Impl=GpsSatellite
AutoActivate=yes
[InvulnerabilityPower] ; the point of IRON