From 882ee57c4999604d6379a8d1ceb87dab4beae13a Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 14 Sep 2016 08:48:58 +1000 Subject: [PATCH] ZS: Pillaring sprite blocks, or when pillaring in water/lava, should not count towards auto-pillar kick. --- Games/IGame.cs | 2 +- Games/ZombieSurvival/ZombieGame.Game.cs | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Games/IGame.cs b/Games/IGame.cs index aa65ab086..0624ed22a 100644 --- a/Games/IGame.cs +++ b/Games/IGame.cs @@ -26,7 +26,7 @@ namespace MCGalaxy.Games { /// Returns whether this game handed the player manually placing a block. public virtual bool HandlesManualChange(Player p, ushort x, ushort y, ushort z, - byte action, byte tile, byte b) { + byte action, byte block, byte old) { return false; } diff --git a/Games/ZombieSurvival/ZombieGame.Game.cs b/Games/ZombieSurvival/ZombieGame.Game.cs index 5ffe54e0b..967e2071e 100644 --- a/Games/ZombieSurvival/ZombieGame.Game.cs +++ b/Games/ZombieSurvival/ZombieGame.Game.cs @@ -26,26 +26,28 @@ namespace MCGalaxy.Games { public override bool TeleportAllowed { get { return !RoundInProgress; } } public override bool HandlesManualChange(Player p, ushort x, ushort y, ushort z, - byte action, byte tile, byte b) { + byte action, byte block, byte old) { if (!Running || (p.level == null || !p.level.name.CaselessEq(CurLevelName))) return false; if (CurLevel.BuildType == BuildType.NoModify) { p.RevertBlock(x, y, z); return true; - } else if (CurLevel.BuildType == BuildType.ModifyOnly - && p.level.GetTile(x, y, z) == Block.op_air) { + } + if (CurLevel.BuildType == BuildType.ModifyOnly && Block.Props[old].OPBlock) { p.RevertBlock(x, y, z); return true; } if (action == 1 && !CurLevel.Pillaring && !p.Game.Referee) { - if (p.Game.LastY == y - 1 && p.Game.LastX == x && p.Game.LastZ == z ) { + if (NotPillaring(block, old)) { + p.Game.BlocksStacked = 0; + } else if (p.Game.LastY == y - 1 && p.Game.LastX == x && p.Game.LastZ == z ) { p.Game.BlocksStacked++; } else { p.Game.BlocksStacked = 0; } - if (p.Game.BlocksStacked == 2 ) { + if (p.Game.BlocksStacked == 2) { p.SendMessage("You are pillaring! Stop before you get kicked!"); } - if (p.Game.BlocksStacked == 4 ) { + if (p.Game.BlocksStacked == 4) { p.Kick("No pillaring allowed!"); return true; } } @@ -66,6 +68,14 @@ namespace MCGalaxy.Games { return false; } + static bool NotPillaring(byte block, byte old) { + if (block == Block.shrub) return true; + if (block >= Block.yellowflower && block <= Block.redmushroom) return true; + + old = Block.Convert(old); + return old >= Block.water && block <= Block.lavastill; + } + public override bool HandlesMovement(Player p, ushort x, ushort y, ushort z, byte rotX, byte rotY) { if (!Running || (p.level == null || !p.level.name.CaselessEq(CurLevelName))) return false;