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:
reaperrr
2019-06-06 01:50:08 +02:00
committed by Paul Chote
parent 788e73db64
commit 97084effac

View File

@@ -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();