mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 22:26:09 +08:00
varregion: any conversions of use of Constants.RegionSize converted into
Util.cs routines to convert region coords to and from world coords or handles.
This commit is contained in:
@@ -2351,7 +2351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
//
|
||||
// This workaround is to prevent silent failure of this function.
|
||||
// According to the specification on the SL Wiki, providing a position outside of the
|
||||
if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize)
|
||||
if (pos.x < 0 || pos.x > World.RegionInfo.RegionSizeX || pos.y < 0 || pos.y > World.RegionInfo.RegionSizeY)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -2361,9 +2361,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.ParentGroup.IsAttachment || // return FALSE if attachment
|
||||
(
|
||||
pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region.
|
||||
pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region.
|
||||
pos.x > (World.RegionInfo.RegionSizeX + 10) || // return FALSE if more than 10 meters into a east-adjacent region.
|
||||
pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region.
|
||||
pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region.
|
||||
pos.y > (World.RegionInfo.RegionSizeY + 10) || // return FALSE if more than 10 meters into a north-adjacent region.
|
||||
pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m
|
||||
)
|
||||
)
|
||||
@@ -4654,10 +4654,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
DataserverPlugin.RegisterRequest(m_host.LocalId,
|
||||
m_item.ItemID, item.AssetID.ToString());
|
||||
|
||||
Vector3 region = new Vector3(
|
||||
World.RegionInfo.RegionLocX * Constants.RegionSize,
|
||||
World.RegionInfo.RegionLocY * Constants.RegionSize,
|
||||
0);
|
||||
Vector3 region = new Vector3(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0);
|
||||
|
||||
World.AssetService.Get(item.AssetID.ToString(), this,
|
||||
delegate(string i, object sender, AssetBase a)
|
||||
@@ -5948,7 +5945,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_Vector llGetRegionCorner()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return new LSL_Vector(World.RegionInfo.RegionLocX * Constants.RegionSize, World.RegionInfo.RegionLocY * Constants.RegionSize, 0);
|
||||
return new LSL_Vector(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -6103,7 +6100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
LSL_Float mag;
|
||||
if (dir.x > 0)
|
||||
{
|
||||
mag = (Constants.RegionSize - pos.x) / dir.x;
|
||||
mag = (World.RegionInfo.RegionSizeX - pos.x) / dir.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6114,7 +6111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
edge.y = pos.y + (dir.y * mag);
|
||||
|
||||
if (edge.y > Constants.RegionSize || edge.y < 0)
|
||||
if (edge.y > World.RegionInfo.RegionSizeY || edge.y < 0)
|
||||
{
|
||||
// Y goes out of bounds first
|
||||
edge.y = dir.y / Math.Abs(dir.y);
|
||||
|
||||
@@ -459,7 +459,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0)
|
||||
if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0)
|
||||
OSSLError("osSetTerrainHeight: Coordinate out of bounds");
|
||||
|
||||
if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0)))
|
||||
@@ -489,7 +489,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
private LSL_Float GetTerrainHeight(int x, int y)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0)
|
||||
if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0)
|
||||
OSSLError("osGetTerrainHeight: Coordinate out of bounds");
|
||||
|
||||
return World.Heightmap[x, y];
|
||||
@@ -823,7 +823,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
private void TeleportAgent(string agent, int regionX, int regionY,
|
||||
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
|
||||
{
|
||||
ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
|
||||
ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY);
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID agentId = new UUID();
|
||||
@@ -3024,7 +3024,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
else
|
||||
{
|
||||
return new LSL_Vector((float)Constants.RegionSize, (float)Constants.RegionSize, Constants.RegionHeight);
|
||||
return new LSL_Vector((float)World.RegionInfo.RegionSizeX,
|
||||
(float)World.RegionInfo.RegionSizeY,
|
||||
(float)World.RegionInfo.RegionSizeZ );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -708,18 +708,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
}
|
||||
private void Save()
|
||||
{
|
||||
/* Remove temporarily until we have a handle to the region size
|
||||
if (Position.x > ((int)Constants.RegionSize - 1))
|
||||
Position.x = ((int)Constants.RegionSize - 1);
|
||||
if (Position.x < 0)
|
||||
Position.x = 0;
|
||||
if (Position.y > ((int)Constants.RegionSize - 1))
|
||||
Position.y = ((int)Constants.RegionSize - 1);
|
||||
*/
|
||||
if (Position.x < 0)
|
||||
Position.x = 0;
|
||||
if (Position.y < 0)
|
||||
Position.y = 0;
|
||||
if (Position.z > 768)
|
||||
Position.z = 768;
|
||||
if (Position.z < 0)
|
||||
Position.z = 0;
|
||||
if (Position.z > Constants.RegionHeight)
|
||||
Position.z = Constants.RegionHeight;
|
||||
prim.OSSL.llSetPos(Position);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user