hacked in selling to F3
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using OpenRa.FileFormats;
|
||||
using OpenRa.Game.Graphics;
|
||||
using OpenRa.Game.Orders;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
@@ -132,6 +133,8 @@ namespace OpenRa.Game
|
||||
/* temporary hack: DO NOT LEAVE IN */
|
||||
if (e.KeyCode == Keys.F2)
|
||||
Game.LocalPlayer = Game.players[(Game.LocalPlayer.Index + 1) % 4];
|
||||
if (e.KeyCode == Keys.F3)
|
||||
Game.controller.orderGenerator = new SellOrderGenerator();
|
||||
|
||||
if (!Game.chat.isChatting)
|
||||
if (e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)
|
||||
|
||||
@@ -13,10 +13,9 @@ namespace OpenRa.Game.Orders
|
||||
{
|
||||
var loc = mi.Location + Game.viewport.Location;
|
||||
var underCursor = Game.FindUnits(loc, loc)
|
||||
.Where( a => a.traits.Contains<Building>() ).FirstOrDefault();
|
||||
|
||||
if (underCursor != null && !underCursor.Info.Selectable)
|
||||
underCursor = null;
|
||||
.Where(a => a.Owner == Game.LocalPlayer
|
||||
&& a.traits.Contains<Building>()
|
||||
&& a.Info.Selectable).FirstOrDefault();
|
||||
|
||||
if (underCursor == null)
|
||||
yield break;
|
||||
@@ -25,9 +24,6 @@ namespace OpenRa.Game.Orders
|
||||
if (building.unitInfo.Unsellable)
|
||||
yield break;
|
||||
|
||||
if (underCursor.Owner != Game.LocalPlayer)
|
||||
yield break;
|
||||
|
||||
yield return new Order("Sell", underCursor, null, int2.Zero, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,11 @@ namespace OpenRa.Game.Traits.Activities
|
||||
|
||||
self.Owner.GiveCash((int)refund);
|
||||
self.Health = 0;
|
||||
foreach (var ns in self.traits.WithInterface<INotifySold>())
|
||||
ns.Sold(self);
|
||||
Game.world.Remove(self);
|
||||
|
||||
// todo: give dudes
|
||||
}
|
||||
|
||||
public IActivity Tick(Actor self)
|
||||
|
||||
@@ -5,7 +5,7 @@ using OpenRa.Game.Effects;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class RenderBuilding : RenderSimple, INotifyDamage
|
||||
class RenderBuilding : RenderSimple, INotifyDamage, INotifySold
|
||||
{
|
||||
const int SmallBibStart = 1;
|
||||
const int LargeBibStart = 5;
|
||||
@@ -88,5 +88,7 @@ namespace OpenRa.Game.Traits
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Sold(Actor self) { DoBib(self, true); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
interface ITick { void Tick(Actor self); }
|
||||
interface IRender { IEnumerable<Renderable> Render(Actor self); }
|
||||
interface INotifySold { void Sold(Actor self); }
|
||||
interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||
interface INotifyBuildComplete { void BuildingComplete (Actor self); }
|
||||
interface INotifyProduction { void UnitProduced(Actor self, Actor other); }
|
||||
|
||||
Reference in New Issue
Block a user