Appears to fix sticky locking of preplaced buildings
This commit is contained in:
@@ -101,13 +101,13 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Building : INotifyDamage, IOccupySpace, INotifyCapture, ITick, INotifySold, INotifyTransform, ISync, ITechTreePrerequisite, INotifyAddedToWorld, INotifyRemovedFromWorld
|
public class Building : INotifyDamage, IOccupySpace, INotifyCapture, INotifySold, INotifyTransform, ISync, ITechTreePrerequisite, INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||||
{
|
{
|
||||||
public readonly BuildingInfo Info;
|
public readonly BuildingInfo Info;
|
||||||
public bool BuildComplete { get; private set; }
|
public bool BuildComplete { get; private set; }
|
||||||
[Sync] readonly CPos topLeft;
|
[Sync] readonly CPos topLeft;
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly bool skipMakeAnimation;
|
public readonly bool UseMakeAnimation;
|
||||||
|
|
||||||
PowerManager PlayerPower;
|
PowerManager PlayerPower;
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
.Select(c => Pair.New(c, SubCell.FullCell)).ToArray();
|
.Select(c => Pair.New(c, SubCell.FullCell)).ToArray();
|
||||||
|
|
||||||
CenterPosition = init.world.Map.CenterOfCell(topLeft) + FootprintUtils.CenterOffset(init.world, Info);
|
CenterPosition = init.world.Map.CenterOfCell(topLeft) + FootprintUtils.CenterOffset(init.world, Info);
|
||||||
skipMakeAnimation = init.Contains<SkipMakeAnimsInit>();
|
UseMakeAnimation = !init.Contains<SkipMakeAnimsInit>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetPowerUsage()
|
public int GetPowerUsage()
|
||||||
@@ -168,6 +168,12 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
PlayerPower = newOwner.PlayerActor.Trait<PowerManager>();
|
PlayerPower = newOwner.PlayerActor.Trait<PowerManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Created(Actor self)
|
||||||
|
{
|
||||||
|
if (!UseMakeAnimation)
|
||||||
|
NotifyBuildingComplete(self);
|
||||||
|
}
|
||||||
|
|
||||||
public void AddedToWorld(Actor self)
|
public void AddedToWorld(Actor self)
|
||||||
{
|
{
|
||||||
self.World.ActorMap.AddInfluence(self, this);
|
self.World.ActorMap.AddInfluence(self, this);
|
||||||
@@ -182,12 +188,6 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
self.World.ScreenMap.Remove(self);
|
self.World.ScreenMap.Remove(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
|
||||||
{
|
|
||||||
if (!BuildComplete && (skipMakeAnimation || !self.HasTrait<WithMakeAnimation>()))
|
|
||||||
NotifyBuildingComplete(self);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void NotifyBuildingComplete(Actor self)
|
public void NotifyBuildingComplete(Actor self)
|
||||||
{
|
{
|
||||||
if (BuildComplete)
|
if (BuildComplete)
|
||||||
|
|||||||
@@ -38,15 +38,13 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
renderBuilding = self.Trait<RenderBuilding>();
|
renderBuilding = self.Trait<RenderBuilding>();
|
||||||
|
|
||||||
var building = self.Trait<Building>();
|
var building = self.Trait<Building>();
|
||||||
if (!init.Contains<SkipMakeAnimsInit>())
|
if (building.UseMakeAnimation)
|
||||||
{
|
{
|
||||||
renderBuilding.PlayCustomAnimThen(self, info.Sequence, () =>
|
renderBuilding.PlayCustomAnimThen(self, info.Sequence, () =>
|
||||||
{
|
{
|
||||||
building.NotifyBuildingComplete(self);
|
building.NotifyBuildingComplete(self);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
|
||||||
building.NotifyBuildingComplete(self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reverse(Actor self, Activity activity)
|
public void Reverse(Actor self, Activity activity)
|
||||||
|
|||||||
Reference in New Issue
Block a user