Move /mapset drawingallowed to /map drawing

This commit is contained in:
UnknownShadow200 2018-06-11 12:13:16 +10:00
parent 1dd38e812c
commit 6c86854b44
5 changed files with 22 additions and 18 deletions

View File

@ -37,7 +37,6 @@ namespace MCGalaxy.Commands.Fun {
Player.Message(p, "Build type: " + p.level.Config.BuildType);
Player.Message(p, "Min round time: " + p.level.Config.MinRoundTime + " minutes");
Player.Message(p, "Max round time: " + p.level.Config.MaxRoundTime + " minutes");
Player.Message(p, "Drawing commands allowed: " + p.level.Config.DrawingAllowed);
return;
}
@ -87,12 +86,6 @@ namespace MCGalaxy.Commands.Fun {
p.level.Config.MinRoundTime = time;
p.level.Config.MaxRoundTime = time;
Player.Message(p, "Set round time to: " + time + " minutes");
} else if (args[0].CaselessEq("drawingallowed") || args[0].CaselessEq("drawingenabled")) {
bool value = false;
if (!CommandParser.GetBool(p, args[1], ref value)) return;
p.level.Config.DrawingAllowed = value;
Player.Message(p, "Set drawing commands allowed to: " + value);
} else {
Player.Message(p, "Unrecognised property \"" + args[0] + "\"."); return;
}
@ -113,7 +106,6 @@ namespace MCGalaxy.Commands.Fun {
Player.Message(p, "%T/MapSet build [normal/modifyonly/nomodify]");
Player.Message(p, "%T/MapSet minroundtime [minutes]");
Player.Message(p, "%T/MapSet maxroundtime [minutes]");
Player.Message(p, "%T/MapSet drawingallowed [yes/no]");
}
}
}

View File

@ -111,19 +111,26 @@ namespace MCGalaxy.Commands.World {
Player.Message(p, " Roleplay (level only) chat: " + GetBool(!cfg.ServerWideChat));
Player.Message(p, " Load on /goto: {0}%S, Auto unload: {1}",
GetBool(cfg.LoadOnGoto), GetBool(cfg.AutoUnload));
Player.Message(p, " Buildable: {0}%S, Deletable: {1}",
GetBool(cfg.Buildable), GetBool(cfg.Deletable));
Player.Message(p, " Buildable: {0}%S, Deletable: {1}%S, Drawing: {2}",
GetBool(cfg.Buildable), GetBool(cfg.Deletable), GetBool(cfg.Drawing));
}
static string GetBool(bool value) { return value ? "&aON" : "&cOFF"; }
public override void Help(Player p) {
Player.Message(p, "%T/Map [map] [option] <value> %H- Sets [option] on that map");
Player.Message(p, "%HPossible options: %S{0}", LevelOptions.Options.Join(opt => opt.Name));
Player.Message(p, "%HUse %T/Help map [option] %Hto see description for that option.");
Player.Message(p, "%HUse %T/Help map options %Hfor a list of options");
Player.Message(p, "%HUse %T/Help map [option] %Hto see description for that option");
}
public override void Help(Player p, string message) {
if (message.CaselessEq("options")) {
Player.Message(p, "%HOptions: %S{0}",
LevelOptions.Options.Join(opt_ => opt_.Name));
Player.Message(p, "%HUse %T/Help map [option] %Hto see description for that option");
return;
}
LevelOption opt = LevelOptions.Find(message);
if (opt == null) {
Player.Message(p, "Unrecognised option \"{0}\".", message); return;

View File

@ -60,7 +60,7 @@ namespace MCGalaxy.Drawing.Ops {
public static bool Do(DrawOp op, Brush brush, Player p,
Vec3S32[] marks, bool checkLimit = true) {
Level lvl = Setup(op, p, marks);
if (lvl != null && !lvl.Config.DrawingAllowed) {
if (lvl != null && !lvl.Config.Drawing) {
Player.Message(p, "Drawing commands are turned off on this map.");
return false;
}

View File

@ -254,7 +254,7 @@ namespace MCGalaxy {
[ConfigInt("MaxRoundTime", "Game", 7)]
public int MaxRoundTime = 7;
[ConfigBool("DrawingAllowed", "Game", true)]
public bool DrawingAllowed = true;
public bool Drawing = true;
[ConfigInt("RoundsPlayed", "Game", 0)]
public int RoundsPlayed = 0;
[ConfigInt("RoundsHumanWon", "Game", 0)]

View File

@ -37,7 +37,8 @@ namespace MCGalaxy {
public const string Overload = "Overload", Fall = "Fall", Drown = "Drown", Finite = "Finite", AI = "AI";
public const string Edge = "Edge", Grass = "Grass", Death = "Death", Killer = "Killer", Unload = "Unload";
public const string Goto = "LoadOnGoto", Decay = "LeafDecay", Flow = "RandomFlow", Trees = "GrowTrees";
public const string Chat = "Chat", Guns = "Guns", Buildable = "Buildable", Deletable = "Deletable", LoadDelay = "LoadDelay";
public const string Chat = "Chat", Guns = "Guns", Buildable = "Buildable", Deletable = "Deletable";
public const string LoadDelay = "LoadDelay", Drawing = "Drawing";
public static List<LevelOption> Options = new List<LevelOption>() {
new LevelOption(MOTD, SetMotd, "%HSets the motd for this map. (leave blank to use default motd)"),
@ -60,9 +61,10 @@ namespace MCGalaxy {
new LevelOption(Trees, SetTrees, "%HWhether saplings grow into trees after a while."),
new LevelOption(Chat, SetChat, "%HWhether chat is only seen from and sent to players in the map."),
new LevelOption(Guns, SetGuns, "%HWhether guns and missiles can be used"),
new LevelOption(Buildable, SetBuildable, "%HWhether any blocks can be placed by players."),
new LevelOption(Deletable, SetDeletable, "%HWhether any blocks can be deleted by players."),
new LevelOption(LoadDelay, SetLoadDelay,
new LevelOption(Buildable, SetBuildable, "%HWhether any blocks can be placed by players."),
new LevelOption(Deletable, SetDeletable, "%HWhether any blocks can be deleted by players."),
new LevelOption(Drawing, SetDrawing, "%HWhether drawing commands (e.g /z) can be used on this map."),
new LevelOption(LoadDelay, SetLoadDelay,
"%HSets the delay before the end of the map is sent. Only useful for forcing players to see the map's MOTD at the loading screen."),
};
@ -136,6 +138,9 @@ namespace MCGalaxy {
static void SetChat(Player p, Level l, string v) {
Toggle(p, l, ref l.Config.ServerWideChat, "Roleplay (level only) chat", true);
}
static void SetDrawing(Player p, Level l, string v) {
Toggle(p, l, ref l.Config.Drawing, "Drawing commands");
}
static void SetLoadDelay(Player p, Level l, string value) {
int raw = 0;