bring the Diplomacy menu back to life, but
- rename LockTeams to FragileAlliances to avoid confusion - only allow it in Free-For-All, not Team games or Missions - grey out non-functional buttons and disabled checkboxes
This commit is contained in:
@@ -82,7 +82,7 @@ namespace OpenRA.Network
|
|||||||
public string[] Mods = { "ra" }; // mod names
|
public string[] Mods = { "ra" }; // mod names
|
||||||
public int OrderLatency = 3;
|
public int OrderLatency = 3;
|
||||||
public int RandomSeed = 0;
|
public int RandomSeed = 0;
|
||||||
public bool LockTeams = true; // don't allow team changes after game start.
|
public bool FragileAlliances = false; // Allow diplomatic stance changes after game start.
|
||||||
public bool AllowCheats = false;
|
public bool AllowCheats = false;
|
||||||
public bool Dedicated;
|
public bool Dedicated;
|
||||||
public string Difficulty;
|
public string Difficulty;
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace OpenRA.Network
|
|||||||
|
|
||||||
case "SetStance":
|
case "SetStance":
|
||||||
{
|
{
|
||||||
if (Game.orderManager.LobbyInfo.GlobalSettings.LockTeams)
|
if (!Game.orderManager.LobbyInfo.GlobalSettings.FragileAlliances)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var targetPlayer = order.Player.World.Players.FirstOrDefault(p => p.InternalName == order.TargetString);
|
var targetPlayer = order.Player.World.Players.FirstOrDefault(p => p.InternalName == order.TargetString);
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
var textSize = font.Measure(Text);
|
var textSize = font.Measure(Text);
|
||||||
font.DrawText(Text,
|
font.DrawText(Text,
|
||||||
new float2(rect.Left + rect.Height * 1.5f, RenderOrigin.Y - BaseLine + (Bounds.Height - textSize.Y)/2), Color.White);
|
new float2(rect.Left + rect.Height * 1.5f, RenderOrigin.Y - BaseLine + (Bounds.Height - textSize.Y)/2),
|
||||||
|
disabled ? Color.Gray : Color.White);
|
||||||
|
|
||||||
if (IsChecked() || (Depressed && HasPressedState && !disabled))
|
if (IsChecked() || (Depressed && HasPressedState && !disabled))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ namespace OpenRA.Mods.RA.Server
|
|||||||
server.SyncLobbyInfo();
|
server.SyncLobbyInfo();
|
||||||
return true;
|
return true;
|
||||||
}},
|
}},
|
||||||
{ "lockteams",
|
{ "fragilealliance",
|
||||||
s =>
|
s =>
|
||||||
{
|
{
|
||||||
if (!client.IsAdmin)
|
if (!client.IsAdmin)
|
||||||
@@ -301,7 +301,7 @@ namespace OpenRA.Mods.RA.Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.LockTeams);
|
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.FragileAlliances);
|
||||||
server.SyncLobbyInfo();
|
server.SyncLobbyInfo();
|
||||||
return true;
|
return true;
|
||||||
}},
|
}},
|
||||||
|
|||||||
@@ -111,6 +111,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
GetText = () => world.LocalPlayer.Stances[ pp ].ToString(),
|
GetText = () => world.LocalPlayer.Stances[ pp ].ToString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!p.World.LobbyInfo.GlobalSettings.FragileAlliances)
|
||||||
|
myStance.Disabled = true;
|
||||||
|
|
||||||
myStance.OnMouseDown = mi => ShowDropDown(pp, myStance);
|
myStance.OnMouseDown = mi => ShowDropDown(pp, myStance);
|
||||||
|
|
||||||
bg.AddChild(myStance);
|
bg.AddChild(myStance);
|
||||||
@@ -138,7 +141,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
void SetStance(ButtonWidget bw, Player p, Stance ss)
|
void SetStance(ButtonWidget bw, Player p, Stance ss)
|
||||||
{
|
{
|
||||||
if (p.World.LobbyInfo.GlobalSettings.LockTeams)
|
if (!p.World.LobbyInfo.GlobalSettings.FragileAlliances)
|
||||||
return; // team changes are banned
|
return; // team changes are banned
|
||||||
|
|
||||||
// NOTE(jsd): Abuse of the type system here with `CPos`
|
// NOTE(jsd): Abuse of the type system here with `CPos`
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
readonly Action onExit;
|
readonly Action onExit;
|
||||||
readonly OrderManager orderManager;
|
readonly OrderManager orderManager;
|
||||||
|
|
||||||
|
public bool TeamGame;
|
||||||
|
|
||||||
// Listen for connection failures
|
// Listen for connection failures
|
||||||
void ConnectionStateChanged(OrderManager om)
|
void ConnectionStateChanged(OrderManager om)
|
||||||
{
|
{
|
||||||
@@ -204,6 +206,17 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
"crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates)));
|
"crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fragileAlliance = lobby.GetOrNull<CheckboxWidget>("FRAGILEALLIANCES_CHECKBOX");
|
||||||
|
if (fragileAlliance != null)
|
||||||
|
{
|
||||||
|
fragileAlliance.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.FragileAlliances;
|
||||||
|
fragileAlliance.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null
|
||||||
|
|| orderManager.LocalClient.IsReady || TeamGame; // only available in FFA
|
||||||
|
fragileAlliance.OnClick = () => orderManager.IssueOrder(Order.Command(
|
||||||
|
"fragilealliance {0}".F(!orderManager.LobbyInfo.GlobalSettings.FragileAlliances)));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
var difficulty = lobby.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
|
var difficulty = lobby.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
|
||||||
if (difficulty != null)
|
if (difficulty != null)
|
||||||
{
|
{
|
||||||
@@ -326,6 +339,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
void UpdatePlayerList()
|
void UpdatePlayerList()
|
||||||
{
|
{
|
||||||
var idx = 0;
|
var idx = 0;
|
||||||
|
TeamGame = false;
|
||||||
|
|
||||||
foreach (var kv in orderManager.LobbyInfo.Slots)
|
foreach (var kv in orderManager.LobbyInfo.Slots)
|
||||||
{
|
{
|
||||||
var key = kv.Key;
|
var key = kv.Key;
|
||||||
@@ -414,6 +429,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
team.OnMouseDown = _ => LobbyUtils.ShowTeamDropDown(team, client, orderManager, Map);
|
team.OnMouseDown = _ => LobbyUtils.ShowTeamDropDown(team, client, orderManager, Map);
|
||||||
team.GetText = () => (client.Team == 0) ? "-" : client.Team.ToString();
|
team.GetText = () => (client.Team == 0) ? "-" : client.Team.ToString();
|
||||||
|
|
||||||
|
if (slot.LockTeam || client.Team > 0)
|
||||||
|
TeamGame = true;
|
||||||
|
|
||||||
if (client.Bot == null)
|
if (client.Bot == null)
|
||||||
{
|
{
|
||||||
// local player
|
// local player
|
||||||
@@ -552,6 +570,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
while (Players.Children.Count > idx)
|
while (Players.Children.Count > idx)
|
||||||
Players.RemoveChild(Players.Children[idx]);
|
Players.RemoveChild(Players.Children[idx]);
|
||||||
|
|
||||||
|
if (orderManager.LobbyInfo.GlobalSettings.FragileAlliances && TeamGame)
|
||||||
|
orderManager.IssueOrder(Order.Command("fragilealliance false")); // No back-stabbing in Team games.
|
||||||
}
|
}
|
||||||
|
|
||||||
void CycleReady()
|
void CycleReady()
|
||||||
|
|||||||
@@ -420,9 +420,15 @@ Background@SERVER_LOBBY:
|
|||||||
Width: 80
|
Width: 80
|
||||||
Height: 20
|
Height: 20
|
||||||
Text: Crates
|
Text: Crates
|
||||||
|
Checkbox@FRAGILEALLIANCES_CHECKBOX:
|
||||||
|
X: PARENT_RIGHT-154
|
||||||
|
Y: PARENT_BOTTOM-119
|
||||||
|
Width: 80
|
||||||
|
Height: 20
|
||||||
|
Text: Fragile Alliances
|
||||||
Button@DISCONNECT_BUTTON:
|
Button@DISCONNECT_BUTTON:
|
||||||
X:PARENT_RIGHT-154
|
X:PARENT_RIGHT-154
|
||||||
Y:PARENT_BOTTOM-99
|
Y:PARENT_BOTTOM-94
|
||||||
Width:120
|
Width:120
|
||||||
Height:25
|
Height:25
|
||||||
Text:Disconnect
|
Text:Disconnect
|
||||||
|
|||||||
Reference in New Issue
Block a user