fixed some dumb bugs; more porting
This commit is contained in:
@@ -97,7 +97,7 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
public void GoToStartLocation()
|
||||
{
|
||||
Center(Game.world.Actors.Where(a => a.LegacyInfo != null && a.Owner == Game.LocalPlayer));
|
||||
Center(Game.world.Actors.Where(a => a.Info != null && a.Owner == Game.LocalPlayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,9 @@ namespace OpenRa.Game
|
||||
|
||||
public void Explore(Actor a)
|
||||
{
|
||||
foreach (var t in Game.FindTilesInCircle((1f / Game.CellSize * a.CenterLocation).ToInt2(), a.Info.Traits.Get<OwnedActorInfo>().Sight))
|
||||
foreach (var t in Game.FindTilesInCircle(
|
||||
(1f / Game.CellSize * a.CenterLocation).ToInt2(),
|
||||
a.Info.Traits.WithInterface<OwnedActorInfo>().First().Sight))
|
||||
explored[t.X, t.Y] = true;
|
||||
|
||||
dirty = true;
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace OpenRa.Game.Traits
|
||||
{
|
||||
class ProductionInfo : ITraitInfo
|
||||
{
|
||||
public readonly int[] SpawnOffset = null;
|
||||
|
||||
public object Create(Actor self) { return new Production(self); }
|
||||
}
|
||||
|
||||
@@ -23,7 +25,7 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
public virtual int CreationFacing( Actor self, Actor newUnit )
|
||||
{
|
||||
return newUnit.LegacyInfo.InitialFacing;
|
||||
return newUnit.Info.Traits.WithInterface<OwnedActorInfo>().FirstOrDefault().InitialFacing;
|
||||
}
|
||||
|
||||
public bool Produce( Actor self, LegacyUnitInfo producee )
|
||||
@@ -43,10 +45,10 @@ namespace OpenRa.Game.Traits
|
||||
newUnit.QueueActivity( new Activities.Move( rp.rallyPoint, 1 ) );
|
||||
}
|
||||
|
||||
var bi = self.LegacyInfo as LegacyBuildingInfo;
|
||||
if (bi != null && bi.SpawnOffset != null)
|
||||
var pi = self.Info.Traits.Get<ProductionInfo>();
|
||||
if (pi != null && pi.SpawnOffset != null)
|
||||
newUnit.CenterLocation = self.CenterLocation
|
||||
+ new float2(bi.SpawnOffset[0], bi.SpawnOffset[1]);
|
||||
+ new float2(pi.SpawnOffset[0], pi.SpawnOffset[1]);
|
||||
|
||||
Game.world.Add( newUnit );
|
||||
|
||||
|
||||
@@ -17,13 +17,14 @@ namespace OpenRa.Game.Traits
|
||||
{
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var attack = self.traits.WithInterface<AttackBase>().First();
|
||||
var attackInfo = self.Info.Traits.WithInterface<AttackBaseInfo>().First();
|
||||
|
||||
var muzzleFlash = new Animation(self.LegacyInfo.Name);
|
||||
var muzzleFlash = new Animation(GetImage(self));
|
||||
muzzleFlash.PlayFetchIndex("muzzle",
|
||||
() => (Util.QuantizeFacing(unit.Facing, 8)) * 6 + (int)(attack.primaryRecoil * 5.9f));
|
||||
anims.Add( "muzzle", new AnimationWithOffset(
|
||||
muzzleFlash,
|
||||
() => self.LegacyInfo.PrimaryOffset.AbsOffset(),
|
||||
() => attackInfo.PrimaryOffset.AbsOffset(),
|
||||
() => attack.primaryRecoil <= 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user