Fixing uses of legacyInfo.WaterBound
This commit is contained in:
@@ -68,7 +68,7 @@ namespace OpenRa.Game
|
||||
if (unit != null && unit.Altitude > 0)
|
||||
return projectile.AA;
|
||||
|
||||
if (projectile.UnderWater && !target.LegacyInfo.WaterBound)
|
||||
if (projectile.UnderWater && !target.Info.Traits.Get<OwnedActorInfo>().WaterBound)
|
||||
return false;
|
||||
|
||||
return projectile.AG;
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace OpenRa.Game.Traits
|
||||
public readonly int TechLevel = -1;
|
||||
public readonly string Tab = null;
|
||||
public readonly string[] Prerequisites = { };
|
||||
public readonly string[] BuiltAt = { };
|
||||
public readonly Race[] Owner = { };
|
||||
public readonly int Cost = 0;
|
||||
public readonly string Description = "";
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace OpenRa.Game.Traits
|
||||
public readonly bool Crewed = false; // replace with trait?
|
||||
public readonly int InitialFacing = 128;
|
||||
public readonly int Sight = 0;
|
||||
public readonly bool WaterBound = false;
|
||||
}
|
||||
|
||||
class BuildingInfo : OwnedActorInfo, ITraitInfo
|
||||
@@ -30,7 +31,6 @@ namespace OpenRa.Game.Traits
|
||||
public readonly string Footprint = "x";
|
||||
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); }
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
public Production( Actor self ) { }
|
||||
|
||||
public virtual int2? CreationLocation( Actor self, LegacyUnitInfo producee )
|
||||
public virtual int2? CreationLocation( Actor self, NewUnitInfo producee )
|
||||
{
|
||||
return ( 1 / 24f * self.CenterLocation ).ToInt2();
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace OpenRa.Game.Traits
|
||||
return newUnit.Info.Traits.GetOrDefault<OwnedActorInfo>().InitialFacing;
|
||||
}
|
||||
|
||||
public bool Produce( Actor self, LegacyUnitInfo producee )
|
||||
public bool Produce( Actor self, NewUnitInfo producee )
|
||||
{
|
||||
var location = CreationLocation( self, producee );
|
||||
if( location == null || Game.UnitInfluence.GetUnitsAt( location.Value ).Any() )
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
public void BuildUnit( string name )
|
||||
{
|
||||
var newUnitType = Rules.UnitInfo[ name ];
|
||||
var newUnitType = Rules.NewUnitInfo[ name ];
|
||||
var producerTypes = Rules.TechTree.UnitBuiltAt( newUnitType );
|
||||
Actor producer = null;
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace OpenRa.Game.Traits
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int2? CreationLocation(Actor self, LegacyUnitInfo producee)
|
||||
public override int2? CreationLocation(Actor self, NewUnitInfo producee)
|
||||
{
|
||||
return FindAdjacentTile(self, producee.WaterBound ?
|
||||
return FindAdjacentTile(self, producee.Traits.Get<OwnedActorInfo>().WaterBound ?
|
||||
UnitMovementType.Float : UnitMovementType.Wheel); /* hackety hack */
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
interface IProducer
|
||||
{
|
||||
bool Produce( Actor self, LegacyUnitInfo producee );
|
||||
bool Produce( Actor self, NewUnitInfo producee );
|
||||
void SetPrimaryProducer(Actor self, bool isPrimary);
|
||||
}
|
||||
interface IOccupySpace { IEnumerable<int2> OccupiedCells(); }
|
||||
|
||||
Reference in New Issue
Block a user