Improve Aircraft firstTick code
- Remove ReserveSpawnBuilding: Only used in one place, and removing it avoids a double GetActorBelow() look-up. - Remove FallsToEarth check form Aircraft.firstTick: Aircraft triggers UnReserve() on actor disposal, so this work-around should no longer be necessary.
This commit is contained in:
@@ -321,16 +321,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
firstTick = false;
|
||||
|
||||
// TODO: Aircraft husks don't properly unreserve.
|
||||
if (self.Info.HasTraitInfo<FallsToEarthInfo>())
|
||||
return;
|
||||
|
||||
ReserveSpawnBuilding();
|
||||
|
||||
var host = GetActorBelow();
|
||||
if (host == null)
|
||||
return;
|
||||
|
||||
MakeReservation(host);
|
||||
|
||||
if (Info.TakeOffOnCreation)
|
||||
self.QueueActivity(new TakeOff(self));
|
||||
}
|
||||
@@ -478,16 +474,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.FirstOrDefault(a => a.Info.HasTraitInfo<ReservableInfo>());
|
||||
}
|
||||
|
||||
protected void ReserveSpawnBuilding()
|
||||
{
|
||||
// HACK: Not spawning in the air, so try to associate with our spawner.
|
||||
var spawner = GetActorBelow();
|
||||
if (spawner == null)
|
||||
return;
|
||||
|
||||
MakeReservation(spawner);
|
||||
}
|
||||
|
||||
public void MakeReservation(Actor target)
|
||||
{
|
||||
UnReserve();
|
||||
|
||||
Reference in New Issue
Block a user