diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 230c794bf4..f8c16039c4 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -63,7 +63,6 @@ namespace OpenRA public bool? Fog; public bool? Shroud; public bool? AllyBuildRadius; - public bool? FragileAlliances; public int? StartingCash; public string TechLevel; public bool ConfigurableStartingUnits = true; @@ -86,8 +85,6 @@ namespace OpenRA settings.AllyBuildRadius = AllyBuildRadius.Value; if (StartingCash.HasValue) settings.StartingCash = StartingCash.Value; - if (FragileAlliances.HasValue) - settings.FragileAlliances = FragileAlliances.Value; if (ShortGame.HasValue) settings.ShortGame = ShortGame.Value; } diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs index e452f09a07..2c7c469844 100644 --- a/OpenRA.Game/Network/Session.cs +++ b/OpenRA.Game/Network/Session.cs @@ -179,7 +179,6 @@ namespace OpenRA.Network public int Timestep = 40; public int OrderLatency = 3; // net tick frames (x 120 = ms) public int RandomSeed = 0; - public bool FragileAlliances = false; // Allow diplomatic stance changes after game start. public bool AllowCheats = false; public bool AllowSpectators = true; public bool Dedicated; diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index 53cff53af5..e596d89bae 100644 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -265,29 +265,6 @@ namespace OpenRA.Network break; } - case "SetStance": - { - if (!Game.OrderManager.LobbyInfo.GlobalSettings.FragileAlliances) - return; - - var targetPlayer = order.Player.World.Players.FirstOrDefault(p => p.InternalName == order.TargetString); - var newStance = (Stance)order.ExtraData; - - order.Player.SetStance(targetPlayer, newStance); - - Game.Debug("{0} has set diplomatic stance vs {1} to {2}", - order.Player.PlayerName, targetPlayer.PlayerName, newStance); - - // automatically declare war reciprocally - if (newStance == Stance.Enemy && targetPlayer.Stances[order.Player] == Stance.Ally) - { - targetPlayer.SetStance(order.Player, newStance); - Game.Debug("{0} has reciprocated", targetPlayer.PlayerName); - } - - break; - } - case "Ping": { orderManager.IssueOrder(Order.Pong(order.TargetString)); diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 1e21983465..b45c1b3008 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -141,17 +141,6 @@ namespace OpenRA return p == null || Stances[p] == Stance.Ally || (p.Spectating && !NonCombatant); } - public void SetStance(Player target, Stance s) - { - var oldStance = Stances[target]; - Stances[target] = s; - target.Shroud.UpdatePlayerStance(World, this, oldStance, s); - Shroud.UpdatePlayerStance(World, target, oldStance, s); - - foreach (var nsc in World.ActorsWithTrait()) - nsc.Trait.StanceChanged(nsc.Actor, this, target, oldStance, s); - } - public bool CanViewActor(Actor a) { return a.CanBeViewedByPlayer(this); diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index e346d4191a..71dfc1627a 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -364,12 +364,6 @@ namespace OpenRA.Traits IEnumerable TargetablePositions(Actor self); } - public interface INotifyStanceChanged - { - void StanceChanged(Actor self, Player a, Player b, - Stance oldStance, Stance newStance); - } - public interface ILintPass { void Run(Action emitError, Action emitWarning); } public interface ILintMapPass { void Run(Action emitError, Action emitWarning, Map map); } public interface ILintRulesPass { void Run(Action emitError, Action emitWarning, Ruleset rules); } diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index a6952e89d7..a19f9186f2 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -582,7 +582,6 @@ - diff --git a/OpenRA.Mods.Common/Scripting/Properties/DiplomacyProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/DiplomacyProperties.cs index 96f5a88909..15b9d9b7be 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/DiplomacyProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/DiplomacyProperties.cs @@ -24,13 +24,5 @@ namespace OpenRA.Mods.Common.Scripting { return Player.IsAlliedWith(targetPlayer); } - - [Desc("Changes the current stance of the player against the target player. " + - "Allowed keywords for new stance: Ally, Neutral, Enemy.")] - public void SetStance(Player targetPlayer, string newStance) - { - var emergingStance = Enum.Parse(newStance); - Player.SetStance(targetPlayer, emergingStance); - } } } \ No newline at end of file diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index 86dc76dfb8..bce93fa560 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -381,29 +381,6 @@ namespace OpenRA.Mods.Common.Server return true; } }, - { "fragilealliance", - s => - { - if (!client.IsAdmin) - { - server.SendOrderTo(conn, "Message", "Only the host can set that option."); - return true; - } - - if (server.Map.Options.FragileAlliances.HasValue) - { - server.SendOrderTo(conn, "Message", "Map has disabled alliance configuration."); - return true; - } - - bool.TryParse(s, out server.LobbyInfo.GlobalSettings.FragileAlliances); - server.SyncLobbyGlobalSettings(); - server.SendMessage("{0} {1} Diplomacy Changes." - .F(client.Name, server.LobbyInfo.GlobalSettings.FragileAlliances ? "enabled" : "disabled")); - - return true; - } - }, { "allowcheats", s => { diff --git a/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs b/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs index e7072971f2..79954ba1ff 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs @@ -25,9 +25,6 @@ namespace OpenRA.Mods.Common.Server var defaults = new Session.Global(); FieldLoader.Load(defaults, Game.ModData.Manifest.LobbyDefaults); - if (server.LobbyInfo.GlobalSettings.FragileAlliances != defaults.FragileAlliances) - server.SendOrderTo(conn, "Message", "Diplomacy Changes: {0}".F(server.LobbyInfo.GlobalSettings.FragileAlliances)); - if (server.LobbyInfo.GlobalSettings.AllowCheats != defaults.AllowCheats) server.SendOrderTo(conn, "Message", "Allow Cheats: {0}".F(server.LobbyInfo.GlobalSettings.AllowCheats)); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/DiplomacyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/DiplomacyLogic.cs deleted file mode 100644 index f949f53d2b..0000000000 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/DiplomacyLogic.cs +++ /dev/null @@ -1,108 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. - */ -#endregion - -using System; -using System.Linq; -using OpenRA.Network; -using OpenRA.Traits; -using OpenRA.Widgets; - -namespace OpenRA.Mods.Common.Widgets.Logic -{ - public class DiplomacyLogic : ChromeLogic - { - readonly World world; - - ScrollPanelWidget diplomacyPanel; - - [ObjectCreator.UseCtor] - public DiplomacyLogic(Widget widget, Action onExit, World world) - { - this.world = world; - - diplomacyPanel = widget.Get("DIPLOMACY_PANEL"); - - LayoutPlayers(); - - var close = widget.GetOrNull("CLOSE"); - if (close != null) - close.OnClick = () => - { - Ui.CloseWindow(); - Ui.Root.RemoveChild(widget); - onExit(); - }; - } - - void LayoutPlayers() - { - var teamTemplate = diplomacyPanel.Get("TEAM_TEMPLATE"); - var players = world.Players.Where(p => p != world.LocalPlayer && !p.NonCombatant); - var teams = players.GroupBy(p => (world.LobbyInfo.ClientWithIndex(p.ClientIndex) ?? new Session.Client()).Team).OrderBy(g => g.Key); - foreach (var t in teams) - { - var team = t; - var tt = ScrollItemWidget.Setup(teamTemplate, () => false, () => { }); - tt.IgnoreMouseOver = true; - tt.Get("TEAM").GetText = () => team.Key == 0 ? "No Team" : "Team " + team.Key; - diplomacyPanel.AddChild(tt); - foreach (var p in team) - { - var player = p; - diplomacyPanel.AddChild(DiplomaticStatus(player)); - } - } - } - - ScrollItemWidget DiplomaticStatus(Player player) - { - var playerTemplate = diplomacyPanel.Get("PLAYER_TEMPLATE"); - var pt = ScrollItemWidget.Setup(playerTemplate, () => false, () => { }); - pt.IgnoreMouseOver = true; - LobbyUtils.AddPlayerFlagAndName(pt, player); - pt.Get("THEIR_STANCE").GetText = () => player.Stances[world.LocalPlayer].ToString(); - var myStance = pt.Get("MY_STANCE"); - myStance.GetText = () => world.LocalPlayer.Stances[player].ToString(); - myStance.IsDisabled = () => !world.LobbyInfo.GlobalSettings.FragileAlliances; - myStance.OnMouseDown = mi => ShowDropDown(player, myStance); - return pt; - } - - void ShowDropDown(Player p, DropDownButtonWidget dropdown) - { - var stances = Enum.GetValues(); - Func setupItem = (s, template) => - { - var item = ScrollItemWidget.Setup(template, - () => s == world.LocalPlayer.Stances[p], - () => SetStance(dropdown, p, s)); - - item.Get("LABEL").GetText = () => s.ToString(); - return item; - }; - - dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, stances, setupItem); - } - - void SetStance(ButtonWidget bw, Player p, Stance ss) - { - if (!p.World.LobbyInfo.GlobalSettings.FragileAlliances) - return; // stance changes are banned - - world.IssueOrder(new Order("SetStance", world.LocalPlayer.PlayerActor, false) - { - ExtraData = (uint)ss, - TargetString = p.InternalName, - }); - - bw.Text = ss.ToString(); - } - } -} diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 20061830f4..bf3dcbf2ee 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -372,15 +372,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic "allybuildradius {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllyBuildRadius))); } - var fragileAlliance = optionsBin.GetOrNull("FRAGILEALLIANCES_CHECKBOX"); - if (fragileAlliance != null) - { - fragileAlliance.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.FragileAlliances; - fragileAlliance.IsDisabled = () => Map.Status != MapStatus.Available || Map.Map.Options.FragileAlliances.HasValue || configurationDisabled(); - fragileAlliance.OnClick = () => orderManager.IssueOrder(Order.Command( - "fragilealliance {0}".F(!orderManager.LobbyInfo.GlobalSettings.FragileAlliances))); - } - var shortGame = optionsBin.GetOrNull("SHORTGAME_CHECKBOX"); if (shortGame != null) { diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs index 8a5930dd1b..3d5afd817a 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs @@ -118,7 +118,7 @@ namespace OpenRA.Mods.RA.Traits public override object Create(ActorInitializer init) { return new GpsPower(init.Self, this); } } - class GpsPower : SupportPower, INotifyKilled, INotifyStanceChanged, INotifySold, INotifyOwnerChanged + class GpsPower : SupportPower, INotifyKilled, INotifySold, INotifyOwnerChanged { GpsWatcher owner; @@ -159,11 +159,6 @@ namespace OpenRA.Mods.RA.Traits owner.GpsRem(self); } - public void StanceChanged(Actor self, Player a, Player b, Stance oldStance, Stance newStance) - { - owner.RefreshGps(self); - } - public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) { RemoveGps(self); diff --git a/mods/d2k/chrome/ingame-player.yaml b/mods/d2k/chrome/ingame-player.yaml index fd414ff4f5..6edba7d1ec 100644 --- a/mods/d2k/chrome/ingame-player.yaml +++ b/mods/d2k/chrome/ingame-player.yaml @@ -109,24 +109,6 @@ Container@PLAYER_WIDGETS: X: 0 Y: 0 ImageCollection: order-icons - MenuButton@DIPLOMACY_BUTTON: - MenuContainer: INGAME_DIPLOMACY_BG - HideIngameUI: false - Pause: false - Key: P - X: 159 - Width: 25 - Height: 25 - Background: - TooltipText: Diplomacy - TooltipContainer: TOOLTIP_CONTAINER - VisualHeight: 0 - Children: - Image@ICON: - X: 0 - Y: 0 - ImageCollection: order-icons - ImageName: diplomacy MenuButton@OPTIONS_BUTTON: Key: escape X: 78 diff --git a/mods/d2k/chrome/lobby-options.yaml b/mods/d2k/chrome/lobby-options.yaml index 46b4b76476..c91d87da7a 100644 --- a/mods/d2k/chrome/lobby-options.yaml +++ b/mods/d2k/chrome/lobby-options.yaml @@ -27,35 +27,29 @@ Background@LOBBY_OPTIONS_BIN: Height: 20 Text: Fog of War Checkbox@SHORTGAME_CHECKBOX: - X: 150 + X: 180 Width: 140 Height: 20 Text: Short Game Checkbox@CRATES_CHECKBOX: - X: 150 + X: 180 Y: 35 Width: 140 Height: 20 Text: Crates Checkbox@ALLYBUILDRADIUS_CHECKBOX: - X: 290 + X: 350 Width: 140 Height: 20 Text: Build off Allies' ConYards - Checkbox@FRAGILEALLIANCES_CHECKBOX: - X: 290 - Y: 35 - Width: 140 - Height: 20 - Text: Diplomacy Changes Checkbox@CREEPS_CHECKBOX: Y: 70 Width: 140 Height: 20 Text: Worms Checkbox@ALLOWCHEATS_CHECKBOX: - X: 150 - Y: 70 + X: 350 + Y: 35 Width: 140 Height: 20 Text: Debug Menu diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index 4a4b283fb0..4cdad1f67d 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -69,7 +69,6 @@ Assemblies: ChromeLayout: d2k:chrome/ingame.yaml ./mods/ra/chrome/ingame-chat.yaml - ./mods/ra/chrome/ingame-diplomacy.yaml ./mods/ra/chrome/ingame-fmvplayer.yaml d2k:chrome/ingame-menu.yaml ./mods/ra/chrome/ingame-info.yaml diff --git a/mods/ra/chrome/ingame-diplomacy.yaml b/mods/ra/chrome/ingame-diplomacy.yaml deleted file mode 100644 index 2b38aa6d2a..0000000000 --- a/mods/ra/chrome/ingame-diplomacy.yaml +++ /dev/null @@ -1,91 +0,0 @@ -Background@INGAME_DIPLOMACY_BG: - Logic: DiplomacyLogic - X: (WINDOW_RIGHT - WIDTH)/2 - Y: (WINDOW_BOTTOM - HEIGHT)/2 - Width: 490 - Height: 355 - Children: - Label@LABEL_TITLE: - X: (PARENT_RIGHT - WIDTH)/2 - Y: 17 - Width: 250 - Height: 20 - Text: Diplomacy - Align: Center - Font: Bold - Container@DIPLOMACY_HEADERS: - X: 20 - Y: 40 - Width: PARENT_RIGHT-40 - Height: PARENT_BOTTOM - Children: - Label@PLAYER_HEADER: - X: 20 - Width: 160 - Height: 25 - Font: Bold - Text: Player - Label@THEIR_STANCE_HEADER: - X: 210 - Width: 80 - Height: 25 - Font: Bold - Text: Their Stance - Align: Center - Label@MY_STANCE_HEADER: - X: 307 - Width: 100 - Height: 25 - Font: Bold - Text: My Stance - Align: Center - ScrollPanel@DIPLOMACY_PANEL: - X: 20 - Y: 67 - Width: PARENT_RIGHT-40 - Height: PARENT_BOTTOM-87-35 - TopBottomSpacing: 5 - ItemSpacing: 5 - Children: - ScrollItem@TEAM_TEMPLATE: - Width: PARENT_RIGHT - Height: 25 - Children: - Label@TEAM: - X: 10 - Width: PARENT_RIGHT - Height: PARENT_BOTTOM - Font: Bold - ScrollItem@PLAYER_TEMPLATE: - Width: PARENT_RIGHT-35 - Height: 25 - Children: - Image@FLAG: - X: 20 - Y: 5 - Width: 35 - Height: PARENT_BOTTOM-5 - ImageName: random - ImageCollection: flags - Label@PLAYER: - X: 55 - Width: 160 - Height: PARENT_BOTTOM - Font: Bold - Label@THEIR_STANCE: - X: 210 - Width: 80 - Height: PARENT_BOTTOM - Align: Center - DropDownButton@MY_STANCE: - X: 307 - Width: 100 - Height: PARENT_BOTTOM - Button@CLOSE: - X: PARENT_RIGHT-145 - Y: PARENT_BOTTOM - 45 - Width: 120 - Height: 25 - Text: Close - Key: escape - Font: Bold diff --git a/mods/ra/chrome/ingame-player.yaml b/mods/ra/chrome/ingame-player.yaml index c3339086da..4bdae9a94a 100644 --- a/mods/ra/chrome/ingame-player.yaml +++ b/mods/ra/chrome/ingame-player.yaml @@ -115,25 +115,6 @@ Container@PLAYER_WIDGETS: Y: 6 ImageCollection: order-icons ImageName: debug - MenuButton@DIPLOMACY_BUTTON: - Logic: AddFactionSuffixLogic - MenuContainer: INGAME_DIPLOMACY_BG - HideIngameUI: false - Pause: false - Key: P - X: 160 - Width: 28 - Height: 28 - Background: sidebar-button - TooltipText: Diplomacy - TooltipContainer: TOOLTIP_CONTAINER - VisualHeight: 0 - Children: - Image@ICON: - X: 6 - Y: 6 - ImageCollection: order-icons - ImageName: diplomacy MenuButton@OPTIONS_BUTTON: Logic: AddFactionSuffixLogic Key: escape diff --git a/mods/ra/chrome/lobby-options.yaml b/mods/ra/chrome/lobby-options.yaml index 7740854979..fb67fe2137 100644 --- a/mods/ra/chrome/lobby-options.yaml +++ b/mods/ra/chrome/lobby-options.yaml @@ -27,29 +27,24 @@ Background@LOBBY_OPTIONS_BIN: Height: 20 Text: Fog of War Checkbox@SHORTGAME_CHECKBOX: - X: 150 + X: 180 Width: 140 Height: 20 Text: Short Game Checkbox@CRATES_CHECKBOX: - X: 150 + X: 180 Y: 35 Width: 140 Height: 20 Text: Crates Checkbox@ALLYBUILDRADIUS_CHECKBOX: - X: 290 + X: 350 Width: 140 Height: 20 Text: Build off Allies' ConYards - Checkbox@FRAGILEALLIANCES_CHECKBOX: - X: 290 - Y: 35 - Width: 140 - Height: 20 - Text: Diplomacy Changes Checkbox@ALLOWCHEATS_CHECKBOX: - Y: 70 + X: 350 + Y: 35 Width: 140 Height: 20 Text: Debug Menu diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml index 20674cec31..c0397fd1c1 100644 --- a/mods/ra/mod.yaml +++ b/mods/ra/mod.yaml @@ -82,7 +82,6 @@ Assemblies: ChromeLayout: ./mods/ra/chrome/ingame.yaml ./mods/ra/chrome/ingame-chat.yaml - ./mods/ra/chrome/ingame-diplomacy.yaml ./mods/ra/chrome/ingame-fmvplayer.yaml ./mods/ra/chrome/ingame-info.yaml ./mods/ra/chrome/ingame-infoscripterror.yaml diff --git a/mods/ts/chrome/ingame-player.yaml b/mods/ts/chrome/ingame-player.yaml index 68933c7756..32bc04882c 100644 --- a/mods/ts/chrome/ingame-player.yaml +++ b/mods/ts/chrome/ingame-player.yaml @@ -118,26 +118,6 @@ Container@PLAYER_WIDGETS: X: 0 Y: 0 ImageCollection: order-icons - MenuButton@DIPLOMACY_BUTTON: - Logic: AddFactionSuffixLogic - MenuContainer: INGAME_DIPLOMACY_BG - HideIngameUI: false - Pause: false - Key: P - X: 163 - Width: 30 - Height: 31 - Background: sidebar-button - TooltipText: Diplomacy - TooltipContainer: TOOLTIP_CONTAINER - VisualHeight: 0 - Children: - Image@ICON: - Logic: AddFactionSuffixLogic - X: 0 - Y: 0 - ImageCollection: order-icons - ImageName: diplomacy MenuButton@OPTIONS_BUTTON: Logic: AddFactionSuffixLogic Key: escape diff --git a/mods/ts/mod.yaml b/mods/ts/mod.yaml index 9e2eb7b762..ba722d96c9 100644 --- a/mods/ts/mod.yaml +++ b/mods/ts/mod.yaml @@ -134,7 +134,6 @@ Assemblies: ChromeLayout: ./mods/ra/chrome/ingame.yaml ./mods/ra/chrome/ingame-chat.yaml - ./mods/ra/chrome/ingame-diplomacy.yaml ./mods/ra/chrome/ingame-fmvplayer.yaml ./mods/ra/chrome/ingame-menu.yaml ./mods/ts/chrome/ingame-info.yaml