Added buildradius checkbox to lobby options

This commit is contained in:
kosti1
2017-10-18 11:14:02 +03:00
committed by abcdefg30
parent b8326bfead
commit 6a750d7a65
7 changed files with 153 additions and 7 deletions

View File

@@ -32,12 +32,13 @@ namespace OpenRA.Mods.Common.Traits
public readonly BaseProviderInfo Info;
readonly DeveloperMode devMode;
readonly Actor self;
readonly bool allyBuildEnabled;
readonly bool buildRadiusEnabled;
Building building;
int total;
int progress;
bool allyBuildEnabled;
public BaseProvider(Actor self, BaseProviderInfo info)
{
@@ -45,7 +46,9 @@ namespace OpenRA.Mods.Common.Traits
this.self = self;
devMode = self.Owner.PlayerActor.Trait<DeveloperMode>();
progress = total = info.InitialDelay;
allyBuildEnabled = self.World.WorldActor.Trait<MapBuildRadius>().AllyBuildRadiusEnabled;
var mapBuildRadius = self.World.WorldActor.Trait<MapBuildRadius>();
allyBuildEnabled = mapBuildRadius.AllyBuildRadiusEnabled;
buildRadiusEnabled = mapBuildRadius.BuildRadiusEnabled;
}
void INotifyCreated.Created(Actor self)
@@ -74,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
bool ValidRenderPlayer()
{
return self.Owner == self.World.RenderPlayer || (allyBuildEnabled && self.Owner.IsAlliedWith(self.World.RenderPlayer));
return buildRadiusEnabled && (self.Owner == self.World.RenderPlayer || (allyBuildEnabled && self.Owner.IsAlliedWith(self.World.RenderPlayer)));
}
public IEnumerable<IRenderable> RangeCircleRenderables(WorldRenderer wr)