mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-27 23:43:45 -04:00
H:/PortableApps/GitPortable/App/Git/gb should define blocks independent of /lb (thanks goodlyay), also add /os lb.
This commit is contained in:
parent
9d91bab10d
commit
6190cf7e97
@ -28,13 +28,13 @@ namespace MCGalaxy.Commands
|
|||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
||||||
public CmdOverseer() { }
|
public CmdOverseer() { }
|
||||||
|
static char[] trimChars = { ' ' };
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (p.group.OverseerMaps == 0)
|
if (p.group.OverseerMaps == 0)
|
||||||
p.SendMessage("Your rank is set to have 0 overseer maps. Therefore, you may not use overseer.");
|
p.SendMessage("Your rank is set to have 0 overseer maps. Therefore, you may not use overseer.");
|
||||||
if (message == "") {
|
if (message == "") { Help(p); return; }
|
||||||
Help(p); return;
|
|
||||||
}
|
|
||||||
string[] parts = message.Split(' ');
|
string[] parts = message.Split(' ');
|
||||||
string cmd = parts[0].ToUpper();
|
string cmd = parts[0].ToUpper();
|
||||||
string arg = parts.Length > 1 ? parts[1].ToUpper() : "";
|
string arg = parts.Length > 1 ? parts[1].ToUpper() : "";
|
||||||
@ -42,7 +42,7 @@ namespace MCGalaxy.Commands
|
|||||||
byte mapNum = 0;
|
byte mapNum = 0;
|
||||||
|
|
||||||
bool mapOnly = cmd == "SPAWN" || cmd == "PRESET" || cmd == "WEATHER" || cmd == "ENV" ||
|
bool mapOnly = cmd == "SPAWN" || cmd == "PRESET" || cmd == "WEATHER" || cmd == "ENV" ||
|
||||||
cmd == "KICK" || cmd == "KICKALL" || cmd == "ZONE";
|
cmd == "KICK" || cmd == "KICKALL" || cmd == "ZONE" || cmd == "LB" || cmd == "LEVELBLOCK";
|
||||||
if (mapOnly && !p.level.name.ToUpper().StartsWith(p.name.ToUpper())) {
|
if (mapOnly && !p.level.name.ToUpper().StartsWith(p.name.ToUpper())) {
|
||||||
Player.SendMessage(p, "You may only perform that action on your own map.");
|
Player.SendMessage(p, "You may only perform that action on your own map.");
|
||||||
return;
|
return;
|
||||||
@ -61,6 +61,10 @@ namespace MCGalaxy.Commands
|
|||||||
if (!Server.levels.Any(l => l.name == mapname))
|
if (!Server.levels.Any(l => l.name == mapname))
|
||||||
Command.all.Find("load").Use(p, mapname);
|
Command.all.Find("load").Use(p, mapname);
|
||||||
Command.all.Find("goto").Use(p, mapname);
|
Command.all.Find("goto").Use(p, mapname);
|
||||||
|
} else if (cmd == "LB" || cmd == "LEVELBLOCK") {
|
||||||
|
string[] lbArgs = message.Split(trimChars, 2);
|
||||||
|
string lbArg = lbArgs.Length > 1 ? lbArgs[1] : "";
|
||||||
|
Command.all.Find("levelblock").Use(p, lbArg);
|
||||||
} else if (cmd == "SPAWN") {
|
} else if (cmd == "SPAWN") {
|
||||||
Command.all.Find("setspawn").Use(p, "");
|
Command.all.Find("setspawn").Use(p, "");
|
||||||
} else if (cmd == "PRESET") {
|
} else if (cmd == "PRESET") {
|
||||||
@ -381,7 +385,8 @@ namespace MCGalaxy.Commands
|
|||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.SendMessage(p, "/os [command string] - sends command to The Overseer");
|
Player.SendMessage(p, "/os [command string] - sends command to The Overseer");
|
||||||
Player.SendMessage(p, "Accepted commands:");
|
Player.SendMessage(p, "Accepted commands:");
|
||||||
Player.SendMessage(p, "go, map, spawn, zone, kick, kickall, env, weather, preset");
|
Player.SendMessage(p, "go, map, spawn, zone, kick, kickall, env, " +
|
||||||
|
"weather, preset, levelblock/lb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,8 +30,8 @@ namespace MCGalaxy.Commands {
|
|||||||
parts[i] = parts[i].ToLower();
|
parts[i] = parts[i].ToLower();
|
||||||
|
|
||||||
if (message == "") {
|
if (message == "") {
|
||||||
if (GetBD(p) != null)
|
if (GetBD(p, global) != null)
|
||||||
SendStepHelp(p, GetStep(p));
|
SendStepHelp(p, GetStep(p, global));
|
||||||
else
|
else
|
||||||
Help(p);
|
Help(p);
|
||||||
return;
|
return;
|
||||||
@ -49,11 +49,11 @@ namespace MCGalaxy.Commands {
|
|||||||
ListHandler(p, parts, global); break;
|
ListHandler(p, parts, global); break;
|
||||||
case "abort":
|
case "abort":
|
||||||
Player.SendMessage(p, "Aborted the custom block creation process.");
|
Player.SendMessage(p, "Aborted the custom block creation process.");
|
||||||
SetBD(p, null); break;
|
SetBD(p, global, null); break;
|
||||||
case "edit":
|
case "edit":
|
||||||
EditHandler(p, parts, global); break;
|
EditHandler(p, parts, global); break;
|
||||||
default:
|
default:
|
||||||
if (GetBD(p) != null)
|
if (GetBD(p, global) != null)
|
||||||
DefineBlockStep(p, message, global);
|
DefineBlockStep(p, message, global);
|
||||||
else
|
else
|
||||||
Help(p);
|
Help(p);
|
||||||
@ -85,15 +85,15 @@ namespace MCGalaxy.Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetBD(p, new BlockDefinition());
|
SetBD(p, global, new BlockDefinition());
|
||||||
GetBD(p).BlockID = (byte)targetId;
|
GetBD(p, global).BlockID = (byte)targetId;
|
||||||
SetTargetId(p, targetId);
|
SetTargetId(p, global, targetId);
|
||||||
Player.SendMessage(p, "Type '" + cmd + " abort' at anytime to abort the creation process.");
|
Player.SendMessage(p, "Type '" + cmd + " abort' at anytime to abort the creation process.");
|
||||||
Player.SendMessage(p, "Type '" + cmd + " revert' to go back a step in the creation process.");
|
Player.SendMessage(p, "Type '" + cmd + " revert' to go back a step in the creation process.");
|
||||||
Player.SendMessage(p, "Use '" + cmd + " <arg>' to enter arguments for the creation process.");
|
Player.SendMessage(p, "Use '" + cmd + " <arg>' to enter arguments for the creation process.");
|
||||||
Player.SendMessage(p, "%f----------------------------------------------------------");
|
Player.SendMessage(p, "%f----------------------------------------------------------");
|
||||||
SetStep(p, 2);
|
SetStep(p, global, 2);
|
||||||
SendStepHelp(p, GetStep(p));
|
SendStepHelp(p, GetStep(p, global));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListHandler(Player p, string[] parts, bool global) {
|
void ListHandler(Player p, string[] parts, bool global) {
|
||||||
@ -140,13 +140,13 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
void DefineBlockStep(Player p, string value, bool global) {
|
void DefineBlockStep(Player p, string value, bool global) {
|
||||||
string opt = value.ToLower();
|
string opt = value.ToLower();
|
||||||
int step = GetStep(p);
|
int step = GetStep(p, global);
|
||||||
if (opt == "revert" && step > 2) {
|
if (opt == "revert" && step > 2) {
|
||||||
step--;
|
step--;
|
||||||
SendStepHelp(p, step);
|
SendStepHelp(p, step);
|
||||||
SetStep(p, step); return;
|
SetStep(p, global, step); return;
|
||||||
}
|
}
|
||||||
BlockDefinition bd = GetBD(p);
|
BlockDefinition bd = GetBD(p, global);
|
||||||
|
|
||||||
if (step == 2) {
|
if (step == 2) {
|
||||||
bd.Name = value;
|
bd.Name = value;
|
||||||
@ -234,17 +234,17 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
Player.SendMessage(p, "Created a new custom block " + bd.Name + "(" + bd.BlockID + ")");
|
Player.SendMessage(p, "Created a new custom block " + bd.Name + "(" + bd.BlockID + ")");
|
||||||
BlockDefinition.Add(bd, defs, p == null ? null : p.level);
|
BlockDefinition.Add(bd, defs, p == null ? null : p.level);
|
||||||
SetBD(p, null);
|
SetBD(p, global, null);
|
||||||
SetStep(p, 0);
|
SetStep(p, global, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SendStepHelp(p, step);
|
SendStepHelp(p, step);
|
||||||
SetStep(p, step);
|
SetStep(p, global, step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditHandler(Player p, string[] parts, bool global) {
|
void EditHandler(Player p, string[] parts, bool global) {
|
||||||
if (parts.Length <= 3) {
|
if (parts.Length <= 3) {
|
||||||
if(parts.Length == 1)
|
if (parts.Length == 1)
|
||||||
Player.SendMessage(p, "Valid properties: name, collide, speed, toptex, sidetex, " +
|
Player.SendMessage(p, "Valid properties: name, collide, speed, toptex, sidetex, " +
|
||||||
"bottomtex, blockslight, sound, fullbright, shape, blockdraw, min, max, " +
|
"bottomtex, blockslight, sound, fullbright, shape, blockdraw, min, max, " +
|
||||||
"fogdensity, fogred, foggreen, fogblue, fallback");
|
"fogdensity, fogred, foggreen, fogblue, fallback");
|
||||||
@ -474,26 +474,32 @@ namespace MCGalaxy.Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static BlockDefinition consoleBD;
|
static BlockDefinition consoleBD;
|
||||||
static int consoleStep = 0;
|
static int consoleStep, consoleTargetId;
|
||||||
static int consoleTargetId;
|
|
||||||
|
|
||||||
static BlockDefinition GetBD(Player p) { return p == null ? consoleBD : p.bdBlock; }
|
static BlockDefinition GetBD(Player p, bool global) {
|
||||||
|
return p == null ? consoleBD : (global ? p.gbBlock : p.lbBlock);
|
||||||
|
}
|
||||||
|
|
||||||
static void SetBD(Player p, BlockDefinition bd) {
|
static int GetStep(Player p, bool global) {
|
||||||
|
return p == null ? consoleStep : (global ? p.gbStep : p.lbStep);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SetBD(Player p, bool global, BlockDefinition bd) {
|
||||||
if (p == null) consoleBD = bd;
|
if (p == null) consoleBD = bd;
|
||||||
else p.bdBlock = bd;
|
else if (global) p.gbBlock = bd;
|
||||||
|
else p.lbBlock = bd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetTargetId(Player p, int targetId) {
|
static void SetTargetId(Player p, bool global, int targetId) {
|
||||||
if (p == null) consoleTargetId = targetId;
|
if (p == null) consoleTargetId = targetId;
|
||||||
else p.bdTargetId = targetId;
|
else if (global) p.gbTargetId = targetId;
|
||||||
|
else p.lbTargetId = targetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GetStep(Player p) { return p == null ? consoleStep : p.bdStep; }
|
static void SetStep(Player p, bool global, int step) {
|
||||||
|
|
||||||
static void SetStep(Player p, int step) {
|
|
||||||
if (p == null) consoleStep = step;
|
if (p == null) consoleStep = step;
|
||||||
else p.bdStep = step;
|
else if (global) p.gbStep = step;
|
||||||
|
else p.lbStep = step;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void Help(Player p, bool global) {
|
protected static void Help(Player p, bool global) {
|
||||||
@ -535,6 +541,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public CmdLevelBlock() { }
|
public CmdLevelBlock() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
if (p == null) { MessageInGameOnly(p); return; }
|
||||||
Execute(p, message, false);
|
Execute(p, message, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,9 +230,10 @@ namespace MCGalaxy {
|
|||||||
public int[] centerend = new int[3] { 0, 0, 0 };
|
public int[] centerend = new int[3] { 0, 0, 0 };
|
||||||
|
|
||||||
// GlobalBlock
|
// GlobalBlock
|
||||||
internal int bdStep = 0;
|
internal int gbStep = 0, gbTargetId = 0;
|
||||||
internal int bdTargetId = 0;
|
internal BlockDefinition gbBlock;
|
||||||
internal BlockDefinition bdBlock;
|
internal int lbStep = 0, lbTargetId = 0;
|
||||||
|
internal BlockDefinition lbBlock;
|
||||||
|
|
||||||
public string model = "humanoid";
|
public string model = "humanoid";
|
||||||
public bool spawned = false;
|
public bool spawned = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user