mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-25 14:17:29 -04:00
Fix /explode exploding on the player's instead of the target's level, cleanup /queue too.
This commit is contained in:
parent
5d7c2fc1ed
commit
4759316a75
@ -21,7 +21,7 @@ namespace MCGalaxy.Commands
|
||||
{
|
||||
public override string name { get { return "alive"; } }
|
||||
public override string shortcut { get { return "alive"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override string type { get { return CommandTypes.Games; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||
public CmdAlive() { }
|
70
Commands/Fun/CmdQueue.cs
Normal file
70
Commands/Fun/CmdQueue.cs
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy)
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.osedu.org/licenses/ECL-2.0
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System.IO;
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdQueue : Command
|
||||
{
|
||||
public override string name { get { return "queue"; } }
|
||||
public override string shortcut { get { return "qz"; } }
|
||||
public override string type { get { return CommandTypes.Games; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public CmdQueue() { }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
string[] args = message.Split(' ');
|
||||
if (args.Length != 2) { Help(p); return; }
|
||||
string value = args[1];
|
||||
|
||||
if (args[0] == "zombie") {
|
||||
Player who = Player.Find(value);
|
||||
if (who == null) {
|
||||
p.SendMessage(value + " is not online.");
|
||||
} else {
|
||||
p.SendMessage(value + " was queued.");
|
||||
Server.queZombie = true;
|
||||
Server.nextZombie = value;
|
||||
}
|
||||
} else if (args[0] == "level") {
|
||||
bool match = false;
|
||||
DirectoryInfo di = new DirectoryInfo("levels/");
|
||||
FileInfo[] fi = di.GetFiles("*.lvl");
|
||||
foreach (FileInfo file in fi) {
|
||||
if (file.Name.Replace(".lvl", "").ToLower() == value.ToLower())
|
||||
match = true;
|
||||
}
|
||||
|
||||
if (match) {
|
||||
p.SendMessage(value + " was queued.");
|
||||
Server.queLevel = true;
|
||||
Server.nextLevel = value.ToLower();
|
||||
} else {
|
||||
p.SendMessage("Level does not exist.");
|
||||
}
|
||||
} else {
|
||||
p.SendMessage("You did not enter a valid option.");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.SendMessage(p, "/queue zombie [name] - Next round [name] will be infected");
|
||||
Player.SendMessage(p, "/queue level [name] - Next round [name] will be the round loaded");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +1,22 @@
|
||||
/*
|
||||
Written by Jack1312
|
||||
|
||||
Copyright 2011 MCGalaxy
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
Copyright 2011 MCGalaxy
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
@ -24,98 +24,57 @@ namespace MCGalaxy.Commands
|
||||
{
|
||||
public override string name { get { return "explode"; } }
|
||||
public override string shortcut { get { return "ex"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public CmdExplode() { }
|
||||
public override void Help(Player p)
|
||||
{
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") { Help(p); return; }
|
||||
string[] args = message.Split(' ');
|
||||
if (!(args.Length == 1 || args.Length == 3)) { Help(p); return; }
|
||||
if (message == "me" && p != null) args[0] = p.name;
|
||||
|
||||
ushort x, y, z;
|
||||
if (args.Length == 1) {
|
||||
Player who = Player.Find(message);
|
||||
if (who == null || who.hidden) {
|
||||
Player.SendMessage(p, "The specified player does not exist!"); return;
|
||||
}
|
||||
if (who.level.physics < 3 || who.level.physics == 5) {
|
||||
Player.SendMessage(p, "The physics on the player's level are not sufficient for exploding."); return;
|
||||
}
|
||||
|
||||
x = (ushort)(who.pos[0] / 32);
|
||||
y = (ushort)(who.pos[1] / 32);
|
||||
z = (ushort)(who.pos[2] / 32);
|
||||
who.level.MakeExplosion(x, y, z, 1);
|
||||
Player.SendMessage(p, who.color + who.DisplayName + Server.DefaultColor + " has been exploded!");
|
||||
} else if (args.Length == 3) {
|
||||
try {
|
||||
x = Convert.ToUInt16(args[0]);
|
||||
y = Convert.ToUInt16(args[1]);
|
||||
z = Convert.ToUInt16(args[2]);
|
||||
} catch {
|
||||
Player.SendMessage(p, "Invalid parameters"); return;
|
||||
}
|
||||
|
||||
Level level = p.level;
|
||||
if (y >= p.level.Height) y = (ushort)(p.level.Height - 1);
|
||||
|
||||
if (p.level.physics < 3 || p.level.physics == 5) {
|
||||
Player.SendMessage(p, "The physics on this level are not sufficient for exploding!"); return;
|
||||
}
|
||||
p.level.MakeExplosion(x, y, z, 1);
|
||||
Player.SendMessage(p, "An explosion was made at (" + x + ", " + y + ", " + z + ").");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.SendMessage(p, "/explode - Satisfying all your exploding needs :)");
|
||||
Player.SendMessage(p, "/explode me - Explodes at your location");
|
||||
Player.SendMessage(p, "/explode [Player] - Explode the specified player");
|
||||
Player.SendMessage(p, "/explode [X] [Y] [Z] - Explode at the specified co-ordinates");
|
||||
|
||||
}
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
if (message == "") { Help(p); return; }
|
||||
int number = message.Split(' ').Length;
|
||||
if (number > 3) { Player.SendMessage(p, "What are you on about?"); return; }
|
||||
if (message == "me")
|
||||
{
|
||||
if (p.level.physics <3)
|
||||
{
|
||||
Player.SendMessage(p, "The physics on this level are not sufficient for exploding!");
|
||||
return;
|
||||
}
|
||||
Command.all.Find("explode").Use(p, p.name);
|
||||
return;
|
||||
}
|
||||
if (number == 1)
|
||||
{
|
||||
if (p != null)
|
||||
{
|
||||
if (p.level.physics < 3)
|
||||
{
|
||||
Player.SendMessage(p, "The physics on this level are not sufficient for exploding!");
|
||||
return;
|
||||
}
|
||||
Player who = Player.Find(message);
|
||||
ushort x = (ushort)(who.pos[0] / 32);
|
||||
ushort y = (ushort)(who.pos[1] / 32);
|
||||
ushort z = (ushort)(who.pos[2] / 32);
|
||||
p.level.MakeExplosion(x, y, z, 1);
|
||||
Player.SendMessage(p, who.color + who.DisplayName + Server.DefaultColor + " has been exploded!");
|
||||
return;
|
||||
}
|
||||
Player.SendMessage(p, "The specified player does not exist!");
|
||||
return;
|
||||
}
|
||||
if (number == 3)
|
||||
{
|
||||
{
|
||||
byte b = Block.Zero;
|
||||
ushort x = 0; ushort y = 0; ushort z = 0;
|
||||
|
||||
x = (ushort)(p.pos[0] / 32);
|
||||
y = (ushort)((p.pos[1] / 32) - 1);
|
||||
z = (ushort)(p.pos[2] / 32);
|
||||
|
||||
try
|
||||
{
|
||||
switch (message.Split(' ').Length)
|
||||
{
|
||||
case 0: b = Block.rock; break;
|
||||
case 1: b = Block.Byte(message); break;
|
||||
case 3:
|
||||
x = Convert.ToUInt16(message.Split(' ')[0]);
|
||||
y = Convert.ToUInt16(message.Split(' ')[1]);
|
||||
z = Convert.ToUInt16(message.Split(' ')[2]);
|
||||
break;
|
||||
case 4:
|
||||
b = Block.Byte(message.Split(' ')[0]);
|
||||
x = Convert.ToUInt16(message.Split(' ')[1]);
|
||||
y = Convert.ToUInt16(message.Split(' ')[2]);
|
||||
z = Convert.ToUInt16(message.Split(' ')[3]);
|
||||
break;
|
||||
default: Player.SendMessage(p, "Invalid parameters"); return;
|
||||
}
|
||||
}
|
||||
catch { Player.SendMessage(p, "Invalid parameters"); return; }
|
||||
|
||||
Level level = p.level;
|
||||
|
||||
if (y >= p.level.Height) y = (ushort)(p.level.Height - 1);
|
||||
|
||||
if (p.level.physics < 3)
|
||||
{
|
||||
Player.SendMessage(p, "The physics on this level are not sufficient for exploding!");
|
||||
return;
|
||||
}
|
||||
p.level.MakeExplosion(x, y, z, 1);
|
||||
Player.SendMessage(p, "An explosion was made at (" + x + ", " + y + ", " + z + ").");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy)
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.osedu.org/licenses/ECL-2.0
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System.IO;
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdQueue : Command
|
||||
{
|
||||
public override string name { get { return "queue"; } }
|
||||
public override string shortcut { get { return "qz"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public CmdQueue() { }
|
||||
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
int number = message.Split(' ').Length;
|
||||
if (number > 2) { Help(p); return; }
|
||||
if (number == 2)
|
||||
{
|
||||
Server.s.Log(message);
|
||||
string t = message.Split(' ')[0];
|
||||
string s = message.Split(' ')[1];
|
||||
if (t == "zombie")
|
||||
{
|
||||
bool asdfasdf = false;
|
||||
Player.players.ForEach(delegate(Player player)
|
||||
{
|
||||
if (player.name == s)
|
||||
{
|
||||
p.SendMessage(s + " was queued.");
|
||||
Server.queZombie = true;
|
||||
Server.nextZombie = s;
|
||||
asdfasdf = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (!asdfasdf)
|
||||
{
|
||||
p.SendMessage(s + " is not online.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (t == "level")
|
||||
{
|
||||
bool yes = false;
|
||||
DirectoryInfo di = new DirectoryInfo("levels/");
|
||||
FileInfo[] fi = di.GetFiles("*.lvl");
|
||||
foreach (FileInfo file in fi)
|
||||
{
|
||||
if (file.Name.Replace(".lvl", "").ToLower().Equals(s.ToLower()))
|
||||
{
|
||||
yes = true;
|
||||
}
|
||||
}
|
||||
if (yes)
|
||||
{
|
||||
p.SendMessage(s + " was queued.");
|
||||
Server.queLevel = true;
|
||||
Server.nextLevel = s.ToLower();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.SendMessage("Level does not exist.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p.SendMessage("You did not enter a valid option.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Help(Player p)
|
||||
{
|
||||
Player.SendMessage(p, "/queue zombie [name] - Next round [name] will be infected");
|
||||
Player.SendMessage(p, "/queue level [name] - Next round [name] will be the round loaded");
|
||||
}
|
||||
}
|
||||
}
|
@ -176,21 +176,18 @@ namespace MCGalaxy.Commands
|
||||
|
||||
Thread gunThread = new Thread(new ThreadStart(delegate
|
||||
{
|
||||
ushort startX = (ushort)(p.pos[0] / 32);
|
||||
ushort startY = (ushort)(p.pos[1] / 32);
|
||||
ushort startZ = (ushort)(p.pos[2] / 32);
|
||||
pos.x = startX;
|
||||
pos.y = startY;
|
||||
pos.z = startZ;
|
||||
pos.x = (ushort)(p.pos[0] / 32);
|
||||
pos.y = (ushort)(p.pos[1] / 32);
|
||||
pos.z = (ushort)(p.pos[2] / 32);
|
||||
|
||||
int total = 0;
|
||||
List<FillPos> buffer = new List<FillPos>(2);
|
||||
|
||||
while (true)
|
||||
{
|
||||
startX = (ushort)(p.pos[0] / 32);
|
||||
startY = (ushort)(p.pos[1] / 32);
|
||||
startZ = (ushort)(p.pos[2] / 32);
|
||||
ushort startX = (ushort)(p.pos[0] / 32);
|
||||
ushort startY = (ushort)(p.pos[1] / 32);
|
||||
ushort startZ = (ushort)(p.pos[2] / 32);
|
||||
|
||||
total++;
|
||||
double a = Math.Sin(((double)(128 - p.rot[0]) / 256) * 2 * Math.PI);
|
||||
@ -348,7 +345,7 @@ namespace MCGalaxy.Commands
|
||||
if (previous.Count > 12)
|
||||
{
|
||||
p.level.Blockchange(previous[0].x, previous[0].y, previous[0].z, Block.air);
|
||||
previous.Remove(previous[0]);
|
||||
previous.RemoveAt(0);
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
@ -170,6 +170,7 @@
|
||||
<Compile Include="Commands\Economy\CmdGive.cs" />
|
||||
<Compile Include="Commands\Economy\CmdMoney.cs" />
|
||||
<Compile Include="Commands\Economy\CmdPay.cs" />
|
||||
<Compile Include="Commands\Fun\CmdAlive.cs" />
|
||||
<Compile Include="Commands\Fun\CmdCountdown.cs" />
|
||||
<Compile Include="Commands\Fun\CmdCtf.cs" />
|
||||
<Compile Include="Commands\Fun\CmdDisinfect.cs" />
|
||||
@ -178,6 +179,7 @@
|
||||
<Compile Include="Commands\Fun\CmdInfect.cs" />
|
||||
<Compile Include="Commands\Fun\CmdInfected.cs" />
|
||||
<Compile Include="Commands\Fun\CmdLavaSurvival.cs" />
|
||||
<Compile Include="Commands\Fun\CmdQueue.cs" />
|
||||
<Compile Include="Commands\Fun\CmdTntWars.cs" />
|
||||
<Compile Include="Commands\Fun\CmdZombieGame.cs" />
|
||||
<Compile Include="Commands\Fun\CmdZombieSpawn.cs" />
|
||||
@ -219,7 +221,6 @@
|
||||
<Compile Include="Commands\Information\CmdWhoNick.cs" />
|
||||
<Compile Include="Commands\Information\CmdWhowas.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdAka.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdAlive.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdAllowGuns.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdBan.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdBanEdit.cs" />
|
||||
@ -264,7 +265,6 @@
|
||||
<Compile Include="Commands\Moderation\CmdPossess.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdPromote.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdPUnload.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdQueue.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdRankInfo.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdReferee.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdReloadControllers.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user