Move cheats option to rules.
This commit is contained in:
@@ -58,7 +58,6 @@ namespace OpenRA
|
|||||||
|
|
||||||
public class MapOptions
|
public class MapOptions
|
||||||
{
|
{
|
||||||
public bool? Cheats;
|
|
||||||
public bool? Crates;
|
public bool? Crates;
|
||||||
public bool? Creeps;
|
public bool? Creeps;
|
||||||
public bool? Fog;
|
public bool? Fog;
|
||||||
@@ -72,8 +71,6 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void UpdateServerSettings(Session.Global settings)
|
public void UpdateServerSettings(Session.Global settings)
|
||||||
{
|
{
|
||||||
if (Cheats.HasValue)
|
|
||||||
settings.AllowCheats = Cheats.Value;
|
|
||||||
if (Crates.HasValue)
|
if (Crates.HasValue)
|
||||||
settings.Crates = Crates.Value;
|
settings.Crates = Crates.Value;
|
||||||
if (Creeps.HasValue)
|
if (Creeps.HasValue)
|
||||||
|
|||||||
@@ -14,17 +14,46 @@ namespace OpenRA.Traits
|
|||||||
[Desc("Attach this to the player actor.")]
|
[Desc("Attach this to the player actor.")]
|
||||||
public class DeveloperModeInfo : ITraitInfo
|
public class DeveloperModeInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
|
[Desc("Default value of the developer mode checkbox in the lobby.")]
|
||||||
|
public bool Enabled = false;
|
||||||
|
|
||||||
|
[Desc("Prevent the developer mode state from being changed in the lobby.")]
|
||||||
|
public bool Locked = false;
|
||||||
|
|
||||||
|
[Desc("Default cash bonus granted by the give cash cheat.")]
|
||||||
public int Cash = 20000;
|
public int Cash = 20000;
|
||||||
|
|
||||||
|
[Desc("Growth steps triggered by the grow resources button.")]
|
||||||
public int ResourceGrowth = 100;
|
public int ResourceGrowth = 100;
|
||||||
|
|
||||||
|
[Desc("Enable the fast build cheat by default.")]
|
||||||
public bool FastBuild;
|
public bool FastBuild;
|
||||||
|
|
||||||
|
[Desc("Enable the fast support powers cheat by default.")]
|
||||||
public bool FastCharge;
|
public bool FastCharge;
|
||||||
|
|
||||||
|
[Desc("Enable the disable visibility cheat by default.")]
|
||||||
public bool DisableShroud;
|
public bool DisableShroud;
|
||||||
public bool PathDebug;
|
|
||||||
|
[Desc("Enable the unlimited power cheat by default.")]
|
||||||
public bool UnlimitedPower;
|
public bool UnlimitedPower;
|
||||||
|
|
||||||
|
[Desc("Enable the build anywhere cheat by default.")]
|
||||||
public bool BuildAnywhere;
|
public bool BuildAnywhere;
|
||||||
|
|
||||||
|
[Desc("Enable the path debug overlay by default.")]
|
||||||
|
public bool PathDebug;
|
||||||
|
|
||||||
|
[Desc("Enable the combat geometry overlay by default.")]
|
||||||
public bool ShowCombatGeometry;
|
public bool ShowCombatGeometry;
|
||||||
|
|
||||||
|
[Desc("Enable the debug geometry overlay by default.")]
|
||||||
public bool ShowDebugGeometry;
|
public bool ShowDebugGeometry;
|
||||||
|
|
||||||
|
[Desc("Enable the depth buffer overlay by default.")]
|
||||||
public bool ShowDepthPreview;
|
public bool ShowDepthPreview;
|
||||||
|
|
||||||
|
[Desc("Enable the actor tags overlay by default.")]
|
||||||
public bool ShowActorTags;
|
public bool ShowActorTags;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
||||||
|
|||||||
@@ -408,7 +408,8 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.Map.Options.Cheats.HasValue)
|
var devMode = server.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>();
|
||||||
|
if (devMode.Locked)
|
||||||
{
|
{
|
||||||
server.SendOrderTo(conn, "Message", "Map has disabled cheat configuration.");
|
server.SendOrderTo(conn, "Message", "Map has disabled cheat configuration.");
|
||||||
return true;
|
return true;
|
||||||
@@ -1011,6 +1012,9 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
.Where(s => s != null)
|
.Where(s => s != null)
|
||||||
.ToDictionary(s => s.PlayerReference, s => s);
|
.ToDictionary(s => s.PlayerReference, s => s);
|
||||||
|
|
||||||
|
var gs = server.LobbyInfo.GlobalSettings;
|
||||||
|
var devMode = server.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>();
|
||||||
|
gs.AllowCheats = devMode.Enabled;
|
||||||
server.Map.Options.UpdateServerSettings(server.LobbyInfo.GlobalSettings);
|
server.Map.Options.UpdateServerSettings(server.LobbyInfo.GlobalSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -349,8 +349,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var allowCheats = optionsBin.GetOrNull<CheckboxWidget>("ALLOWCHEATS_CHECKBOX");
|
var allowCheats = optionsBin.GetOrNull<CheckboxWidget>("ALLOWCHEATS_CHECKBOX");
|
||||||
if (allowCheats != null)
|
if (allowCheats != null)
|
||||||
{
|
{
|
||||||
|
var cheatsLocked = new CachedTransform<Map, bool>(
|
||||||
|
map => map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>().Locked);
|
||||||
|
|
||||||
allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats;
|
allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats;
|
||||||
allowCheats.IsDisabled = () => configurationDisabled() || Map.Options.Cheats.HasValue;
|
allowCheats.IsDisabled = () => configurationDisabled() || cheatsLocked.Update(Map);
|
||||||
allowCheats.OnClick = () => orderManager.IssueOrder(Order.Command(
|
allowCheats.OnClick = () => orderManager.IssueOrder(Order.Command(
|
||||||
"allowcheats {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllowCheats)));
|
"allowcheats {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllowCheats)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,6 @@ ServerTraits:
|
|||||||
LobbySettingsNotification
|
LobbySettingsNotification
|
||||||
|
|
||||||
LobbyDefaults:
|
LobbyDefaults:
|
||||||
AllowCheats: false
|
|
||||||
Crates: true
|
Crates: true
|
||||||
StartingUnitsClass: light
|
StartingUnitsClass: light
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ ServerTraits:
|
|||||||
LobbySettingsNotification
|
LobbySettingsNotification
|
||||||
|
|
||||||
LobbyDefaults:
|
LobbyDefaults:
|
||||||
AllowCheats: false
|
|
||||||
Crates: true
|
Crates: true
|
||||||
StartingUnitsClass: none
|
StartingUnitsClass: none
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ ServerTraits:
|
|||||||
LobbySettingsNotification
|
LobbySettingsNotification
|
||||||
|
|
||||||
LobbyDefaults:
|
LobbyDefaults:
|
||||||
AllowCheats: false
|
|
||||||
Crates: true
|
Crates: true
|
||||||
StartingUnitsClass: none
|
StartingUnitsClass: none
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
|||||||
@@ -215,7 +215,6 @@ ServerTraits:
|
|||||||
LobbySettingsNotification
|
LobbySettingsNotification
|
||||||
|
|
||||||
LobbyDefaults:
|
LobbyDefaults:
|
||||||
AllowCheats: true
|
|
||||||
Crates: true
|
Crates: true
|
||||||
StartingUnitsClass: none
|
StartingUnitsClass: none
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ Player:
|
|||||||
PlayerResources:
|
PlayerResources:
|
||||||
ActorGroupProxy:
|
ActorGroupProxy:
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
|
Enabled: true
|
||||||
Shroud:
|
Shroud:
|
||||||
FrozenActorLayer:
|
FrozenActorLayer:
|
||||||
BaseAttackNotifier:
|
BaseAttackNotifier:
|
||||||
|
|||||||
Reference in New Issue
Block a user