mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Now /ride just makes you not killed by train blocks, rather than invincible alltogether.
This commit is contained in:
parent
0be654b006
commit
3be8c02faa
@ -59,6 +59,7 @@ namespace MCGalaxy {
|
|||||||
walkthroughHandlers[Block.air_switch] = WalkthroughBehaviour.Door;
|
walkthroughHandlers[Block.air_switch] = WalkthroughBehaviour.Door;
|
||||||
walkthroughHandlers[Block.water_door] = WalkthroughBehaviour.Door;
|
walkthroughHandlers[Block.water_door] = WalkthroughBehaviour.Door;
|
||||||
walkthroughHandlers[Block.lava_door] = WalkthroughBehaviour.Door;
|
walkthroughHandlers[Block.lava_door] = WalkthroughBehaviour.Door;
|
||||||
|
walkthroughHandlers[Block.train] = WalkthroughBehaviour.Train;
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
if (Props[i].IsMessageBlock) {
|
if (Props[i].IsMessageBlock) {
|
||||||
|
@ -21,9 +21,18 @@ using System.Data;
|
|||||||
using MCGalaxy.SQL;
|
using MCGalaxy.SQL;
|
||||||
|
|
||||||
namespace MCGalaxy.BlockBehaviour {
|
namespace MCGalaxy.BlockBehaviour {
|
||||||
|
|
||||||
internal static class WalkthroughBehaviour {
|
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) {
|
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;
|
if (checkPos && p.level.PosToInt(x, y, z) == p.lastWalkthrough) return true;
|
||||||
p.RevertBlock(x, y, z);
|
p.RevertBlock(x, y, z);
|
||||||
@ -107,11 +116,6 @@ namespace MCGalaxy.BlockBehaviour {
|
|||||||
return true;
|
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 = { " |/" };
|
static string[] sep = { " |/" };
|
||||||
const StringSplitOptions opts = StringSplitOptions.RemoveEmptyEntries;
|
const StringSplitOptions opts = StringSplitOptions.RemoveEmptyEntries;
|
||||||
static List<string> empty = new List<string>();
|
static List<string> empty = new List<string>();
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
namespace MCGalaxy.Commands
|
namespace MCGalaxy.Commands {
|
||||||
{
|
public sealed class CmdRide : Command {
|
||||||
public sealed class CmdRide : Command
|
|
||||||
{
|
|
||||||
public override string name { get { return "ride"; } }
|
public override string name { get { return "ride"; } }
|
||||||
public override string shortcut { get { return ""; } }
|
public override string shortcut { get { return ""; } }
|
||||||
public override string type { get { return CommandTypes.Other; } }
|
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++)
|
for (ushort zz = (ushort)(z - 1); zz <= z + 1; zz++)
|
||||||
{
|
{
|
||||||
if (p.level.GetTile(xx, yy, zz) != Block.train) continue;
|
if (p.level.GetTile(xx, yy, zz) != Block.train) continue;
|
||||||
p.invincible = true; p.trainGrab = true;
|
p.trainGrab = true;
|
||||||
byte yaw = 0, pitch = 0;
|
byte yaw = 0, pitch = 0;
|
||||||
|
|
||||||
if (y - yy == -1) pitch = 240;
|
if (y - yy == -1) pitch = 240;
|
||||||
@ -76,7 +74,6 @@ namespace MCGalaxy.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
Thread.Sleep(3);
|
Thread.Sleep(3);
|
||||||
p.invincible = false;
|
|
||||||
p.trainGrab = false;
|
p.trainGrab = false;
|
||||||
skip:
|
skip:
|
||||||
;
|
;
|
||||||
@ -84,8 +81,8 @@ namespace MCGalaxy.Commands
|
|||||||
|
|
||||||
Player.Message(p, "Dismounted");
|
Player.Message(p, "Dismounted");
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
p.invincible = false;
|
|
||||||
p.trainGrab = false;
|
p.trainGrab = false;
|
||||||
|
p.onTrain = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
@ -830,6 +830,7 @@ return;
|
|||||||
if (!immediate && lastDeath.AddSeconds(2) > DateTime.UtcNow) return;
|
if (!immediate && lastDeath.AddSeconds(2) > DateTime.UtcNow) return;
|
||||||
if (!level.Killer || invincible || hidden) 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);
|
ushort x = (ushort)(pos[0] / 32), y = (ushort)(pos[1] / 32), z = (ushort)(pos[2] / 32);
|
||||||
string deathMsg = Block.Props[b].DeathMessage;
|
string deathMsg = Block.Props[b].DeathMessage;
|
||||||
if (deathMsg != null) Chat.GlobalChatLevel(this, String.Format(deathMsg, ColoredName), false);
|
if (deathMsg != null) Chat.GlobalChatLevel(this, String.Format(deathMsg, ColoredName), false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user