diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
index e684a7b905..a17d788e57 100644
--- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
+++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
@@ -85,6 +85,7 @@
+
diff --git a/OpenRA.Mods.Cnc/Widgets/CncCheatsLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncCheatsLogic.cs
new file mode 100644
index 0000000000..bf61a27300
--- /dev/null
+++ b/OpenRA.Mods.Cnc/Widgets/CncCheatsLogic.cs
@@ -0,0 +1,80 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
+ * This file is part of OpenRA.
+ *
+ * OpenRA is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenRA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with OpenRA. If not, see .
+ */
+#endregion
+
+using System;
+using OpenRA;
+using OpenRA.Traits;
+using OpenRA.Widgets;
+
+namespace OpenRA.Mods.Cnc.Widgets
+{
+ public class CncCheatsLogic : IWidgetDelegate
+ {
+ [ObjectCreator.UseCtor]
+ public CncCheatsLogic([ObjectCreator.Param] Widget widget,
+ [ObjectCreator.Param] World world)
+ {
+ var panel = widget.GetWidget("CHEATS_PANEL");
+
+ var devTrait = world.LocalPlayer.PlayerActor.Trait();
+ var shroudCheckbox = panel.GetWidget("SHROUD_CHECKBOX");
+ shroudCheckbox.IsChecked = () => devTrait.DisableShroud;
+ shroudCheckbox.OnClick = () => Order(world, "DevShroud");
+
+ var pathCheckbox = panel.GetWidget("PATHDEBUG_CHECKBOX");
+ pathCheckbox.IsChecked = () => devTrait.PathDebug;
+ pathCheckbox.OnClick = () => Order(world, "DevPathDebug");
+
+
+ panel.GetWidget("GIVE_CASH_BUTTON").OnClick = () =>
+ world.IssueOrder(new Order("DevGiveCash", world.LocalPlayer.PlayerActor, false));
+
+ var fastBuildCheckbox = panel.GetWidget("INSTANT_BUILD_CHECKBOX");
+ fastBuildCheckbox.IsChecked = () => devTrait.FastBuild;
+ fastBuildCheckbox.OnClick = () => Order(world, "DevFastBuild");
+
+ var fastChargeCheckbox = panel.GetWidget("INSTANT_CHARGE_CHECKBOX");
+ fastChargeCheckbox.IsChecked = () => devTrait.FastCharge;
+ fastChargeCheckbox.OnClick = () => Order(world, "DevFastCharge");
+
+ var allTechCheckbox = panel.GetWidget("ENABLE_TECH_CHECKBOX");
+ allTechCheckbox.IsChecked = () => devTrait.AllTech;
+ allTechCheckbox.OnClick = () => Order(world, "DevEnableTech");
+
+ var powerCheckbox = panel.GetWidget("UNLIMITED_POWER_CHECKBOX");
+ powerCheckbox.IsChecked = () => devTrait.UnlimitedPower;
+ powerCheckbox.OnClick = () => Order(world, "DevUnlimitedPower");
+
+ var buildAnywhereCheckbox = panel.GetWidget("BUILD_ANYWHERE_CHECKBOX");
+ buildAnywhereCheckbox.IsChecked = () => devTrait.BuildAnywhere;
+ buildAnywhereCheckbox.OnClick = () => Order(world, "DevBuildAnywhere");
+
+ panel.GetWidget("GIVE_EXPLORATION_BUTTON").OnClick = () =>
+ world.IssueOrder(new Order("DevGiveExploration", world.LocalPlayer.PlayerActor, false));
+
+ panel.GetWidget("CLOSE_BUTTON").OnClick = Widget.CloseWindow;
+ }
+
+ public void Order(World world, string order)
+ {
+ world.IssueOrder(new Order(order, world.LocalPlayer.PlayerActor, false));
+ }
+ }
+}
diff --git a/OpenRA.Mods.Cnc/Widgets/CncIngameChromeLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncIngameChromeLogic.cs
index d9c7a3f3bb..513b5e956e 100755
--- a/OpenRA.Mods.Cnc/Widgets/CncIngameChromeLogic.cs
+++ b/OpenRA.Mods.Cnc/Widgets/CncIngameChromeLogic.cs
@@ -65,6 +65,10 @@ namespace OpenRA.Mods.Cnc.Widgets
});
};
+ var cheatsButton = ingameRoot.GetWidget("CHEATS_BUTTON");
+ cheatsButton.OnClick = () => Game.OpenWindow("CHEATS_PANEL", new WidgetArgs());
+ cheatsButton.IsVisible = () => world.LobbyInfo.GlobalSettings.AllowCheats;
+
var postgameBG = ingameRoot.GetWidget("POSTGAME_BG");
postgameBG.IsVisible = () =>
{
diff --git a/mods/cnc/chrome/cheats.yaml b/mods/cnc/chrome/cheats.yaml
new file mode 100644
index 0000000000..e42adb3b03
--- /dev/null
+++ b/mods/cnc/chrome/cheats.yaml
@@ -0,0 +1,90 @@
+Container@CHEATS_PANEL:
+ Id:CHEATS_PANEL
+ Delegate:CncCheatsLogic
+ X:(WINDOW_RIGHT - WIDTH)/2
+ Y:(WINDOW_BOTTOM - 110)/2
+ Width:590
+ Height:145
+ Children:
+ Label@TITLE:
+ Width:590
+ Y:0-25
+ Font:BigBold
+ Contrast:true
+ Align:Center
+ Text:Cheats
+ Background@bg:
+ Width:590
+ Height:110
+ Background:panel-black
+ Children:
+ CncCheckbox@INSTANT_BUILD:
+ Id:INSTANT_BUILD_CHECKBOX
+ X:15
+ Y:15
+ Width:200
+ Height:20
+ Text:Instant Build Speed
+ CncCheckbox@ENABLE_TECH:
+ Id:ENABLE_TECH_CHECKBOX
+ X:15
+ Y:45
+ Width:200
+ Height:20
+ Text:Build Everything
+ CncCheckbox@BUILD_ANYWHERE:
+ Id:BUILD_ANYWHERE_CHECKBOX
+ X:15
+ Y:75
+ Width:200
+ Height:20
+ Text:Build Anywhere
+ CncCheckbox@UNLIMITED_POWER:
+ Id:UNLIMITED_POWER_CHECKBOX
+ X:200
+ Y:15
+ Width:200
+ Height:20
+ Text:Unlimited Power
+ CncCheckbox@INSTANT_CHARGE:
+ Id:INSTANT_CHARGE_CHECKBOX
+ X:200
+ Y:45
+ Width:200
+ Height:20
+ Text:Instant Charge Time
+ CncCheckbox@CHECKBOX_SHROUD:
+ Id:SHROUD_CHECKBOX
+ X:400
+ Y:15
+ Height:20
+ Width:200
+ Text:Disable Shroud
+ CncCheckbox@CHECKBOX_PATHDEBUG:
+ Id:PATHDEBUG_CHECKBOX
+ X:400
+ Y:45
+ Width:200
+ Height:20
+ Text:Show Unit Paths
+ CncMenuButton@CLOSE_BUTTON:
+ Id:CLOSE_BUTTON
+ X:0
+ Y:109
+ Width:140
+ Height:35
+ Text:Close
+ CncMenuButton@GIVE_CASH:
+ Id:GIVE_CASH_BUTTON
+ X:300
+ Y:109
+ Width:140
+ Height:35
+ Text:Give Cash
+ CncMenuButton@GIVE_EXPLORATION:
+ Id:GIVE_EXPLORATION_BUTTON
+ X:450
+ Y:109
+ Width:140
+ Height:35
+ Text:Give Exploration
\ No newline at end of file
diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml
index 7fafdd389d..e53864c7ad 100644
--- a/mods/cnc/chrome/ingame.yaml
+++ b/mods/cnc/chrome/ingame.yaml
@@ -33,14 +33,13 @@ Container@INGAME_ROOT:
Height:35
Text:Diplomacy
Bold:True
- CncMenuButton@DEVELOPERMODE_BUTTON:
- Id:DEVELOPERMODE_BUTTON
+ CncMenuButton@CHEATS_BUTTON:
+ Id:CHEATS_BUTTON
X:295
Y:5
Width:160
- Height:25
- Text:Developer Mode
- Visible:false
+ Height:35
+ Text:Cheats
Bold:True
WorldTooltip:
ChatDisplay@CHAT_DISPLAY:
diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml
index 7b6b7568c5..e995302c5a 100644
--- a/mods/cnc/mod.yaml
+++ b/mods/cnc/mod.yaml
@@ -75,6 +75,7 @@ ChromeLayout:
mods/cnc/chrome/music.yaml
mods/cnc/chrome/modchooser.yaml
mods/cnc/chrome/preferences.yaml
+ mods/cnc/chrome/cheats.yaml
Weapons:
mods/cnc/weapons.yaml