diff --git a/Commands/World/CmdMap.cs b/Commands/World/CmdMap.cs
index 9bc4e511d..b9482bc92 100644
--- a/Commands/World/CmdMap.cs
+++ b/Commands/World/CmdMap.cs
@@ -169,7 +169,7 @@ namespace MCGalaxy.Commands
public override void Help(Player p) {
Player.SendMessage(p, "/map [level] [toggle] - Sets [toggle] on [level]");
Player.SendMessage(p, "Possible toggles: theme, finite, randomflow, ai, edge, grass, growtrees, leafdecay, ps, overload, motd, " +
- "death, fall, drown, unload, loadongoto, rp, instant, killer, chat, buildable, deletable");
+ "death, fall, drown, unload, loadongoto, rp, killer, chat, buildable, deletable, levelonlydeath");
Player.SendMessage(p, "Edge will cause edge water to flow.");
Player.SendMessage(p, "Grass will make grass not grow without physics.");
Player.SendMessage(p, "Tree growing will make saplings grow into trees after a while.");
@@ -187,7 +187,6 @@ namespace MCGalaxy.Commands
Player.SendMessage(p, "Unload sets whether the map unloads when no one's there.");
Player.SendMessage(p, "Load on /goto sets whether the map can be loaded when some uses /goto. Only works if the load on /goto server option is enabled.");
Player.SendMessage(p, "RP sets whether the physics auto-start for the map");
- Player.SendMessage(p, "Instant mode works by not updating everyone's screens");
Player.SendMessage(p, "Buildable sets whether any blocks can be placed by any player");
Player.SendMessage(p, "Deleteable sets whether any blocks can be deleted by any player");
}
diff --git a/Commands/building/CmdLine.cs b/Commands/building/CmdLine.cs
index ada482e55..d263df75e 100644
--- a/Commands/building/CmdLine.cs
+++ b/Commands/building/CmdLine.cs
@@ -60,9 +60,7 @@ namespace MCGalaxy.Commands {
GetRealBlock(type, extType, p, ref cpos);
if (cpos.mode == DrawMode.straight) {
- int dx = Math.Abs(cpos.x - x);
- int dy = Math.Abs(cpos.y - y);
- int dz = Math.Abs(cpos.z - z);
+ int dx = Math.Abs(cpos.x - x), dy = Math.Abs(cpos.y - y), dz = Math.Abs(cpos.z - z);
if (dx > dy && dx > dz) {
y = cpos.y; z = cpos.z;
diff --git a/Commands/building/CmdSPlace.cs b/Commands/building/CmdSPlace.cs
index 886c49b4e..55017da0a 100644
--- a/Commands/building/CmdSPlace.cs
+++ b/Commands/building/CmdSPlace.cs
@@ -30,6 +30,7 @@ namespace MCGalaxy.Commands {
public override void Use(Player p, string message) {
ushort distance = 0, interval = 0;
if (message == "") { Help(p); return; }
+ if (p == null) { MessageInGameOnly(p); return; }
string[] parts = message.Split(' ');
if (!ushort.TryParse(parts[0], out distance)) {
@@ -66,25 +67,28 @@ namespace MCGalaxy.Commands {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
ushort distance = cpos.distance, interval = cpos.interval;
- if (x == cpos.x && z == cpos.z) { Player.SendMessage(p, "No direction was selected"); return; }
+ if (x == cpos.x && y == cpos.y && z == cpos.z) { Player.SendMessage(p, "No direction was selected"); return; }
+
+ int dirX = 0, dirY = 0, dirZ = 0;
+ int dx = Math.Abs(cpos.x - x), dy = Math.Abs(cpos.y - y), dz = Math.Abs(cpos.z - z);
+ if (dy > dx && dy > dz) dirY = y > cpos.y ? 1 : -1;
+ else if (dx > dz) dirX = x > cpos.x ? 1 : -1;
+ else dirZ = z > cpos.z ? 1 : -1;
- int dirX = 0, dirZ = 0;
- if (Math.Abs(cpos.x - x) > Math.Abs(cpos.z - z))
- dirX = x > cpos.x ? 1 : -1;
- else
- dirZ = z > cpos.z ? 1 : -1;
ushort endX = (ushort)(cpos.x + dirX * distance);
+ ushort endY = (ushort)(cpos.y + dirY * distance);
ushort endZ = (ushort)(cpos.z + dirZ * distance);
- p.level.UpdateBlock(p, endX, cpos.y, endZ, Block.rock, 0);
+ p.level.UpdateBlock(p, endX, endY, endZ, Block.rock, 0);
if (interval > 0) {
- ushort xx = cpos.x, zz = cpos.z;
+ ushort xx = cpos.x, yy = cpos.y, zz = cpos.z;
int delta = 0;
- while (xx < p.level.Width && zz < p.level.Length && delta < distance) {
- p.level.UpdateBlock(p, xx, cpos.y, zz, Block.rock, 0);
+ while (xx < p.level.Width && yy < p.level.Height && zz < p.level.Length && delta < distance) {
+ p.level.UpdateBlock(p, xx, yy, zz, Block.rock, 0);
xx = (ushort)(xx + dirX * interval);
+ yy = (ushort)(yy + dirY * interval);
zz = (ushort)(zz + dirZ * interval);
- delta = Math.Abs(xx - cpos.x) + Math.Abs(zz - cpos.z);
+ delta = Math.Abs(xx - cpos.x) + Math.Abs(yy - cpos.y) + Math.Abs(zz - cpos.z);
}
} else {
p.level.UpdateBlock(p, cpos.x, cpos.y, cpos.z, Block.rock, 0);
diff --git a/Levels/Level.cs b/Levels/Level.cs
index 7d451b8e2..7bbd8ad00 100644
--- a/Levels/Level.cs
+++ b/Levels/Level.cs
@@ -413,6 +413,7 @@ namespace MCGalaxy
}
+ /// Returns whether the given coordinates are insides the boundaries of this level.
public bool InBound(ushort x, ushort y, ushort z)
{
return x >= 0 && y >= 0 && z >= 0 && x < Width && y < Height && z < Length;
@@ -703,6 +704,7 @@ namespace MCGalaxy
public void ChatLevelAdmins(string message) { ChatLevel(message, Server.adminchatperm); }
+ /// Sends a chat messages to all players in the level, who have at least the minPerm rank.
public void ChatLevel(string message, LevelPermission minPerm) {
Player[] players = PlayerInfo.Online;
foreach (Player pl in players) {
diff --git a/Player/Chat.cs b/Player/Chat.cs
index dc1bbd7d0..a0caa3090 100644
--- a/Player/Chat.cs
+++ b/Player/Chat.cs
@@ -32,6 +32,11 @@ namespace MCGalaxy {
SendMessage(p, from, message);
}
}
+
+ [Obsolete("Use GlobalChatLevel instead, this method has been removed.")]
+ public static void GlobalChatWorld(Player from, string message, bool showname) {
+ GlobalChatLevel(from, message, showname);
+ }
public static void GlobalChatRoom(Player from, string message, bool showname) {
string oldmessage = message;
@@ -61,17 +66,7 @@ namespace MCGalaxy {
}
Server.s.Log(oldmessage + "" + from.prefix + from.name + message);
}
-
- public static void GlobalChatWorld(Player from, string message, bool showname) {
- if (showname)
- message = "" + from.color + from.voicestring + from.color + from.prefix + from.name + ": &f" + message;
- Player[] players = PlayerInfo.Online;
- foreach (Player p in players) {
- if (p.level.worldChat && p.Chatroom == null)
- SendMessage(p, from, message);
- }
- }
-
+
public static void GlobalMessageLevel(Level l, string message) {
Player[] players = PlayerInfo.Online;
foreach (Player p in players) {
diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs
index e7f7e1387..f705559db 100644
--- a/Player/Player.Handlers.cs
+++ b/Player/Player.Handlers.cs
@@ -1026,33 +1026,33 @@ return;
if ( level.Killer && !invincible && !hidden ) {
switch ( b ) {
- case Block.tntexplosion: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " &cblew into pieces.", false); break;
- case Block.deathair: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " walked into &cnerve gas and suffocated.", false); break;
+ case Block.tntexplosion: Chat.GlobalChatLevel(this, FullName + " %S&cblew into pieces.", false); break;
+ case Block.deathair: Chat.GlobalChatLevel(this, FullName + " %Swalked into &cnerve gas and suffocated.", false); break;
case Block.deathwater:
- case Block.activedeathwater: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " stepped in &dcold water and froze.", false); break;
+ case Block.activedeathwater: Chat.GlobalChatLevel(this, FullName + " %Sstepped in &dcold water and froze.", false); break;
case Block.deathlava:
case Block.activedeathlava:
- case Block.fastdeathlava: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " stood in &cmagma and melted.", false); break;
- case Block.magma: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was hit by &cflowing magma and melted.", false); break;
- case Block.geyser: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was hit by &cboiling water and melted.", false); break;
- case Block.birdkill: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was hit by a &cphoenix and burnt.", false); break;
- case Block.train: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was hit by a &ctrain.", false); break;
- case Block.fishshark: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was eaten by a &cshark.", false); break;
- case Block.fire: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " burnt to a &ccrisp.", false); break;
- case Block.rockethead: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was &cin a fiery explosion.", false); level.MakeExplosion(x, y, z, 0); break;
- case Block.zombiebody: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " died due to lack of &5brain.", false); break;
- case Block.creeper: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was killed &cb-SSSSSSSSSSSSSS", false); level.MakeExplosion(x, y, z, 1); break;
- case Block.air: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " hit the floor &chard.", false); break;
- case Block.water: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " &cdrowned.", false); break;
- case Block.Zero: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was &cterminated", false); break;
- case Block.fishlavashark: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was eaten by a ... LAVA SHARK?!", false); break;
+ case Block.fastdeathlava: Chat.GlobalChatLevel(this, FullName + " %Sstood in &cmagma and melted.", false); break;
+ case Block.magma: Chat.GlobalChatLevel(this, FullName + " %Swas hit by &cflowing magma and melted.", false); break;
+ case Block.geyser: Chat.GlobalChatLevel(this, FullName + " %Swas hit by &cboiling water and melted.", false); break;
+ case Block.birdkill: Chat.GlobalChatLevel(this, FullName + " %Swas hit by a &cphoenix and burnt.", false); break;
+ case Block.train: Chat.GlobalChatLevel(this, FullName + " %Swas hit by a &ctrain.", false); break;
+ case Block.fishshark: Chat.GlobalChatLevel(this, FullName + " %Swas eaten by a &cshark.", false); break;
+ case Block.fire: Chat.GlobalChatLevel(this, FullName + " %Sburnt to a &ccrisp.", false); break;
+ case Block.rockethead: Chat.GlobalChatLevel(this, FullName + " %Swas &cin a fiery explosion.", false); level.MakeExplosion(x, y, z, 0); break;
+ case Block.zombiebody: Chat.GlobalChatLevel(this, FullName + " %Sdied due to lack of &5brain.", false); break;
+ case Block.creeper: Chat.GlobalChatLevel(this, FullName + " %Swas killed &cb-SSSSSSSSSSSSSS", false); level.MakeExplosion(x, y, z, 1); break;
+ case Block.air: Chat.GlobalChatLevel(this, FullName + " %Shit the floor &chard.", false); break;
+ case Block.water: Chat.GlobalChatLevel(this, FullName + " %S&cdrowned.", false); break;
+ case Block.Zero: Chat.GlobalChatLevel(this, FullName + " %Swas &cterminated", false); break;
+ case Block.fishlavashark: Chat.GlobalChatLevel(this, FullName + " %Swas eaten by a ... LAVA SHARK?!", false); break;
case Block.rock:
if ( explode ) level.MakeExplosion(x, y, z, 1);
- SendChatFrom(this, this.FullName + Server.DefaultColor + customMessage, false);
+ SendChatFrom(this, FullName + "%S" + customMessage, false);
break;
case Block.stone:
if ( explode ) level.MakeExplosion(x, y, z, 1);
- Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + customMessage, false);
+ Chat.GlobalChatLevel(this, FullName + "%S" + customMessage, false);
break;
}
if ( team != null && this.level.ctfmode ) {
@@ -1348,7 +1348,7 @@ return;
string newtext = text;
if (!Server.worldChat) {
newtext = text.Remove(0, 1).Trim();
- Chat.GlobalChatWorld(this, newtext, true);
+ Chat.GlobalChatLevel(this, newtext, true);
} else {
SendChatFrom(this, newtext);
}