Add BuildComplete property to Building and start initially locked.
This commit is contained in:
@@ -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 readonly BuildingInfo Info;
|
||||||
|
public bool BuildComplete { get; private set; }
|
||||||
[Sync] readonly CPos topLeft;
|
[Sync] readonly CPos topLeft;
|
||||||
|
readonly Actor self;
|
||||||
|
|
||||||
PowerManager PlayerPower;
|
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()
|
public bool Lock()
|
||||||
{
|
{
|
||||||
if (Locked) return false;
|
if (Locked)
|
||||||
|
return false;
|
||||||
|
|
||||||
Locked = true;
|
Locked = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -133,6 +137,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
.Select(c => Pair.New(c, SubCell.FullCell)).ToArray();
|
.Select(c => Pair.New(c, SubCell.FullCell)).ToArray();
|
||||||
|
|
||||||
CenterPosition = topLeft.CenterPosition + FootprintUtils.CenterOffset(Info);
|
CenterPosition = topLeft.CenterPosition + FootprintUtils.CenterOffset(Info);
|
||||||
|
BuildComplete = init.Contains<SkipMakeAnimsInit>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetPowerUsage()
|
public int GetPowerUsage()
|
||||||
@@ -172,5 +177,14 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
self.World.ActorMap.RemovePosition(self, this);
|
self.World.ActorMap.RemovePosition(self, this);
|
||||||
self.World.ScreenMap.Remove(self);
|
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) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user