Checkpoint blocks should also save orientation. (Thanks goodlyay)

This commit is contained in:
UnknownShadow200 2016-04-25 18:01:29 +10:00
parent 84080b1fde
commit fee26365e3
3 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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();