diff --git a/Games/IGame.cs b/Games/IGame.cs
index a1227841e..b39249a90 100644
--- a/Games/IGame.cs
+++ b/Games/IGame.cs
@@ -17,10 +17,13 @@
*/
using System;
-namespace MCGalaxy.Games {
+namespace MCGalaxy {
- public abstract class IGame {
-
-
- }
+ public abstract class IGame {
+
+ public virtual bool HandlesManualChange(Player p, ushort x, ushort y, ushort z,
+ byte action, byte tile, byte b) {
+ return false;
+ }
+ }
}
diff --git a/Games/ZombieGame.Game.cs b/Games/ZombieGame.Game.cs
new file mode 100644
index 000000000..8d6dda341
--- /dev/null
+++ b/Games/ZombieGame.Game.cs
@@ -0,0 +1,56 @@
+/*
+Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/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 {
+
+ public sealed partial class ZombieGame : IGame {
+
+ public override bool HandlesManualChange(Player p, ushort x, ushort y, ushort z,
+ byte action, byte tile, byte b) {
+ if (action == 1 && Server.noPillaring && !p.referee) {
+ if (p.lastYblock == y - 1 && p.lastXblock == x && p.lastZblock == z ) {
+ p.blocksStacked++;
+ } else {
+ p.blocksStacked = 0;
+ }
+
+ if (p.blocksStacked == 2 ) {
+ p.SendMessage("You are pillaring! Stop before you get kicked!");
+ }
+ if (p.blocksStacked == 4 ) {
+ Command.all.Find("kick").Use(null, p.name + " No pillaring allowed!");
+ return true;
+ }
+ }
+ p.lastXblock = x; p.lastYblock = y; p.lastZblock = z;
+
+ if (action == 1 || (action == 0 && p.painting)) {
+ if (p.level.name != Server.zombie.currentLevelName || p.referee) return false;
+
+ if (p.blockCount == 0 ) {
+ p.SendMessage("You have no blocks left.");
+ p.RevertBlock(x, y, z); return true;
+ }
+
+ p.blockCount--;
+ if ((p.blockCount % 10) == 0 || (p.blockCount >= 0 && p.blockCount <= 10)) {
+ p.SendMessage("Blocks Left: " + c.maroon + p.blockCount);
+ }
+ }
+ return false;
+ }
+ }
+}
diff --git a/Games/ZombieGame.cs b/Games/ZombieGame.cs
index b0ae04d1d..3a773081d 100644
--- a/Games/ZombieGame.cs
+++ b/Games/ZombieGame.cs
@@ -26,7 +26,7 @@ using System.Timers;
namespace MCGalaxy
{
- public sealed class ZombieGame
+ public sealed partial class ZombieGame
{
public int amountOfRounds = 0;
public int limitRounds = 0;
diff --git a/MCGalaxy_.csproj b/MCGalaxy_.csproj
index 367f697b2..9e6cbf262 100644
--- a/MCGalaxy_.csproj
+++ b/MCGalaxy_.csproj
@@ -401,6 +401,7 @@
+
diff --git a/Player/Player.cs b/Player/Player.cs
index 06e2d24f9..7e29d436e 100644
--- a/Player/Player.cs
+++ b/Player/Player.cs
@@ -1072,23 +1072,6 @@ namespace MCGalaxy {
extType = type;
type = Block.custom_block;
}
-
- if ( action == 1 && Server.ZombieModeOn && Server.noPillaring ) {
- if ( !referee ) {
- if ( lastYblock == y - 1 && lastXblock == x && lastZblock == z ) {
- blocksStacked++;
- } else {
- blocksStacked = 0;
- }
- if ( blocksStacked == 2 ) {
- SendMessage("You are pillaring! Stop before you get kicked!");
- }
- if ( blocksStacked == 4 ) {
- Command.all.Find("kick").Use(null, name + " No pillaring allowed!");
- }
- }
- }
- lastXblock = x; lastYblock = y; lastZblock = z;
ManualChange(x, y, z, action, type, extType);
} catch ( Exception e ) {
// Don't ya just love it when the server tattles?
@@ -1120,23 +1103,8 @@ namespace MCGalaxy {
RevertBlock(x, y, z); return;
}
- if ( Server.ZombieModeOn && ( action == 1 || ( action == 0 && this.painting ) ) ) {
- if ( Server.zombie != null && this.level.name == Server.zombie.currentLevelName ) {
- if ( blockCount == 0 ) {
- if ( !referee ) {
- SendMessage("You have no blocks left.");
- RevertBlock(x, y, z); return;
- }
- }
-
- if ( !referee ) {
- blockCount--;
- if ( blockCount == 40 || blockCount == 30 || blockCount == 20 || blockCount <= 10 && blockCount >= 0 ) {
- SendMessage("Blocks Left: " + c.maroon + blockCount + Server.DefaultColor);
- }
- }
- }
- }
+ if (Server.ZombieModeOn && Server.zombie != null
+ && Server.zombie.HandlesManualChange(this, x, y, z, action, type, b)) return;
if ( Server.lava.active && Server.lava.HasPlayer(this) && Server.lava.IsPlayerDead(this) ) {
SendMessage("You are out of the round, and cannot build.");