Fix Monodevelop build; remove Aftermath project.

This commit is contained in:
Paul Chote
2010-07-25 14:55:44 +12:00
parent 484bea106b
commit 5776d351b4
16 changed files with 66 additions and 192 deletions

View File

@@ -0,0 +1,116 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System.Collections.Generic;
using OpenRA.Effects;
using OpenRA.Mods.Aftermath.Orders;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class ChronoshiftDeployInfo : TraitInfo<ChronoshiftDeploy>
{
public readonly int ChargeTime = 120; // Seconds
}
class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ITick, IPips, IOrderCursor, IOrderVoice
{
// Recharge logic
[Sync]
int chargeTick = 0; // How long until we can chronoshift again?
public void Tick(Actor self)
{
if (chargeTick > 0)
chargeTick--;
}
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
{
if (mi.Button == MouseButton.Right && xy == self.Location)
return new Order("ChronoshiftDeploy", self);
return null;
}
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "ChronoshiftDeploy")
{
if (self.Owner == self.World.LocalPlayer)
Game.controller.orderGenerator = new SetChronoTankDestination(self);
return;
}
var movement = self.traits.GetOrDefault<IMove>();
if (order.OrderString == "ChronoshiftSelf" && movement.CanEnterCell(order.TargetLocation))
{
if (self.Owner == self.World.LocalPlayer)
{
Game.controller.CancelInputMode();
self.World.AddFrameEndTask(w => w.Add(new MoveFlash(self.World, order.TargetLocation)));
}
self.CancelActivity();
self.QueueActivity(new Teleport(order.TargetLocation));
Sound.Play("chrotnk1.aud", self.CenterLocation);
Sound.Play("chrotnk1.aud", Game.CellSize * order.TargetLocation.ToFloat2());
chargeTick = 25 * self.Info.Traits.Get<ChronoshiftDeployInfo>().ChargeTime;
foreach (var a in self.World.Queries.WithTrait<ChronoshiftPaletteEffect>())
a.Trait.Enable();
}
}
public string CursorForOrder(Actor self, Order order)
{
if (order.OrderString != "ChronoshiftDeploy")
return null;
return (chargeTick <= 0) ? "deploy" : "deploy-blocked";
}
public string VoicePhraseForOrder(Actor self, Order order)
{
return (order.OrderString == "ChronoshiftDeploy" && chargeTick <= 0) ? "Move" : null;
}
// Display 5 pips indicating the current charge status
public IEnumerable<PipType> GetPips(Actor self)
{
const int numPips = 5;
for (int i = 0; i < numPips; i++)
{
if ((1 - chargeTick * 1.0f / (25 * self.Info.Traits.Get<ChronoshiftDeployInfo>().ChargeTime)) * numPips < i + 1)
{
yield return PipType.Transparent;
continue;
}
switch (i)
{
case 0:
case 1:
yield return PipType.Red;
break;
case 2:
case 3:
yield return PipType.Yellow;
break;
case 4:
yield return PipType.Green;
break;
}
}
}
}
}

View File

@@ -0,0 +1,55 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using OpenRA.Mods.RA;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class DemoTruckInfo : TraitInfo<DemoTruck> { }
class DemoTruck : Chronoshiftable, INotifyDamage
{
// Explode on chronoshift
public override bool Activate(Actor self, int2 targetLocation, int duration, bool killCargo, Actor chronosphere)
{
Detonate(self, chronosphere);
return false;
}
// Fire primary on death
public void Damaged(Actor self, AttackInfo e)
{
if (e.DamageState == DamageState.Dead)
Detonate(self, e.Attacker);
}
public void Detonate(Actor self, Actor detonatedBy)
{
var unit = self.traits.GetOrDefault<Unit>();
var info = self.Info.Traits.Get<AttackBaseInfo>();
var altitude = unit != null ? unit.Altitude : 0;
self.World.AddFrameEndTask( w =>
{
Combat.DoExplosion(self, info.PrimaryWeapon, self.CenterLocation, altitude);
var report = self.GetPrimaryWeapon().Report;
if (report != null)
Sound.Play(report + ".aud", self.CenterLocation);
// Remove from world
self.Health = 0;
detonatedBy.Owner.Kills++;
self.Owner.Deaths++;
w.Remove(self);
} );
}
}
}

View File

@@ -17,15 +17,20 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\mods\ra\</OutputPath>
<OutputPath>..\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CustomCommands>
<CustomCommands>
<Command type="AfterBuild" command="cp ../OpenRA.Mods.RA.dll ../mods/ra" workingdir="${ProjectDir}" />
</CustomCommands>
</CustomCommands>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\mods\ra\</OutputPath>
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -212,6 +217,9 @@
<Compile Include="EngineerRepair.cs" />
<Compile Include="Activities\RepairBuilding.cs" />
<Compile Include="BuildingCaptureNotification.cs" />
<Compile Include="ChronoshiftDeploy.cs" />
<Compile Include="DemoTruck.cs" />
<Compile Include="Orders\SetChronoTankDestination.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
@@ -240,6 +248,5 @@ ralint ra</PostBuildEvent>
<ItemGroup>
<Folder Include="Widgets\" />
<Folder Include="Widgets\Delegates\" />
<Folder Include="Chrome\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,53 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System.Collections.Generic;
using System.Drawing;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Orders
{
class SetChronoTankDestination : IOrderGenerator
{
public readonly Actor self;
public SetChronoTankDestination(Actor self)
{
this.self = self;
}
public IEnumerable<Order> Order(World world, int2 xy, MouseInput mi)
{
if (mi.Button == MouseButton.Left)
{
Game.controller.CancelInputMode();
yield break;
}
if (world.LocalPlayer.Shroud.IsExplored(xy))
yield return new Order("ChronoshiftSelf", self, xy);
}
public void Tick( World world ) { }
public void Render( World world )
{
world.WorldRenderer.DrawSelectionBox(self, Color.White, true);
}
public string GetCursor(World world, int2 xy, MouseInput mi)
{
if (!world.LocalPlayer.Shroud.IsExplored(xy))
return "move-blocked";
var movement = self.traits.GetOrDefault<IMove>();
return (movement.CanEnterCell(xy)) ? "chrono-target" : "move-blocked";
}
}
}