diff --git a/OpenRA.Mods.RA/Buildings/Building.cs b/OpenRA.Mods.RA/Buildings/Building.cs index 5ead5ea237..23ee8e5304 100755 --- a/OpenRA.Mods.RA/Buildings/Building.cs +++ b/OpenRA.Mods.RA/Buildings/Building.cs @@ -98,19 +98,23 @@ namespace OpenRA.Mods.RA.Buildings } } - public class Building : INotifyDamage, IOccupySpace, INotifyCapture, ISync, ITechTreePrerequisite, INotifyAddedToWorld, INotifyRemovedFromWorld + public class Building : INotifyDamage, IOccupySpace, INotifyCapture, INotifyBuildComplete, INotifySold, ISync, ITechTreePrerequisite, INotifyAddedToWorld, INotifyRemovedFromWorld { - readonly Actor self; public readonly BuildingInfo Info; + public bool BuildComplete { get; private set; } [Sync] readonly CPos topLeft; + readonly Actor self; PowerManager PlayerPower; - [Sync] public bool Locked; /* shared activity lock: undeploy, sell, capture, etc */ + /* shared activity lock: undeploy, sell, capture, etc */ + [Sync] public bool Locked = true; public bool Lock() { - if (Locked) return false; + if (Locked) + return false; + Locked = true; return true; } @@ -133,6 +137,7 @@ namespace OpenRA.Mods.RA.Buildings .Select(c => Pair.New(c, SubCell.FullCell)).ToArray(); CenterPosition = topLeft.CenterPosition + FootprintUtils.CenterOffset(Info); + BuildComplete = init.Contains(); } public int GetPowerUsage() @@ -172,5 +177,14 @@ namespace OpenRA.Mods.RA.Buildings self.World.ActorMap.RemovePosition(self, this); self.World.ScreenMap.Remove(self); } + + public void BuildingComplete(Actor self) + { + BuildComplete = true; + Locked = false; + } + + public void Selling(Actor self) { BuildComplete = false; } + public void Sold(Actor self) { } } }