Add BuildComplete property to Building and start initially locked.

This commit is contained in:
Paul Chote
2014-03-17 12:23:49 +13:00
parent 0ca7ee280f
commit 96cc1276c2

View File

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