more
This commit is contained in:
@@ -339,7 +339,7 @@ namespace OpenRa.Game
|
||||
heuristic = loc =>
|
||||
{
|
||||
var b = Game.BuildingInfluence.GetBuildingAt(loc);
|
||||
if (b != null && b.Owner == p && (b.LegacyInfo as LegacyBuildingInfo).BaseNormal) return 0;
|
||||
if (b != null && b.Owner == p && b.Info.Traits.Get<BuildingInfo>().BaseNormal) return 0;
|
||||
if ((loc - position).Length > maxDistance)
|
||||
return float.PositiveInfinity; /* not quite right */
|
||||
return 1;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using IjwFramework.Collections;
|
||||
using OpenRa.Game.Traits;
|
||||
|
||||
namespace OpenRa.Game.GameRules
|
||||
{
|
||||
@@ -21,8 +22,8 @@ namespace OpenRa.Game.GameRules
|
||||
public Cache<string, List<Actor>> GatherBuildings( Player player )
|
||||
{
|
||||
var ret = new Cache<string, List<Actor>>( x => new List<Actor>() );
|
||||
foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.LegacyInfo is LegacyBuildingInfo ) )
|
||||
ret[ b.LegacyInfo.Name ].Add( b );
|
||||
foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.Info != null && x.Info.Traits.Contains<BuildingInfo>() ) )
|
||||
ret[ b.Info.Name ].Add( b );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRa.Game.Orders
|
||||
var underCursor = Game.FindUnits(loc, loc)
|
||||
.Where(a => a.Owner == Game.LocalPlayer
|
||||
&& a.traits.Contains<Building>()
|
||||
&& a.LegacyInfo.Selectable).FirstOrDefault();
|
||||
&& a.traits.Contains<Selectable>()).FirstOrDefault();
|
||||
|
||||
var building = underCursor != null ? underCursor.LegacyInfo as LegacyBuildingInfo : null;
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace OpenRa.Game.Orders
|
||||
var underCursor = Game.FindUnits(loc, loc)
|
||||
.Where(a => a.Owner == Game.LocalPlayer
|
||||
&& a.traits.Contains<Building>()
|
||||
&& a.LegacyInfo.Selectable).FirstOrDefault();
|
||||
&& a.traits.Contains<Selectable>()).FirstOrDefault();
|
||||
|
||||
var building = underCursor != null ? underCursor.LegacyInfo as LegacyBuildingInfo : null;
|
||||
var building = underCursor != null ? underCursor.Info.Traits.Get<BuildingInfo>() : null;
|
||||
|
||||
if (building != null && building.Repairable && underCursor.Health < building.Strength)
|
||||
if (building != null && building.Repairable && underCursor.Health < building.HP)
|
||||
yield return new Order("Repair", underCursor, null, int2.Zero, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace OpenRa.Game.Orders
|
||||
var underCursor = Game.FindUnits(loc, loc)
|
||||
.Where(a => a.Owner == Game.LocalPlayer
|
||||
&& a.traits.Contains<Building>()
|
||||
&& a.LegacyInfo.Selectable).FirstOrDefault();
|
||||
&& a.traits.Contains<Selectable>()).FirstOrDefault();
|
||||
|
||||
var building = underCursor != null ? underCursor.LegacyInfo as LegacyBuildingInfo : null;
|
||||
var building = underCursor != null ? underCursor.Info.Traits.Get<BuildingInfo>() : null;
|
||||
|
||||
if (building != null && !building.Unsellable)
|
||||
yield return new Order("Sell", underCursor, null, int2.Zero, null);
|
||||
|
||||
@@ -24,9 +24,11 @@ namespace OpenRa.Game.Traits.Activities
|
||||
if (isCanceled) return NextActivity;
|
||||
var dest = ChooseHelipad(self);
|
||||
|
||||
var initialFacing = self.Info.Traits.WithInterface<OwnedActorInfo>().First().InitialFacing;
|
||||
|
||||
if (dest == null)
|
||||
return Util.SequenceActivities(
|
||||
new Turn(self.LegacyInfo.InitialFacing),
|
||||
new Turn(initialFacing),
|
||||
new HeliLand(true),
|
||||
NextActivity);
|
||||
|
||||
@@ -34,12 +36,13 @@ namespace OpenRa.Game.Traits.Activities
|
||||
if (res != null)
|
||||
self.traits.Get<Helicopter>().reservation = res.Reserve(self);
|
||||
|
||||
var offset = (dest.LegacyInfo as LegacyBuildingInfo).SpawnOffset;
|
||||
var pi = dest.Info.Traits.GetOrDefault<ProductionInfo>();
|
||||
var offset = pi != null ? pi.SpawnOffset : null;
|
||||
var offsetVec = offset != null ? new float2(offset[0], offset[1]) : float2.Zero;
|
||||
|
||||
return Util.SequenceActivities(
|
||||
new HeliFly(dest.CenterLocation + offsetVec),
|
||||
new Turn(self.LegacyInfo.InitialFacing),
|
||||
new Turn(initialFacing),
|
||||
new HeliLand(false),
|
||||
new Rearm(),
|
||||
NextActivity);
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace OpenRa.Game.Traits
|
||||
public readonly string[] Produces = { }; // does this go somewhere else?
|
||||
public readonly int2 Dimensions = new int2(1, 1);
|
||||
public readonly bool WaterBound = false;
|
||||
public readonly bool Unsellable = false;
|
||||
|
||||
public object Create(Actor self) { return new Building(self); }
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRa.Game.Traits
|
||||
if (mi.Button != MouseButton.Right) return null;
|
||||
if (underCursor == null) return null;
|
||||
|
||||
if (underCursor.LegacyInfo == Rules.UnitInfo["FIX"]
|
||||
if (underCursor.Info.Name == "fix"
|
||||
&& underCursor.Owner == self.Owner
|
||||
&& !Reservable.IsReserved(underCursor))
|
||||
return new Order("Enter", self, underCursor, int2.Zero, null);
|
||||
|
||||
@@ -116,7 +116,8 @@ namespace RulesConverter
|
||||
{ "Crewed", "Crewed" },
|
||||
{ "WaterBound", "WaterBound" },
|
||||
{ "InitialFacing", "InitialFacing" },
|
||||
{ "Sight", "Sight" } }
|
||||
{ "Sight", "Sight" },
|
||||
{ "Unsellable", "Unsellable" } }
|
||||
},
|
||||
|
||||
{ "StoresOre", new PL {
|
||||
|
||||
Reference in New Issue
Block a user