Prepare DeveloperMode code for trait-defined lobby options.

This commit is contained in:
Paul Chote
2016-04-20 09:20:42 +02:00
parent 1eba0bea13
commit 7e49ae7eb0
6 changed files with 134 additions and 117 deletions

View File

@@ -24,10 +24,15 @@ namespace OpenRA.Mods.Common.Commands
public class DevCommands : IChatCommand, IWorldLoaded
{
World world;
DeveloperMode developerMode;
public void WorldLoaded(World w, WorldRenderer wr)
{
world = w;
if (world.LocalPlayer != null)
developerMode = world.LocalPlayer.PlayerActor.Trait<DeveloperMode>();
var console = world.WorldActor.Trait<ChatCommands>();
var help = world.WorldActor.Trait<HelpCommand>();
@@ -55,7 +60,7 @@ namespace OpenRA.Mods.Common.Commands
if (world.LocalPlayer == null)
return;
if (!world.AllowDevCommands)
if (!developerMode.Enabled)
{
Game.Debug("Cheats are disabled.");
return;