Fixed Flawed Link Redirection

Fixed the way in which we handle redirecting links to blacklisted
dimensions. The previous method always converted links into safe exits.
This lead to strange situations that could be seen as bugs. For
instance, using a dungeon entrance in a root dimension would generate an
exit door and a supporting platform directly above the entrance door.
That also meant that any visited dungeons would be unusable if they were
reset.

We now do different things depending on the location of the link and its
type. If the link is a dungeon link, then its destination is reset to
allow a new dungeon to form. For other link types, if the link is in a
pocket dimension, then it becomes a safe exit link, because it could be
the only way out. If it's in a root dimension, then there are no
reasonable destinations, so the teleport request is cancelled.
This commit is contained in:
SenseiKiwi 2014-07-05 21:28:10 -04:00
parent 100fa38c52
commit 06cf72f9f7

View file

@ -484,10 +484,31 @@ public class DDTeleporter
{
if (PocketManager.isBlackListed(link.destination().getDimension()))
{
// Overwrite this link to a blacklisted destination with a safe exit link
// We don't need to change 'link' to a different reference.
// NewDimData will overwrite the existing link in-place.
PocketManager.getDimensionData(link.source().getDimension()).createLink(link.source(), LinkTypes.SAFE_EXIT, link.orientation());
// This link leads to a dimension that has been blacklisted.
// That means that it was a pocket and it was deleted.
// Depending on the link type, we must overwrite it or cancel
// the teleport operation. We don't need to assign 'link' with
// a different value. NewDimData will overwrite it in-place.
NewDimData start = PocketManager.getDimensionData(link.source().getDimension());
if (link.linkType() == LinkTypes.DUNGEON)
{
// Ovewrite the link into a dungeon link with no destination
start.createLink(link.source(), LinkTypes.DUNGEON, link.orientation());
}
else
{
if (start.isPocketDimension())
{
// Ovewrite the link into a safe exit link, because
// this could be the only way out from a pocket.
start.createLink(link.source(), LinkTypes.SAFE_EXIT, link.orientation());
}
else
{
// Cancel the teleport attempt
return false;
}
}
}
else
{