Include new Region.ini option for DefaultLandingPoint for teleports with no coords specified.

This is useful when using a Telehub would be to restrictive as it would block landmarks and map teleports. This location is only ever used when no coordinates are provided. If config value not set, the previous default of 128,128 is used.
melanie
AliciaRaven 2016-11-22 15:31:45 +00:00
parent b43717a397
commit 94e48838d5
4 changed files with 69 additions and 0 deletions

View File

@ -176,6 +176,9 @@ namespace OpenSim.Framework
/// </remarks> /// </remarks>
public uint RegionSizeZ = Constants.RegionHeight; public uint RegionSizeZ = Constants.RegionHeight;
// If entering avatar has no specific coords, this is where they land
public Vector3 DefaultLandingPoint = new Vector3(128, 128, 30);
private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>(); private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>();
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote. // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
@ -712,6 +715,19 @@ namespace OpenSim.Framework
m_regionType = config.GetString("RegionType", String.Empty); m_regionType = config.GetString("RegionType", String.Empty);
allKeys.Remove("RegionType"); allKeys.Remove("RegionType");
// Get Default Landing Location (Defaults to 128,128)
string temp_location = config.GetString("DefaultLanding", "<128, 128, 30>");
Vector3 temp_vector;
if (Vector3.TryParse(temp_location, out temp_vector))
DefaultLandingPoint = temp_vector;
else
m_log.ErrorFormat("[RegionInfo]: Unable to parse DefaultLanding for '{0}'. The value given was '{1}'", RegionName, temp_location);
allKeys.Remove("DefaultLanding");
DoDefaultLandingSanityChecks();
#region Prim and map stuff #region Prim and map stuff
m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0);
@ -764,6 +780,48 @@ namespace OpenSim.Framework
} }
} }
// Make sure DefaultLanding is within region borders with a buffer zone 5 meters from borders
private void DoDefaultLandingSanityChecks()
{
// Sanity Check Default Landing
float buffer_zone = 5f;
bool ValuesCapped = false;
// Minimum Positions
if (DefaultLandingPoint.X < 0f)
{
DefaultLandingPoint.X = buffer_zone;
ValuesCapped = true;
}
if (DefaultLandingPoint.Y < 0f)
{
DefaultLandingPoint.Y = buffer_zone;
ValuesCapped = true;
}
// Maximum Positions
if (DefaultLandingPoint.X > RegionSizeX - buffer_zone)
{
DefaultLandingPoint.X = RegionSizeX - buffer_zone;
ValuesCapped = true;
}
if (DefaultLandingPoint.Y > RegionSizeY - buffer_zone)
{
DefaultLandingPoint.Y = RegionSizeY - buffer_zone;
ValuesCapped = true;
}
// Height
if (DefaultLandingPoint.Z < 0f)
DefaultLandingPoint.Z = 0f;
if (ValuesCapped == true)
m_log.WarnFormat("[RegionInfo]: The default landing location for {0} has been capped to {1}", RegionName, DefaultLandingPoint);
}
// Make sure user specified region sizes are sane. // Make sure user specified region sizes are sane.
// Must be multiples of legacy region size (256). // Must be multiples of legacy region size (256).
private void DoRegionSizeSanityChecks() private void DoRegionSizeSanityChecks()

View File

@ -455,6 +455,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
position = emergencyPos; position = emergencyPos;
} }
// Check Default Location (Also See ScenePresence.CompleteMovement)
if (position.X == 128f && position.Y == 128f)
position = sp.Scene.RegionInfo.DefaultLandingPoint;
// TODO: Get proper AVG Height // TODO: Get proper AVG Height
float localHalfAVHeight = 0.8f; float localHalfAVHeight = 0.8f;
if (sp.Appearance != null) if (sp.Appearance != null)

View File

@ -2043,6 +2043,10 @@ namespace OpenSim.Region.Framework.Scenes
look = new Vector3(0.99f, 0.042f, 0); look = new Vector3(0.99f, 0.042f, 0);
} }
// Check Default Location (Also See EntityTransferModule.TeleportAgentWithinRegion)
if (AbsolutePosition.X == 128f && AbsolutePosition.Y == 128f)
AbsolutePosition = Scene.RegionInfo.DefaultLandingPoint;
if (!MakeRootAgent(AbsolutePosition, flying, ref look)) if (!MakeRootAgent(AbsolutePosition, flying, ref look))
{ {
m_log.DebugFormat( m_log.DebugFormat(

View File

@ -31,6 +31,9 @@ ExternalHostName = SYSTEMIP
; SizeX = 512 ; SizeX = 512
; SizeY = 512 ; SizeY = 512
; * Default region landing point used when no teleport coords are specified
; DefaultLanding = <128,128,30>
; * ; *
; * Prim data ; * Prim data
; * This allows limiting the sizes of prims and the region prim count ; * This allows limiting the sizes of prims and the region prim count