move ReserveSpawnBuilding out of Plane.Tick and name it
This commit is contained in:
@@ -120,6 +120,23 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
Info = info;
|
Info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void ReserveSpawnBuilding( Actor self )
|
||||||
|
{
|
||||||
|
if (self.Trait<IMove>().Altitude != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* not spawning in the air, so try to assoc. with our afld. this is a hack. */
|
||||||
|
var afld = self.World.FindUnits(self.CenterLocation, self.CenterLocation)
|
||||||
|
.FirstOrDefault( a => a.HasTrait<Reservable>() );
|
||||||
|
|
||||||
|
if (afld == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var res = afld.Trait<Reservable>();
|
||||||
|
if (res != null)
|
||||||
|
reservation = res.Reserve(afld, self, this);
|
||||||
|
}
|
||||||
|
|
||||||
public int ROT { get { return Info.ROT; } }
|
public int ROT { get { return Info.ROT; } }
|
||||||
|
|
||||||
public int InitialFacing { get { return Info.InitialFacing; } }
|
public int InitialFacing { get { return Info.InitialFacing; } }
|
||||||
|
|||||||
@@ -33,19 +33,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
if (firstTick)
|
if (firstTick)
|
||||||
{
|
{
|
||||||
firstTick = false;
|
firstTick = false;
|
||||||
if (self.Trait<IMove>().Altitude == 0)
|
ReserveSpawnBuilding(self);
|
||||||
{
|
|
||||||
/* not spawning in the air, so try to assoc. with our afld. this is a hack. */
|
|
||||||
var afld = self.World.FindUnits(self.CenterLocation, self.CenterLocation)
|
|
||||||
.FirstOrDefault( a => a.HasTrait<Reservable>() );
|
|
||||||
|
|
||||||
if (afld != null)
|
|
||||||
{
|
|
||||||
var res = afld.Trait<Reservable>();
|
|
||||||
if (res != null)
|
|
||||||
reservation = res.Reserve(afld, self, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user