diff options
author | Robert Adams | 2015-03-29 14:25:12 -0700 |
---|---|---|
committer | Robert Adams | 2015-03-29 14:25:12 -0700 |
commit | 07dead7dcb8b0f2a27a50748e4a460d9669903fc (patch) | |
tree | b61c3d892e83d36fece40e7735c5d97e64b9020f /OpenSim/Region/ScriptEngine | |
parent | varregion: add varregion and TerrainData use in LLClientView. (diff) | |
download | opensim-SC_OLD-07dead7dcb8b0f2a27a50748e4a460d9669903fc.zip opensim-SC_OLD-07dead7dcb8b0f2a27a50748e4a460d9669903fc.tar.gz opensim-SC_OLD-07dead7dcb8b0f2a27a50748e4a460d9669903fc.tar.bz2 opensim-SC_OLD-07dead7dcb8b0f2a27a50748e4a460d9669903fc.tar.xz |
varregion: any conversions of use of Constants.RegionSize converted into
Util.cs routines to convert region coords to and from world coords or handles.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
3 files changed, 19 insertions, 18 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a5d8292..7d5c750 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2351,7 +2351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2351 | // | 2351 | // |
2352 | // This workaround is to prevent silent failure of this function. | 2352 | // This workaround is to prevent silent failure of this function. |
2353 | // According to the specification on the SL Wiki, providing a position outside of the | 2353 | // According to the specification on the SL Wiki, providing a position outside of the |
2354 | if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize) | 2354 | if (pos.x < 0 || pos.x > World.RegionInfo.RegionSizeX || pos.y < 0 || pos.y > World.RegionInfo.RegionSizeY) |
2355 | { | 2355 | { |
2356 | return 0; | 2356 | return 0; |
2357 | } | 2357 | } |
@@ -2361,9 +2361,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2361 | m_host.ParentGroup.IsAttachment || // return FALSE if attachment | 2361 | m_host.ParentGroup.IsAttachment || // return FALSE if attachment |
2362 | ( | 2362 | ( |
2363 | pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. | 2363 | pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. |
2364 | pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region. | 2364 | pos.x > (World.RegionInfo.RegionSizeX + 10) || // return FALSE if more than 10 meters into a east-adjacent region. |
2365 | pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. | 2365 | pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. |
2366 | pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region. | 2366 | pos.y > (World.RegionInfo.RegionSizeY + 10) || // return FALSE if more than 10 meters into a north-adjacent region. |
2367 | pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m | 2367 | pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m |
2368 | ) | 2368 | ) |
2369 | ) | 2369 | ) |
@@ -4654,10 +4654,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4654 | DataserverPlugin.RegisterRequest(m_host.LocalId, | 4654 | DataserverPlugin.RegisterRequest(m_host.LocalId, |
4655 | m_item.ItemID, item.AssetID.ToString()); | 4655 | m_item.ItemID, item.AssetID.ToString()); |
4656 | 4656 | ||
4657 | Vector3 region = new Vector3( | 4657 | Vector3 region = new Vector3(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0); |
4658 | World.RegionInfo.RegionLocX * Constants.RegionSize, | ||
4659 | World.RegionInfo.RegionLocY * Constants.RegionSize, | ||
4660 | 0); | ||
4661 | 4658 | ||
4662 | World.AssetService.Get(item.AssetID.ToString(), this, | 4659 | World.AssetService.Get(item.AssetID.ToString(), this, |
4663 | delegate(string i, object sender, AssetBase a) | 4660 | delegate(string i, object sender, AssetBase a) |
@@ -5948,7 +5945,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5948 | public LSL_Vector llGetRegionCorner() | 5945 | public LSL_Vector llGetRegionCorner() |
5949 | { | 5946 | { |
5950 | m_host.AddScriptLPS(1); | 5947 | m_host.AddScriptLPS(1); |
5951 | return new LSL_Vector(World.RegionInfo.RegionLocX * Constants.RegionSize, World.RegionInfo.RegionLocY * Constants.RegionSize, 0); | 5948 | return new LSL_Vector(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0); |
5952 | } | 5949 | } |
5953 | 5950 | ||
5954 | /// <summary> | 5951 | /// <summary> |
@@ -6103,7 +6100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6103 | LSL_Float mag; | 6100 | LSL_Float mag; |
6104 | if (dir.x > 0) | 6101 | if (dir.x > 0) |
6105 | { | 6102 | { |
6106 | mag = (Constants.RegionSize - pos.x) / dir.x; | 6103 | mag = (World.RegionInfo.RegionSizeX - pos.x) / dir.x; |
6107 | } | 6104 | } |
6108 | else | 6105 | else |
6109 | { | 6106 | { |
@@ -6114,7 +6111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6114 | 6111 | ||
6115 | edge.y = pos.y + (dir.y * mag); | 6112 | edge.y = pos.y + (dir.y * mag); |
6116 | 6113 | ||
6117 | if (edge.y > Constants.RegionSize || edge.y < 0) | 6114 | if (edge.y > World.RegionInfo.RegionSizeY || edge.y < 0) |
6118 | { | 6115 | { |
6119 | // Y goes out of bounds first | 6116 | // Y goes out of bounds first |
6120 | edge.y = dir.y / Math.Abs(dir.y); | 6117 | edge.y = dir.y / Math.Abs(dir.y); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index d2a5980..01d90e7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -459,7 +459,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
459 | { | 459 | { |
460 | m_host.AddScriptLPS(1); | 460 | m_host.AddScriptLPS(1); |
461 | 461 | ||
462 | if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) | 462 | if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) |
463 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); | 463 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); |
464 | 464 | ||
465 | if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) | 465 | if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) |
@@ -489,7 +489,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
489 | private LSL_Float GetTerrainHeight(int x, int y) | 489 | private LSL_Float GetTerrainHeight(int x, int y) |
490 | { | 490 | { |
491 | m_host.AddScriptLPS(1); | 491 | m_host.AddScriptLPS(1); |
492 | if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) | 492 | if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) |
493 | OSSLError("osGetTerrainHeight: Coordinate out of bounds"); | 493 | OSSLError("osGetTerrainHeight: Coordinate out of bounds"); |
494 | 494 | ||
495 | return World.Heightmap[x, y]; | 495 | return World.Heightmap[x, y]; |
@@ -823,7 +823,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
823 | private void TeleportAgent(string agent, int regionX, int regionY, | 823 | private void TeleportAgent(string agent, int regionX, int regionY, |
824 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | 824 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) |
825 | { | 825 | { |
826 | ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); | 826 | ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY); |
827 | 827 | ||
828 | m_host.AddScriptLPS(1); | 828 | m_host.AddScriptLPS(1); |
829 | UUID agentId = new UUID(); | 829 | UUID agentId = new UUID(); |
@@ -3024,7 +3024,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3024 | } | 3024 | } |
3025 | else | 3025 | else |
3026 | { | 3026 | { |
3027 | return new LSL_Vector((float)Constants.RegionSize, (float)Constants.RegionSize, Constants.RegionHeight); | 3027 | return new LSL_Vector((float)World.RegionInfo.RegionSizeX, |
3028 | (float)World.RegionInfo.RegionSizeY, | ||
3029 | (float)World.RegionInfo.RegionSizeZ ); | ||
3028 | } | 3030 | } |
3029 | } | 3031 | } |
3030 | 3032 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 9cf7b35..8666421 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -708,18 +708,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
708 | } | 708 | } |
709 | private void Save() | 709 | private void Save() |
710 | { | 710 | { |
711 | /* Remove temporarily until we have a handle to the region size | ||
711 | if (Position.x > ((int)Constants.RegionSize - 1)) | 712 | if (Position.x > ((int)Constants.RegionSize - 1)) |
712 | Position.x = ((int)Constants.RegionSize - 1); | 713 | Position.x = ((int)Constants.RegionSize - 1); |
713 | if (Position.x < 0) | ||
714 | Position.x = 0; | ||
715 | if (Position.y > ((int)Constants.RegionSize - 1)) | 714 | if (Position.y > ((int)Constants.RegionSize - 1)) |
716 | Position.y = ((int)Constants.RegionSize - 1); | 715 | Position.y = ((int)Constants.RegionSize - 1); |
716 | */ | ||
717 | if (Position.x < 0) | ||
718 | Position.x = 0; | ||
717 | if (Position.y < 0) | 719 | if (Position.y < 0) |
718 | Position.y = 0; | 720 | Position.y = 0; |
719 | if (Position.z > 768) | ||
720 | Position.z = 768; | ||
721 | if (Position.z < 0) | 721 | if (Position.z < 0) |
722 | Position.z = 0; | 722 | Position.z = 0; |
723 | if (Position.z > Constants.RegionHeight) | ||
724 | Position.z = Constants.RegionHeight; | ||
723 | prim.OSSL.llSetPos(Position); | 725 | prim.OSSL.llSetPos(Position); |
724 | } | 726 | } |
725 | 727 | ||