added flare to paratroopers power

This commit is contained in:
Chris Forbes
2010-04-12 20:06:27 +12:00
parent 4d2c5ea83c
commit e1852cadd3
6 changed files with 44 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -83,6 +83,7 @@
<Compile Include="Traits\AI\EmitInfantryOnSell.cs" />
<Compile Include="Traits\AI\ReturnOnIdle.cs" />
<Compile Include="Traits\Render\HiddenUnderFog.cs" />
<Compile Include="Traits\Render\RenderFlare.cs" />
<Compile Include="Traits\World\Shroud.cs" />
<Compile Include="Widgets\Delegates\ConnectionDialogsDelegate.cs" />
<Compile Include="Widgets\Delegates\CreateServerMenuDelegate.cs" />

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRA.Traits.Render
{
class RenderFlareInfo : RenderSimpleInfo
{
public override object Create(Actor self) { return new RenderFlare(self); }
}
class RenderFlare : RenderSimple
{
public RenderFlare(Actor self)
: base(self, () => 0)
{
anim.PlayThen("open", () => anim.PlayRepeating("idle"));
}
}
}

View File

@@ -82,7 +82,7 @@ namespace OpenRA.Mods.RA_NG
plane.traits.Get<Unit>().Facing = Util.GetFacing(p - startPos, 0);
plane.CancelActivity();
plane.QueueActivity(new FlyCircle(p));
plane.traits.Get<ParaDrop>().SetLZ(p);
plane.traits.Get<ParaDrop>().SetLZ(p, null);
plane.traits.Get<Cargo>().Load(plane, crate);
});
return;

View File

@@ -35,10 +35,12 @@ namespace OpenRA.Mods.RA
{
readonly List<int2> droppedAt = new List<int2>();
int2 lz;
Actor flare;
public void SetLZ( int2 lz )
public void SetLZ( int2 lz, Actor flare )
{
this.lz = lz;
this.flare = flare;
droppedAt.Clear();
}
@@ -76,6 +78,13 @@ namespace OpenRA.Mods.RA
self.CancelActivity();
self.QueueActivity(new FlyOffMap { Interruptible = false });
self.QueueActivity(new RemoveSelf());
if (flare != null)
{
flare.CancelActivity();
flare.QueueActivity(new Wait(300));
flare.QueueActivity(new RemoveSelf());
}
}
}
}

View File

@@ -59,13 +59,15 @@ namespace OpenRA.Mods.RA
var startPos = owner.World.ChooseRandomEdgeCell();
owner.World.AddFrameEndTask(w =>
{
var flare = w.CreateActor("FLARE", p, owner);
var a = w.CreateActor("BADR", startPos, owner);
a.traits.Get<Unit>().Facing = Util.GetFacing(p - startPos, 0);
a.traits.Get<Unit>().Altitude = a.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
a.CancelActivity();
a.QueueActivity(new FlyCircle(p));
a.traits.Get<ParaDrop>().SetLZ(p);
a.traits.Get<ParaDrop>().SetLZ(p, flare);
var cargo = a.traits.Get<Cargo>();
foreach (var i in items)

View File

@@ -345,3 +345,10 @@ CAMERA:
Unit:
HP:1000
Sight: 10
FLARE:
Unit:
HP:1000
Sight: 3
RenderFlare:
Image: smokland