Fix turning off /ride instantly killing you by the train you just dismounted. (Thanks peace_out_man)

This commit is contained in:
UnknownShadow200 2016-09-12 13:12:18 +10:00
parent c31d60a951
commit 4076a8f9d3
5 changed files with 7 additions and 6 deletions

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.BlockBehaviour {
}
internal static bool Train(Player p, byte block, ushort x, ushort y, ushort z) {
if (!p.onTrain) p.HandleDeath(Block.train);
if (!p.trainInvincible) p.HandleDeath(Block.train);
return true;
}

View File

@ -36,6 +36,7 @@ namespace MCGalaxy.Commands {
}
void DoRide(Player p) {
p.trainInvincible = true;
while (p.onTrain) {
Thread.Sleep(10);
ushort x = (ushort)(p.pos[0] / 32);
@ -80,10 +81,10 @@ namespace MCGalaxy.Commands {
;
}
p.trainGrab = false;
Player.Message(p, "Dismounted");
Thread.Sleep(1000);
p.trainGrab = false;
p.onTrain = false;
p.trainInvincible = false;
}
public override void Help(Player p) {

View File

@ -115,7 +115,7 @@ namespace MCGalaxy {
/// <summary> Save givenList group </summary>
/// <param name="givenList">The list of groups to save</param>
public static void SaveGroups(List<Group> givenList) {
using (CP437Writer w = new CP437Writer("properties/ranks.properties")) {
using (CP437Writer w = new CP437Writer(filename)) {
w.WriteLine("#Version 3");
w.WriteLine("#RankName = string");
w.WriteLine("#\tThe name of the rank, use capitalization.");

View File

@ -136,7 +136,7 @@ namespace MCGalaxy {
public string storedMessage = "";
public bool trainGrab = false;
public bool onTrain = false;
public bool onTrain = false, trainInvincible = false;
public bool allowTnt = true;
public bool frozen = false;

View File

@ -396,7 +396,7 @@ return;
if (!immediate && lastDeath.AddSeconds(2) > DateTime.UtcNow) return;
if (!level.Killer || invincible || hidden) return;
onTrain = false; trainGrab = false;
onTrain = false; trainInvincible = 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);