Skip to content

Commit

Permalink
Allow tping to coords and setting portal past 1024, fix falling throu…
Browse files Browse the repository at this point in the history
…gh block when tping to coord just above a block
  • Loading branch information
UnknownShadow200 committed May 20, 2017
1 parent 702ef1b commit 8541f96
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 35 deletions.
52 changes: 24 additions & 28 deletions fCraft/Commands/ModerationCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1414,10 +1414,10 @@ static void UnfreezeHandler(Player player, CommandReader cmd)
Vector3I P = player.World.map.HighestFreeSpace(zone.Bounds.XCentre,
zone.Bounds.YCentre, zone.Bounds.ZCentre);
Position zPos = new Position(P.X * 32 + 16, P.Y * 32 + 16, P.Z * 32 + (51 + 1));
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo((zPos));
player.Message("Teleporting you to zone " + zone.ClassyName);
return;
Expand All @@ -1430,10 +1430,10 @@ static void UnfreezeHandler(Player player, CommandReader cmd)
int z = (player.Position.Z - 51) / 32;
Vector3I P = player.WorldMap.HighestFreeSpace(x, y, z);

if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo(new Position {
X = (P.X * 32 + 16),
Y = (P.Y * 32 + 16),
Expand Down Expand Up @@ -1465,22 +1465,18 @@ static void UnfreezeHandler(Player player, CommandReader cmd)
}
}
}
if (x <= -1024 || x >= 1024 || y <= -1024 || y >= 1024 || z <= -1024 || z >= 1024) {
player.Message("Coordinates are outside the valid range!");

} else {
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo(new Position {
X = (x*32 + 16),
Y = (y*32 + 16),
Z = (z*32 + 48),
R = (byte) rot,
L = (byte) lot
});

if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo(new Position {
X = (x*32 + 16),
Y = (y*32 + 16),
Z = (z*32 + 52),
R = (byte) rot,
L = (byte) lot
});
} else {
CdTeleport.PrintUsage(player);
}
Expand Down Expand Up @@ -1514,11 +1510,11 @@ static void UnfreezeHandler(Player player, CommandReader cmd)
return;
}

if (targetWorld == player.World) {
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
if (targetWorld == player.World) {
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo(target.Position);

} else {
Expand Down
8 changes: 1 addition & 7 deletions fCraft/Commands/WorldCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3678,13 +3678,7 @@ static void WorldClearHandler(Player player, CommandReader cmd)
lot = player.Position.L;
}
}

if (x < 0 || x >= 1024 || y < 0 || y >= 1024 || z < 0 || z >= 1024) {
player.Message("Coordinates are outside the valid range!");
return;
} else {
player.PortalTPPos = new Position(x * 32, y * 32, z * 32, (byte)rot, (byte)lot);
}
player.PortalTPPos = new Position(x * 32, y * 32, z * 32, (byte)rot, (byte)lot);
} else {
player.PortalTPPos = tpWorld.map == null ? new Position(0, 0, 0) : tpWorld.map.Spawn;
}
Expand Down

0 comments on commit 8541f96

Please sign in to comment.