renamed Info to LegacyInfo, marked Obsolete. added NewUnitInfo ref as Info.
This commit is contained in:
@@ -19,7 +19,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
|
||||
if (target.Owner == self.Owner)
|
||||
{
|
||||
if (target.Health == target.Info.Strength)
|
||||
if (target.Health == target.LegacyInfo.Strength)
|
||||
return NextActivity;
|
||||
target.InflictDamage(self, -EngineerCapture.EngineerDamage, Rules.WarheadInfo["Super"]);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
|
||||
var desiredFacing = Util.GetFacing(d, unit.Facing);
|
||||
if (unit.Altitude == CruiseAltitude)
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.ROT);
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.LegacyInfo.ROT);
|
||||
var speed = .2f * Util.GetEffectiveSpeed(self);
|
||||
var angle = unit.Facing / 128f * Math.PI;
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ namespace OpenRa.Game.Traits.Activities
|
||||
return this;
|
||||
}
|
||||
|
||||
var range = Rules.WeaponInfo[ self.Info.Primary ].Range - 1;
|
||||
var range = Rules.WeaponInfo[ self.LegacyInfo.Primary ].Range - 1;
|
||||
var dist = target.CenterLocation - self.CenterLocation;
|
||||
|
||||
var desiredFacing = Util.GetFacing(dist, unit.Facing);
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.ROT);
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.LegacyInfo.ROT);
|
||||
|
||||
if (!float2.WithinEpsilon(float2.Zero, dist, range * Game.CellSize))
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
}
|
||||
|
||||
var desiredFacing = Util.GetFacing(dist, unit.Facing);
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.ROT);
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.LegacyInfo.ROT);
|
||||
|
||||
var rawSpeed = .2f * Util.GetEffectiveSpeed(self);
|
||||
self.CenterLocation += (rawSpeed / dist.Length) * dist;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
static Actor ChooseHelipad(Actor self)
|
||||
{
|
||||
return Game.world.Actors.FirstOrDefault(
|
||||
a => a.Info == Rules.UnitInfo["HPAD"] &&
|
||||
a => a.LegacyInfo == Rules.UnitInfo["HPAD"] &&
|
||||
a.Owner == self.Owner &&
|
||||
!Reservable.IsReserved(a));
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
|
||||
if (dest == null)
|
||||
return Util.SequenceActivities(
|
||||
new Turn(self.Info.InitialFacing),
|
||||
new Turn(self.LegacyInfo.InitialFacing),
|
||||
new HeliLand(true),
|
||||
NextActivity);
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace OpenRa.Game.Traits.Activities
|
||||
if (res != null)
|
||||
self.traits.Get<Helicopter>().reservation = res.Reserve(self);
|
||||
|
||||
var offset = (dest.Info as LegacyBuildingInfo).SpawnOffset;
|
||||
var offset = (dest.LegacyInfo as LegacyBuildingInfo).SpawnOffset;
|
||||
var offsetVec = offset != null ? new float2(offset[0], offset[1]) : float2.Zero;
|
||||
|
||||
return Util.SequenceActivities(
|
||||
new HeliFly(dest.CenterLocation + offsetVec),
|
||||
new Turn(self.Info.InitialFacing),
|
||||
new Turn(self.LegacyInfo.InitialFacing),
|
||||
new HeliLand(false),
|
||||
new Rearm(),
|
||||
NextActivity);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
--unit.Altitude;
|
||||
|
||||
var desiredFacing = Util.GetFacing(d, unit.Facing);
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.ROT);
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.LegacyInfo.ROT);
|
||||
var speed = .2f * Util.GetEffectiveSpeed(self);
|
||||
var angle = unit.Facing / 128f * Math.PI;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace OpenRa.Game.Traits.Activities
|
||||
if (isCanceled) return NextActivity;
|
||||
if (remainingTicks == 0)
|
||||
{
|
||||
var costPerHp = (Rules.General.URepairPercent * self.Info.Cost) / self.Info.Strength;
|
||||
var hpToRepair = Math.Min(Rules.General.URepairStep, self.Info.Strength - self.Health);
|
||||
var costPerHp = (Rules.General.URepairPercent * self.LegacyInfo.Cost) / self.LegacyInfo.Strength;
|
||||
var hpToRepair = Math.Min(Rules.General.URepairStep, self.LegacyInfo.Strength - self.Health);
|
||||
var cost = (int)Math.Ceiling(costPerHp * hpToRepair);
|
||||
if (!self.Owner.TakeCash(cost))
|
||||
{
|
||||
@@ -26,7 +26,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
}
|
||||
|
||||
self.InflictDamage(self, -hpToRepair, Rules.WarheadInfo["Super"]);
|
||||
if (self.Health == self.Info.Strength)
|
||||
if (self.Health == self.LegacyInfo.Strength)
|
||||
return NextActivity;
|
||||
|
||||
var hostBuilding = Game.FindUnits(self.CenterLocation, self.CenterLocation)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
Actor ChooseAirfield(Actor self)
|
||||
{
|
||||
var airfield = Game.world.Actors
|
||||
.Where(a => a.Info == Rules.UnitInfo["AFLD"] /* todo: generalize this */
|
||||
.Where(a => a.LegacyInfo == Rules.UnitInfo["AFLD"] /* todo: generalize this */
|
||||
&& a.Owner == self.Owner
|
||||
&& !Reservable.IsReserved(a))
|
||||
.FirstOrDefault();
|
||||
@@ -41,7 +41,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var speed = .2f * Util.GetEffectiveSpeed(self);
|
||||
var approachStart = landPos - new float2(unit.Altitude * speed, 0);
|
||||
var turnRadius = (128f / self.Info.ROT) * speed / (float)Math.PI;
|
||||
var turnRadius = (128f / self.LegacyInfo.ROT) * speed / (float)Math.PI;
|
||||
|
||||
/* work out the center points */
|
||||
var fwd = -float2.FromAngle(unit.Facing / 128f * (float)Math.PI);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
void DoSell(Actor self)
|
||||
{
|
||||
var refund = Rules.General.RefundPercent
|
||||
* self.Health * self.Info.Cost / self.Info.Strength;
|
||||
* self.Health * self.LegacyInfo.Cost / self.LegacyInfo.Strength;
|
||||
|
||||
self.Owner.GiveCash((int)refund);
|
||||
self.Health = 0;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
if( desiredFacing == unit.Facing )
|
||||
return NextActivity;
|
||||
|
||||
Util.TickFacing( ref unit.Facing, desiredFacing, self.Info.ROT );
|
||||
Util.TickFacing( ref unit.Facing, desiredFacing, self.LegacyInfo.ROT );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ namespace OpenRa.Game.Traits.Activities
|
||||
// if we're a thing that can turn, turn to the
|
||||
// right facing for the unload animation
|
||||
var unit = self.traits.GetOrDefault<Unit>();
|
||||
if (unit != null && unit.Facing != self.Info.UnloadFacing)
|
||||
return new Turn(self.Info.UnloadFacing) { NextActivity = this };
|
||||
if (unit != null && unit.Facing != self.LegacyInfo.UnloadFacing)
|
||||
return new Turn(self.LegacyInfo.UnloadFacing) { NextActivity = this };
|
||||
|
||||
// todo: handle the BS of open/close sequences, which are inconsistent,
|
||||
// for reasons that probably make good sense to the westwood guys.
|
||||
|
||||
Reference in New Issue
Block a user