From fee26365e33da7350207399922a8d2c13ccc0ecf Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 25 Apr 2016 18:01:29 +1000 Subject: [PATCH] Checkpoint blocks should also save orientation. (Thanks goodlyay) --- Blocks/Behaviour/WalkthroughBehaviour.cs | 2 ++ Commands/other/CmdSpawn.cs | 5 ++++- Player/Player.cs | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Blocks/Behaviour/WalkthroughBehaviour.cs b/Blocks/Behaviour/WalkthroughBehaviour.cs index 744c94b7e..53a0d2b69 100644 --- a/Blocks/Behaviour/WalkthroughBehaviour.cs +++ b/Blocks/Behaviour/WalkthroughBehaviour.cs @@ -83,6 +83,8 @@ namespace MCGalaxy.BlockBehaviour { internal static bool Checkpoint(Player p, byte block, ushort x, ushort y, ushort z) { p.useCheckpointSpawn = true; p.checkpointX = x; p.checkpointY = y; p.checkpointZ = z; + p.checkpointRotX = p.rot[0]; p.checkpointRotY = p.rot[1]; + int index = p.level.PosToInt(x, y, z); if (index != p.lastCheckpointIndex) { int sendY = (p.pos[1] / 32) * 32 + 10; diff --git a/Commands/other/CmdSpawn.cs b/Commands/other/CmdSpawn.cs index 01301dd79..eb5d6c85b 100644 --- a/Commands/other/CmdSpawn.cs +++ b/Commands/other/CmdSpawn.cs @@ -34,6 +34,9 @@ namespace MCGalaxy.Commands { ushort x = (ushort)(16 + (cpSpawn ? p.checkpointX : p.level.spawnx) * 32); ushort y = (ushort)(32 + (cpSpawn ? p.checkpointY : p.level.spawny) * 32); ushort z = (ushort)(16 + (cpSpawn ? p.checkpointZ : p.level.spawnz) * 32); + byte rotX = cpSpawn ? p.checkpointRotX : p.level.rotx; + byte rotY = cpSpawn ? p.checkpointRotY : p.level.roty; + if (!p.Game.Referee && !p.Game.Infected && Server.zombie.RoundInProgress) Server.zombie.InfectPlayer(p); @@ -51,7 +54,7 @@ namespace MCGalaxy.Commands { return; } } - p.SendPos(0xFF, x, y, z, p.level.rotx, p.level.roty); + p.SendPos(0xFF, x, y, z, rotX, rotY); } public override void Help(Player p) { diff --git a/Player/Player.cs b/Player/Player.cs index 10c2984b8..35b41bd8d 100644 --- a/Player/Player.cs +++ b/Player/Player.cs @@ -172,6 +172,7 @@ namespace MCGalaxy { public bool useCheckpointSpawn = false; public int lastCheckpointIndex = -1; public ushort checkpointX, checkpointY, checkpointZ; + public byte checkpointRotX, checkpointRotY; public bool voted = false; public bool flipHead = false; public GameProps Game = new GameProps();