Parabomb crates. Multiple can be collected and queued. Support uncharged powers (0 charge time) with appropriate tooltip.

This commit is contained in:
Paul Chote
2010-12-05 23:32:29 +13:00
parent d1850e8b4b
commit c7500084df
3 changed files with 38 additions and 32 deletions

View File

@@ -10,32 +10,30 @@
using System.Linq;
using OpenRA.Traits;
using OpenRA.FileFormats;
namespace OpenRA.Mods.RA.Crates
{
class SupportPowerCrateActionInfo : CrateActionInfo
{
public readonly string Power = null;
public readonly string Proxy = null;
public override object Create(ActorInitializer init) { return new SupportPowerCrateAction(init.self, this); }
}
class SupportPowerCrateAction : CrateAction
{
SupportPowerCrateActionInfo Info;
public SupportPowerCrateAction(Actor self, SupportPowerCrateActionInfo info)
: base(self, info) { }
: base(self, info) { Info = info; }
// The free unit crate requires same race, and the actor to be at least ITeleportable.
// We want neither of these properties for crate power proxies.
public override void Activate(Actor collector)
{
throw new System.NotImplementedException();
// shit and broken. if you have a single-use and a multi-use version of the same
// support power, this only works by order-coincidence. that's stupid.
//var p = collector.Owner.PlayerActor.TraitsImplementing<SupportPower>()
// .FirstOrDefault(sp => sp.GetType().Name == (info as SupportPowerCrateActionInfo).Power);
//if (p != null) p.Give(1);
//base.Activate(collector);
collector.World.AddFrameEndTask(w => w.CreateActor(Info.Proxy, new TypeDictionary
{
new OwnerInit( collector.Owner )
}));
}
}
}

View File

@@ -103,7 +103,9 @@ namespace OpenRA.Mods.RA.Widgets
var pos = drawPos.ToInt2();
var tl = new int2(pos.X-3,pos.Y-3);
var m = new int2(pos.X+64+3,pos.Y+48+3);
var br = tl + new int2(64+3+20,60);
var br = tl + new int2(64+3+20,40);
if (sp.TotalTime > 0)
br += new int2(0,20);
if (sp.Info.LongDesc != null)
br += Game.Renderer.RegularFont.Measure(sp.Info.LongDesc.Replace("\\n", "\n"));
@@ -122,9 +124,12 @@ namespace OpenRA.Mods.RA.Widgets
pos += new int2(77, 5);
Game.Renderer.BoldFont.DrawText(sp.Info.Description, pos, Color.White);
pos += new int2(0,20);
Game.Renderer.BoldFont.DrawText(WidgetUtils.FormatTime(sp.RemainingTime).ToString(), pos, Color.White);
Game.Renderer.BoldFont.DrawText("/ {0}".F(WidgetUtils.FormatTime(sp.TotalTime)), pos + new int2(45,0), Color.White);
if (sp.TotalTime > 0)
{
pos += new int2(0,20);
Game.Renderer.BoldFont.DrawText(WidgetUtils.FormatTime(sp.RemainingTime).ToString(), pos, Color.White);
Game.Renderer.BoldFont.DrawText("/ {0}".F(WidgetUtils.FormatTime(sp.TotalTime)), pos + new int2(45,0), Color.White);
}
if (sp.Info.LongDesc != null)
{
@@ -136,7 +141,7 @@ namespace OpenRA.Mods.RA.Widgets
WidgetUtils.DrawSHP(image, drawPos, wr);
clock.PlayFetchIndex("idle",
() => (sp.TotalTime - sp.RemainingTime)
() => sp.TotalTime == 0 ? clock.CurrentSequence.Length - 1 : (sp.TotalTime - sp.RemainingTime)
* (clock.CurrentSequence.Length - 1) / sp.TotalTime);
clock.Tick();

View File

@@ -33,16 +33,6 @@ Player:
# OneShot: yes
# EndChargeSound: pulse1.aud
# SelectTargetSound: slcttgt1.aud
# AirstrikePower:
# Image: pbmbicon
# ChargeTime: 1
# Description: Parabombs (Single Use)
# LongDesc: A Badger drops a load of parachuted bombs on your target.
# GivenAuto: no
# OneShot: yes
# UnitType: badr.bomber
# SelectTargetSound: slcttgt1.aud
# FlareType: flare
SupportPowerManager:
ConquestVictoryConditions:
PowerManager:
@@ -94,8 +84,8 @@ World:
BridgeLayer:
Bridges: bridge1, bridge2, br1, br2, br3
CrateDrop:
Minimum: 1
Maximum: 3
Minimum: 100
Maximum: 300
SpawnInterval: 120
WaterChance: .2
PaletteFromCurrentTileset:
@@ -234,9 +224,9 @@ CRATE:
SelectionShares: 1
Effect: reveal-map
SupportPowerCrateAction@parabombs:
Power: AirstrikePower
SelectionShares: 5
Effect: parabombs
SelectionShares: 50000
Proxy: crateproxy.parabombs
RequiresRace: no
GiveMcvCrateAction:
SelectionShares: 2
NoBaseSelectionShares: 9001
@@ -281,3 +271,16 @@ FLARE:
RenderFlare:
Image: smokland
HiddenUnderFog:
Tooltip:
Name: Flare
crateproxy.parabombs:
AirstrikePower:
Image: pbmbicon
Description: Parabombs (Single Use)
LongDesc: A Badger drops a load of parachuted\nbombs on your target.
OneShot: yes
AllowMultiple: yes
UnitType: badr.bomber
SelectTargetSound: slcttgt1.aud
FlareType: flare