missing pieces of selling
This commit is contained in:
@@ -183,6 +183,7 @@ namespace OpenRa.Game
|
|||||||
case "Harvest": return Cursor.Attack; // TODO: special harvest cursor?
|
case "Harvest": return Cursor.Attack; // TODO: special harvest cursor?
|
||||||
case "PlaceBuilding": return Cursor.Default;
|
case "PlaceBuilding": return Cursor.Default;
|
||||||
case "Sell": return Cursor.Sell;
|
case "Sell": return Cursor.Sell;
|
||||||
|
case "NoSell": return Cursor.SellBlocked;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,5 +27,6 @@ namespace OpenRa.Game
|
|||||||
public static Cursor Capture { get { return new Cursor("capture"); } }
|
public static Cursor Capture { get { return new Cursor("capture"); } }
|
||||||
public static Cursor Heal { get { return new Cursor("heal"); } }
|
public static Cursor Heal { get { return new Cursor("heal"); } }
|
||||||
public static Cursor Sell { get { return new Cursor("sell"); } }
|
public static Cursor Sell { get { return new Cursor("sell"); } }
|
||||||
|
public static Cursor SellBlocked { get { return new Cursor("sell-blocked"); } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,18 +11,25 @@ namespace OpenRa.Game.Orders
|
|||||||
{
|
{
|
||||||
public IEnumerable<Order> Order(int2 xy, MouseInput mi)
|
public IEnumerable<Order> Order(int2 xy, MouseInput mi)
|
||||||
{
|
{
|
||||||
|
if (!mi.IsFake && mi.Button == MouseButton.Right)
|
||||||
|
{
|
||||||
|
Game.controller.CancelInputMode();
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
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.Owner == Game.LocalPlayer
|
.Where(a => a.Owner == Game.LocalPlayer
|
||||||
&& a.traits.Contains<Building>()
|
&& a.traits.Contains<Building>()
|
||||||
&& a.Info.Selectable).FirstOrDefault();
|
&& a.Info.Selectable).FirstOrDefault();
|
||||||
|
|
||||||
if (underCursor == null)
|
var building = underCursor != null ? underCursor.Info as BuildingInfo : null;
|
||||||
yield break;
|
|
||||||
|
|
||||||
var building = underCursor.traits.Get<Building>();
|
if (building == null || building.Unsellable)
|
||||||
if (building.unitInfo.Unsellable)
|
{
|
||||||
|
yield return new Order("NoSell", Game.LocalPlayer.PlayerActor, null, int2.Zero, null);
|
||||||
yield break;
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
yield return new Order("Sell", underCursor, null, int2.Zero, null);
|
yield return new Order("Sell", underCursor, null, int2.Zero, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,14 +372,14 @@
|
|||||||
<sequence name="move-minimap" start="29" length="6" />
|
<sequence name="move-minimap" start="29" length="6" />
|
||||||
<sequence name="repair" start="35" length="24" />
|
<sequence name="repair" start="35" length="24" />
|
||||||
<sequence name="deploy" start="59" length="9" x="12" y="12" />
|
<sequence name="deploy" start="59" length="9" x="12" y="12" />
|
||||||
<sequence name="sell" start="68" length="12" />
|
<sequence name="sell" start="68" length="12" x="12" y="12"/>
|
||||||
<sequence name="default-minimap" start="80" length="1" />
|
<sequence name="default-minimap" start="80" length="1" />
|
||||||
<sequence name="ability" start="82" length="8" />
|
<sequence name="ability" start="82" length="8" />
|
||||||
<sequence name="nuke" start="90" length="7" x="12" y="12" />
|
<sequence name="nuke" start="90" length="7" x="12" y="12" />
|
||||||
<sequence name="chrono" start="105" length="8" x="12" y="12" />
|
<sequence name="chrono" start="105" length="8" x="12" y="12" />
|
||||||
<sequence name="enter" start="113" length="3" x="12" y="12" />
|
<sequence name="enter" start="113" length="3" x="12" y="12" />
|
||||||
<sequence name="c4" start="116" length="3" x="12" y="12" />
|
<sequence name="c4" start="116" length="3" x="12" y="12" />
|
||||||
<sequence name="sell-blocked" start="119" length="1" />
|
<sequence name="sell-blocked" start="119" length="1" x="12" y="12" />
|
||||||
<sequence name="repair-blocked" start="120" length="1" />
|
<sequence name="repair-blocked" start="120" length="1" />
|
||||||
<sequence name="c4-minimap" start="121" length="3" />
|
<sequence name="c4-minimap" start="121" length="3" />
|
||||||
<sequence name="scroll-blocked" start="124" length="8" />
|
<sequence name="scroll-blocked" start="124" length="8" />
|
||||||
|
|||||||
Reference in New Issue
Block a user