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