Add "Build off Ally ConYards" option. Fixes #2464.
This commit is contained in:
@@ -27,6 +27,7 @@ namespace OpenRA
|
|||||||
public bool? Crates;
|
public bool? Crates;
|
||||||
public bool? Fog;
|
public bool? Fog;
|
||||||
public bool? Shroud;
|
public bool? Shroud;
|
||||||
|
public bool? AllyBuildRadius;
|
||||||
public bool? FragileAlliances;
|
public bool? FragileAlliances;
|
||||||
public bool ConfigurableStartingUnits = true;
|
public bool ConfigurableStartingUnits = true;
|
||||||
public string[] Difficulties = { };
|
public string[] Difficulties = { };
|
||||||
@@ -41,6 +42,8 @@ namespace OpenRA
|
|||||||
settings.Fog = Fog.Value;
|
settings.Fog = Fog.Value;
|
||||||
if (Shroud.HasValue)
|
if (Shroud.HasValue)
|
||||||
settings.Shroud = Shroud.Value;
|
settings.Shroud = Shroud.Value;
|
||||||
|
if (AllyBuildRadius.HasValue)
|
||||||
|
settings.AllyBuildRadius = AllyBuildRadius.Value;
|
||||||
if (FragileAlliances.HasValue)
|
if (FragileAlliances.HasValue)
|
||||||
settings.FragileAlliances = FragileAlliances.Value;
|
settings.FragileAlliances = FragileAlliances.Value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ namespace OpenRA.Network
|
|||||||
public bool Crates = true;
|
public bool Crates = true;
|
||||||
public bool Shroud = true;
|
public bool Shroud = true;
|
||||||
public bool Fog = true;
|
public bool Fog = true;
|
||||||
|
public bool AllyBuildRadius = true;
|
||||||
public string StartingUnitsClass = "none";
|
public string StartingUnitsClass = "none";
|
||||||
public bool AllowVersionMismatch;
|
public bool AllowVersionMismatch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,11 +56,17 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
return devMode.FastBuild || progress == 0;
|
return devMode.FastBuild || progress == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ValidRenderPlayer()
|
||||||
|
{
|
||||||
|
var allyBuildRadius = self.World.LobbyInfo.GlobalSettings.AllyBuildRadius;
|
||||||
|
return self.Owner == self.World.RenderPlayer || (allyBuildRadius && self.Owner.IsAlliedWith(self.World.RenderPlayer));
|
||||||
|
}
|
||||||
|
|
||||||
// Range circle
|
// Range circle
|
||||||
public void RenderAfterWorld(WorldRenderer wr)
|
public void RenderAfterWorld(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
// Visible to player and allies
|
// Visible to player and allies
|
||||||
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
if (!ValidRenderPlayer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wr.DrawRangeCircleWithContrast(
|
wr.DrawRangeCircleWithContrast(
|
||||||
@@ -73,7 +79,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
public float GetValue()
|
public float GetValue()
|
||||||
{
|
{
|
||||||
// Visible to player and allies
|
// Visible to player and allies
|
||||||
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
if (!ValidRenderPlayer())
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
// Ready or delay disabled
|
// Ready or delay disabled
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
var center = topLeft.CenterPosition + FootprintUtils.CenterOffset(this);
|
var center = topLeft.CenterPosition + FootprintUtils.CenterOffset(this);
|
||||||
foreach (var bp in world.ActorsWithTrait<BaseProvider>())
|
foreach (var bp in world.ActorsWithTrait<BaseProvider>())
|
||||||
{
|
{
|
||||||
if (bp.Actor.Owner.Stances[p] != Stance.Ally || !bp.Trait.Ready())
|
var validOwner = bp.Actor.Owner == p || (world.LobbyInfo.GlobalSettings.AllyBuildRadius && bp.Actor.Owner.Stances[p] == Stance.Ally);
|
||||||
|
if (!validOwner || !bp.Trait.Ready())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Range is counted from the center of the actor, not from each cell.
|
// Range is counted from the center of the actor, not from each cell.
|
||||||
@@ -72,13 +73,20 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
var nearnessCandidates = new List<CPos>();
|
var nearnessCandidates = new List<CPos>();
|
||||||
|
|
||||||
var bi = world.WorldActor.Trait<BuildingInfluence>();
|
var bi = world.WorldActor.Trait<BuildingInfluence>();
|
||||||
|
var allyBuildRadius = world.LobbyInfo.GlobalSettings.AllyBuildRadius;
|
||||||
|
|
||||||
for (var y = scanStart.Y; y < scanEnd.Y; y++)
|
for (var y = scanStart.Y; y < scanEnd.Y; y++)
|
||||||
|
{
|
||||||
for (var x = scanStart.X; x < scanEnd.X; x++)
|
for (var x = scanStart.X; x < scanEnd.X; x++)
|
||||||
{
|
{
|
||||||
var at = bi.GetBuildingAt(new CPos(x, y));
|
var pos = new CPos(x, y);
|
||||||
if (at != null && at.Owner.Stances[p] == Stance.Ally && at.HasTrait<GivesBuildableArea>())
|
var at = bi.GetBuildingAt(pos);
|
||||||
nearnessCandidates.Add(new CPos(x, y));
|
if (at == null || !at.HasTrait<GivesBuildableArea>())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (at.Owner == p || (allyBuildRadius && at.Owner.Stances[p] == Stance.Ally))
|
||||||
|
nearnessCandidates.Add(pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var buildingTiles = FootprintUtils.Tiles(buildingName, this, topLeft).ToList();
|
var buildingTiles = FootprintUtils.Tiles(buildingName, this, topLeft).ToList();
|
||||||
|
|||||||
@@ -437,6 +437,25 @@ namespace OpenRA.Mods.RA.Server
|
|||||||
server.SyncLobbyInfo();
|
server.SyncLobbyInfo();
|
||||||
return true;
|
return true;
|
||||||
}},
|
}},
|
||||||
|
{ "allybuildradius",
|
||||||
|
s =>
|
||||||
|
{
|
||||||
|
if (!client.IsAdmin)
|
||||||
|
{
|
||||||
|
server.SendOrderTo(conn, "Message", "Only the host can set that option");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (server.Map.Options.AllyBuildRadius.HasValue)
|
||||||
|
{
|
||||||
|
server.SendOrderTo(conn, "Message", "Map has disabled ally build radius configuration");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.AllyBuildRadius);
|
||||||
|
server.SyncLobbyInfo();
|
||||||
|
return true;
|
||||||
|
}},
|
||||||
{ "difficulty",
|
{ "difficulty",
|
||||||
s =>
|
s =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -286,6 +286,15 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
"crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates)));
|
"crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var allybuildradius = optionsBin.GetOrNull<CheckboxWidget>("ALLYBUILDRADIUS_CHECKBOX");
|
||||||
|
if (allybuildradius != null)
|
||||||
|
{
|
||||||
|
allybuildradius.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllyBuildRadius;
|
||||||
|
allybuildradius.IsDisabled = () => Map.Options.AllyBuildRadius.HasValue || configurationDisabled();
|
||||||
|
allybuildradius.OnClick = () => orderManager.IssueOrder(Order.Command(
|
||||||
|
"allybuildradius {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllyBuildRadius)));
|
||||||
|
}
|
||||||
|
|
||||||
var fragileAlliance = optionsBin.GetOrNull<CheckboxWidget>("FRAGILEALLIANCES_CHECKBOX");
|
var fragileAlliance = optionsBin.GetOrNull<CheckboxWidget>("FRAGILEALLIANCES_CHECKBOX");
|
||||||
if (fragileAlliance != null)
|
if (fragileAlliance != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -243,6 +243,12 @@ Background@LOBBY_OPTIONS_BIN:
|
|||||||
Width:230
|
Width:230
|
||||||
Height:20
|
Height:20
|
||||||
Text:Crates Appear
|
Text:Crates Appear
|
||||||
|
Checkbox@ALLYBUILDRADIUS_CHECKBOX:
|
||||||
|
X:280
|
||||||
|
Y:35
|
||||||
|
Width:230
|
||||||
|
Height:20
|
||||||
|
Text:Build off Ally ConYards
|
||||||
Label@STARTINGUNITS_DESC:
|
Label@STARTINGUNITS_DESC:
|
||||||
X:PARENT_RIGHT - WIDTH - 145
|
X:PARENT_RIGHT - WIDTH - 145
|
||||||
Y:72
|
Y:72
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ Options:
|
|||||||
Crates: false
|
Crates: false
|
||||||
Fog: false
|
Fog: false
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ Options:
|
|||||||
Crates: false
|
Crates: false
|
||||||
Fog: false
|
Fog: false
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Options:
|
|||||||
Fog: false
|
Fog: false
|
||||||
Shroud: false
|
Shroud: false
|
||||||
Crates: true
|
Crates: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,12 @@ Background@LOBBY_OPTIONS_BIN:
|
|||||||
Width:230
|
Width:230
|
||||||
Height:20
|
Height:20
|
||||||
Text:Crates Appear
|
Text:Crates Appear
|
||||||
|
Checkbox@ALLYBUILDRADIUS_CHECKBOX:
|
||||||
|
X:310
|
||||||
|
Y:40
|
||||||
|
Width:230
|
||||||
|
Height:20
|
||||||
|
Text:Build off Ally ConYards
|
||||||
Label@STARTINGUNITS_DESC:
|
Label@STARTINGUNITS_DESC:
|
||||||
X:PARENT_RIGHT - WIDTH - 145
|
X:PARENT_RIGHT - WIDTH - 145
|
||||||
Y:87
|
Y:87
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Type: Minigame
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Type: Minigame
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
Difficulties: Easy,Normal,Hard
|
Difficulties: Easy,Normal,Hard
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Type: Minigame
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Type: Campaign
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
Difficulties: Easy, Normal
|
Difficulties: Easy, Normal
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Type: Campaign
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Type: Campaign
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
Difficulties: Easy, Normal, Hard
|
Difficulties: Easy, Normal, Hard
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ Tileset: TEMPERAT
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
Difficulties: Easy,Normal,Hard
|
Difficulties: Easy,Normal,Hard
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Type: Minigame
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Options:
|
|||||||
Fog: false
|
Fog: false
|
||||||
Shroud: false
|
Shroud: false
|
||||||
Crates: true
|
Crates: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Options:
|
|||||||
Fog: false
|
Fog: false
|
||||||
Shroud: false
|
Shroud: false
|
||||||
Crates: true
|
Crates: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Options:
|
|||||||
Fog: false
|
Fog: false
|
||||||
Shroud: false
|
Shroud: false
|
||||||
Crates: true
|
Crates: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Type: Campaign
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Type: Campaign
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Type: Minigame
|
|||||||
Options:
|
Options:
|
||||||
Fog: true
|
Fog: true
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user