Skip to content

Commit 8541f96

Browse files
Allow tping to coords and setting portal past 1024, fix falling through block when tping to coord just above a block
1 parent 702ef1b commit 8541f96

File tree

2 files changed

+25
-35
lines changed

2 files changed

+25
-35
lines changed

fCraft/Commands/ModerationCommands.cs

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,10 +1414,10 @@ private static void TeleportHandler(Player player, CommandReader cmd) {
14141414
Vector3I P = player.World.map.HighestFreeSpace(zone.Bounds.XCentre,
14151415
zone.Bounds.YCentre, zone.Bounds.ZCentre);
14161416
Position zPos = new Position(P.X * 32 + 16, P.Y * 32 + 16, P.Z * 32 + (51 + 1));
1417-
if (player.World != null) {
1418-
player.LastWorld = player.World;
1419-
player.LastPosition = player.Position;
1420-
}
1417+
if (player.World != null) {
1418+
player.LastWorld = player.World;
1419+
player.LastPosition = player.Position;
1420+
}
14211421
player.TeleportTo((zPos));
14221422
player.Message("Teleporting you to zone " + zone.ClassyName);
14231423
return;
@@ -1430,10 +1430,10 @@ private static void TeleportHandler(Player player, CommandReader cmd) {
14301430
int z = (player.Position.Z - 51) / 32;
14311431
Vector3I P = player.WorldMap.HighestFreeSpace(x, y, z);
14321432

1433-
if (player.World != null) {
1434-
player.LastWorld = player.World;
1435-
player.LastPosition = player.Position;
1436-
}
1433+
if (player.World != null) {
1434+
player.LastWorld = player.World;
1435+
player.LastPosition = player.Position;
1436+
}
14371437
player.TeleportTo(new Position {
14381438
X = (P.X * 32 + 16),
14391439
Y = (P.Y * 32 + 16),
@@ -1465,22 +1465,18 @@ private static void TeleportHandler(Player player, CommandReader cmd) {
14651465
}
14661466
}
14671467
}
1468-
if (x <= -1024 || x >= 1024 || y <= -1024 || y >= 1024 || z <= -1024 || z >= 1024) {
1469-
player.Message("Coordinates are outside the valid range!");
1470-
1471-
} else {
1472-
if (player.World != null) {
1473-
player.LastWorld = player.World;
1474-
player.LastPosition = player.Position;
1475-
}
1476-
player.TeleportTo(new Position {
1477-
X = (x*32 + 16),
1478-
Y = (y*32 + 16),
1479-
Z = (z*32 + 48),
1480-
R = (byte) rot,
1481-
L = (byte) lot
1482-
});
1468+
1469+
if (player.World != null) {
1470+
player.LastWorld = player.World;
1471+
player.LastPosition = player.Position;
14831472
}
1473+
player.TeleportTo(new Position {
1474+
X = (x*32 + 16),
1475+
Y = (y*32 + 16),
1476+
Z = (z*32 + 52),
1477+
R = (byte) rot,
1478+
L = (byte) lot
1479+
});
14841480
} else {
14851481
CdTeleport.PrintUsage(player);
14861482
}
@@ -1514,11 +1510,11 @@ private static void TeleportHandler(Player player, CommandReader cmd) {
15141510
return;
15151511
}
15161512

1517-
if (targetWorld == player.World) {
1518-
if (player.World != null) {
1519-
player.LastWorld = player.World;
1520-
player.LastPosition = player.Position;
1521-
}
1513+
if (targetWorld == player.World) {
1514+
if (player.World != null) {
1515+
player.LastWorld = player.World;
1516+
player.LastPosition = player.Position;
1517+
}
15221518
player.TeleportTo(target.Position);
15231519

15241520
} else {

fCraft/Commands/WorldCommands.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3678,13 +3678,7 @@ private static void PortalH(Player player, CommandReader cmd) {
36783678
lot = player.Position.L;
36793679
}
36803680
}
3681-
3682-
if (x < 0 || x >= 1024 || y < 0 || y >= 1024 || z < 0 || z >= 1024) {
3683-
player.Message("Coordinates are outside the valid range!");
3684-
return;
3685-
} else {
3686-
player.PortalTPPos = new Position(x * 32, y * 32, z * 32, (byte)rot, (byte)lot);
3687-
}
3681+
player.PortalTPPos = new Position(x * 32, y * 32, z * 32, (byte)rot, (byte)lot);
36883682
} else {
36893683
player.PortalTPPos = tpWorld.map == null ? new Position(0, 0, 0) : tpWorld.map.Spawn;
36903684
}

0 commit comments

Comments
 (0)