Now /ride just makes you not killed by train blocks, rather than invincible alltogether.

This commit is contained in:
UnknownShadow200 2016-07-25 22:22:39 +10:00
parent 0be654b006
commit 3be8c02faa
4 changed files with 17 additions and 14 deletions

View File

@ -59,6 +59,7 @@ namespace MCGalaxy {
walkthroughHandlers[Block.air_switch] = WalkthroughBehaviour.Door;
walkthroughHandlers[Block.water_door] = WalkthroughBehaviour.Door;
walkthroughHandlers[Block.lava_door] = WalkthroughBehaviour.Door;
walkthroughHandlers[Block.train] = WalkthroughBehaviour.Train;
for (int i = 0; i < 256; i++) {
if (Props[i].IsMessageBlock) {

View File

@ -20,10 +20,19 @@ using System.Collections.Generic;
using System.Data;
using MCGalaxy.SQL;
namespace MCGalaxy.BlockBehaviour {
namespace MCGalaxy.BlockBehaviour {
internal static class WalkthroughBehaviour {
internal static bool Door(Player p, byte block, ushort x, ushort y, ushort z) {
p.level.Blockchange(x, y, z, Block.DoorAirs(block));
return true;
}
internal static bool Train(Player p, byte block, ushort x, ushort y, ushort z) {
if (!p.onTrain) p.HandleDeath(Block.train);
return true;
}
internal static bool Portal(Player p, byte block, ushort x, ushort y, ushort z, bool checkPos) {
if (checkPos && p.level.PosToInt(x, y, z) == p.lastWalkthrough) return true;
p.RevertBlock(x, y, z);
@ -107,11 +116,6 @@ namespace MCGalaxy.BlockBehaviour {
return true;
}
internal static bool Door(Player p, byte block, ushort x, ushort y, ushort z) {
p.level.Blockchange(x, y, z, Block.DoorAirs(block));
return true;
}
static string[] sep = { " |/" };
const StringSplitOptions opts = StringSplitOptions.RemoveEmptyEntries;
static List<string> empty = new List<string>();

View File

@ -16,10 +16,8 @@
permissions and limitations under the Licenses.
*/
using System.Threading;
namespace MCGalaxy.Commands
{
public sealed class CmdRide : Command
{
namespace MCGalaxy.Commands {
public sealed class CmdRide : Command {
public override string name { get { return "ride"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Other; } }
@ -48,7 +46,7 @@ namespace MCGalaxy.Commands
for (ushort zz = (ushort)(z - 1); zz <= z + 1; zz++)
{
if (p.level.GetTile(xx, yy, zz) != Block.train) continue;
p.invincible = true; p.trainGrab = true;
p.trainGrab = true;
byte yaw = 0, pitch = 0;
if (y - yy == -1) pitch = 240;
@ -76,7 +74,6 @@ namespace MCGalaxy.Commands
}
Thread.Sleep(3);
p.invincible = false;
p.trainGrab = false;
skip:
;
@ -84,8 +81,8 @@ namespace MCGalaxy.Commands
Player.Message(p, "Dismounted");
Thread.Sleep(1000);
p.invincible = false;
p.trainGrab = false;
p.onTrain = false;
}
public override void Help(Player p) {

View File

@ -830,6 +830,7 @@ return;
if (!immediate && lastDeath.AddSeconds(2) > DateTime.UtcNow) return;
if (!level.Killer || invincible || hidden) return;
onTrain = false; trainGrab = false;
ushort x = (ushort)(pos[0] / 32), y = (ushort)(pos[1] / 32), z = (ushort)(pos[2] / 32);
string deathMsg = Block.Props[b].DeathMessage;
if (deathMsg != null) Chat.GlobalChatLevel(this, String.Format(deathMsg, ColoredName), false);