aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs87
1 files changed, 52 insertions, 35 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 264d585..b5f6721 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -24,7 +24,7 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
@@ -50,6 +50,9 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
50using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 50using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
51using OpenSim.Region.ScriptEngine.Interfaces; 51using OpenSim.Region.ScriptEngine.Interfaces;
52using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 52using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
53using OpenSim.Services.Interfaces;
54
55using GridRegion = OpenSim.Services.Interfaces.GridRegion;
53 56
54using AssetLandmark = OpenSim.Framework.AssetLandmark; 57using AssetLandmark = OpenSim.Framework.AssetLandmark;
55 58
@@ -3896,7 +3899,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3896 { 3899 {
3897 // agent must be over the owners land 3900 // agent must be over the owners land
3898 if (m_host.OwnerID == World.LandChannel.GetLandObject( 3901 if (m_host.OwnerID == World.LandChannel.GetLandObject(
3899 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) 3902 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
3900 { 3903 {
3901 presence.ControllingClient.SendTeleportLocationStart(); 3904 presence.ControllingClient.SendTeleportLocationStart();
3902 World.TeleportClientHome(agentId, presence.ControllingClient); 3905 World.TeleportClientHome(agentId, presence.ControllingClient);
@@ -4088,7 +4091,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4088 return; 4091 return;
4089 4092
4090 // Need provisions for Group Owned here 4093 // Need provisions for Group Owned here
4091 if (m_host.OwnerID == targetlandObj.landData.OwnerID || targetlandObj.landData.IsGroupOwned || m_host.OwnerID == targetID) 4094 if (m_host.OwnerID == targetlandObj.LandData.OwnerID ||
4095 targetlandObj.LandData.IsGroupOwned || m_host.OwnerID == targetID)
4092 { 4096 {
4093 pushAllowed = true; 4097 pushAllowed = true;
4094 } 4098 }
@@ -4104,10 +4108,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4104 else 4108 else
4105 { 4109 {
4106 // Parcel push restriction 4110 // Parcel push restriction
4107 if ((targetlandObj.landData.Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject) 4111 if ((targetlandObj.LandData.Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject)
4108 { 4112 {
4109 // Need provisions for Group Owned here 4113 // Need provisions for Group Owned here
4110 if (m_host.OwnerID == targetlandObj.landData.OwnerID || targetlandObj.landData.IsGroupOwned || m_host.OwnerID == targetID) 4114 if (m_host.OwnerID == targetlandObj.LandData.OwnerID ||
4115 targetlandObj.LandData.IsGroupOwned ||
4116 m_host.OwnerID == targetID)
4111 { 4117 {
4112 pushAllowed = true; 4118 pushAllowed = true;
4113 } 4119 }
@@ -4996,6 +5002,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4996 if (end > src.Length) 5002 if (end > src.Length)
4997 end = src.Length; 5003 end = src.Length;
4998 5004
5005 if (stride == 0)
5006 stride = 1;
5007
4999 // There may be one or two ranges to be considered 5008 // There may be one or two ranges to be considered
5000 5009
5001 if (start != end) 5010 if (start != end)
@@ -5022,9 +5031,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5022 // A negative stride reverses the direction of the 5031 // A negative stride reverses the direction of the
5023 // scan producing an inverted list as a result. 5032 // scan producing an inverted list as a result.
5024 5033
5025 if (stride == 0)
5026 stride = 1;
5027
5028 if (stride > 0) 5034 if (stride > 0)
5029 { 5035 {
5030 for (int i = 0; i < src.Length; i += stride) 5036 for (int i = 0; i < src.Length; i += stride)
@@ -5048,7 +5054,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5048 } 5054 }
5049 else 5055 else
5050 { 5056 {
5051 result.Add(src.Data[start]); 5057 if (start%stride == 0)
5058 {
5059 result.Add(src.Data[start]);
5060 }
5052 } 5061 }
5053 5062
5054 return result; 5063 return result;
@@ -5226,12 +5235,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5226 } 5235 }
5227 } 5236 }
5228 5237
5229 List<SimpleRegionInfo> neighbors = World.CommsManager.GridService.RequestNeighbours(World.RegionInfo.RegionLocX, World.RegionInfo.RegionLocY); 5238 List<GridRegion> neighbors = World.GridService.GetNeighbours(World.RegionInfo.ScopeID, World.RegionInfo.RegionID);
5230 5239
5231 uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x; 5240 uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x;
5232 uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y; 5241 uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y;
5233 5242
5234 foreach (SimpleRegionInfo sri in neighbors) 5243 foreach (GridRegion sri in neighbors)
5235 { 5244 {
5236 if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY) 5245 if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY)
5237 return 0; 5246 return 0;
@@ -5436,7 +5445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5436 { 5445 {
5437 // agent must be over the owners land 5446 // agent must be over the owners land
5438 if (m_host.OwnerID == World.LandChannel.GetLandObject( 5447 if (m_host.OwnerID == World.LandChannel.GetLandObject(
5439 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) 5448 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
5440 World.TeleportClientHome(agentId, presence.ControllingClient); 5449 World.TeleportClientHome(agentId, presence.ControllingClient);
5441 } 5450 }
5442 } 5451 }
@@ -5526,7 +5535,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5526 { 5535 {
5527 if (m_host.OwnerID 5536 if (m_host.OwnerID
5528 == World.LandChannel.GetLandObject( 5537 == World.LandChannel.GetLandObject(
5529 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) 5538 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
5530 return 1; 5539 return 1;
5531 } 5540 }
5532 else // object is not an avatar 5541 else // object is not an avatar
@@ -5535,7 +5544,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5535 if (obj != null) 5544 if (obj != null)
5536 if (m_host.OwnerID 5545 if (m_host.OwnerID
5537 == World.LandChannel.GetLandObject( 5546 == World.LandChannel.GetLandObject(
5538 obj.AbsolutePosition.X, obj.AbsolutePosition.Y).landData.OwnerID) 5547 obj.AbsolutePosition.X, obj.AbsolutePosition.Y).LandData.OwnerID)
5539 return 1; 5548 return 1;
5540 } 5549 }
5541 } 5550 }
@@ -5546,7 +5555,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5546 public LSL_String llGetLandOwnerAt(LSL_Vector pos) 5555 public LSL_String llGetLandOwnerAt(LSL_Vector pos)
5547 { 5556 {
5548 m_host.AddScriptLPS(1); 5557 m_host.AddScriptLPS(1);
5549 return World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).landData.OwnerID.ToString(); 5558 return World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).LandData.OwnerID.ToString();
5550 } 5559 }
5551 5560
5552 /// <summary> 5561 /// <summary>
@@ -5615,9 +5624,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5615 ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y); 5624 ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y);
5616 if (parcel != null) 5625 if (parcel != null)
5617 { 5626 {
5618 if (m_host.ObjectOwner == parcel.landData.OwnerID || 5627 if (m_host.ObjectOwner == parcel.LandData.OwnerID ||
5619 (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.landData.GroupID 5628 (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.LandData.GroupID
5620 && parcel.landData.IsGroupOwned) || World.Permissions.IsGod(m_host.OwnerID)) 5629 && parcel.LandData.IsGroupOwned) || World.Permissions.IsGod(m_host.OwnerID))
5621 { 5630 {
5622 av.StandUp(); 5631 av.StandUp();
5623 } 5632 }
@@ -6120,7 +6129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6120 { 6129 {
6121 m_host.AddScriptLPS(1); 6130 m_host.AddScriptLPS(1);
6122 UUID key; 6131 UUID key;
6123 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).landData; 6132 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
6124 if (land.OwnerID == m_host.OwnerID) 6133 if (land.OwnerID == m_host.OwnerID)
6125 { 6134 {
6126 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 6135 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
@@ -6321,9 +6330,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6321 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); 6330 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero);
6322 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); 6331 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
6323 if (xmlRpcRouter != null) 6332 if (xmlRpcRouter != null)
6333 {
6334 string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName;
6335
6324 xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, 6336 xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
6325 m_itemID, String.Format("http://{0}:{1}/", System.Environment.MachineName, 6337 m_itemID, String.Format("http://{0}:{1}/", ExternalHostName,
6326 xmlrpcMod.Port.ToString())); 6338 xmlrpcMod.Port.ToString()));
6339 }
6327 object[] resobj = new object[] 6340 object[] resobj = new object[]
6328 { 6341 {
6329 new LSL_Integer(1), 6342 new LSL_Integer(1),
@@ -7134,7 +7147,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7134 7147
7135 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 7148 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
7136 7149
7137 if (land.landData.OwnerID != m_host.ObjectOwner) 7150 if (land.LandData.OwnerID != m_host.ObjectOwner)
7138 return; 7151 return;
7139 7152
7140 land.SetMusicUrl(url); 7153 land.SetMusicUrl(url);
@@ -7834,8 +7847,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7834 public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) 7847 public LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
7835 { 7848 {
7836 m_host.AddScriptLPS(1); 7849 m_host.AddScriptLPS(1);
7837 NotImplemented("llGetHTTPHeader"); 7850
7838 return String.Empty; 7851 if (m_UrlModule != null)
7852 return m_UrlModule.GetHttpHeader(new UUID(request_id), header);
7853 return String.Empty;
7839 } 7854 }
7840 7855
7841 7856
@@ -8175,7 +8190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8175 8190
8176 string reply = String.Empty; 8191 string reply = String.Empty;
8177 8192
8178 RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); 8193 GridRegion info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
8179 8194
8180 switch (data) 8195 switch (data)
8181 { 8196 {
@@ -8202,7 +8217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8202 ConditionalScriptSleep(1000); 8217 ConditionalScriptSleep(1000);
8203 return UUID.Zero.ToString(); 8218 return UUID.Zero.ToString();
8204 } 8219 }
8205 int access = info.RegionSettings.Maturity; 8220 int access = info.Maturity;
8206 if (access == 0) 8221 if (access == 0)
8207 reply = "PG"; 8222 reply = "PG";
8208 else if (access == 1) 8223 else if (access == 1)
@@ -8391,7 +8406,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8391 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? 8406 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
8392 byte loop = 0; 8407 byte loop = 0;
8393 8408
8394 LandData landData = landObject.landData; 8409 LandData landData = landObject.LandData;
8395 string url = landData.MediaURL; 8410 string url = landData.MediaURL;
8396 string texture = landData.MediaID.ToString(); 8411 string texture = landData.MediaID.ToString();
8397 bool autoAlign = landData.MediaAutoScale != 0; 8412 bool autoAlign = landData.MediaAutoScale != 0;
@@ -8820,7 +8835,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8820 { 8835 {
8821 m_host.AddScriptLPS(1); 8836 m_host.AddScriptLPS(1);
8822 UUID key; 8837 UUID key;
8823 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).landData; 8838 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
8824 if (land.OwnerID == m_host.OwnerID) 8839 if (land.OwnerID == m_host.OwnerID)
8825 { 8840 {
8826 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 8841 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
@@ -8839,7 +8854,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8839 { 8854 {
8840 m_host.AddScriptLPS(1); 8855 m_host.AddScriptLPS(1);
8841 UUID key; 8856 UUID key;
8842 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).landData; 8857 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
8843 if (land.OwnerID == m_host.OwnerID) 8858 if (land.OwnerID == m_host.OwnerID)
8844 { 8859 {
8845 if (UUID.TryParse(avatar, out key)) 8860 if (UUID.TryParse(avatar, out key))
@@ -8861,7 +8876,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8861 { 8876 {
8862 m_host.AddScriptLPS(1); 8877 m_host.AddScriptLPS(1);
8863 UUID key; 8878 UUID key;
8864 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).landData; 8879 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
8865 if (land.OwnerID == m_host.OwnerID) 8880 if (land.OwnerID == m_host.OwnerID)
8866 { 8881 {
8867 if (UUID.TryParse(avatar, out key)) 8882 if (UUID.TryParse(avatar, out key))
@@ -9006,7 +9021,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9006 public LSL_Integer llGetParcelFlags(LSL_Vector pos) 9021 public LSL_Integer llGetParcelFlags(LSL_Vector pos)
9007 { 9022 {
9008 m_host.AddScriptLPS(1); 9023 m_host.AddScriptLPS(1);
9009 return (int)World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).landData.Flags; 9024 return (int)World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).LandData.Flags;
9010 } 9025 }
9011 9026
9012 public LSL_Integer llGetRegionFlags() 9027 public LSL_Integer llGetRegionFlags()
@@ -9113,19 +9128,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9113 } 9128 }
9114 9129
9115 9130
9116 public void llHTTPResponse(string url, int status, string body) 9131 public void llHTTPResponse(LSL_Key id, int status, string body)
9117 { 9132 {
9118 // Partial implementation: support for parameter flags needed 9133 // Partial implementation: support for parameter flags needed
9119 // see http://wiki.secondlife.com/wiki/llHTTPResponse 9134 // see http://wiki.secondlife.com/wiki/llHTTPResponse
9120 9135
9121 m_host.AddScriptLPS(1); 9136 m_host.AddScriptLPS(1);
9122 NotImplemented("llHTTPResponse"); 9137
9138 if (m_UrlModule != null)
9139 m_UrlModule.HttpResponse(new UUID(id), status,body);
9123 } 9140 }
9124 9141
9125 public void llResetLandBanList() 9142 public void llResetLandBanList()
9126 { 9143 {
9127 m_host.AddScriptLPS(1); 9144 m_host.AddScriptLPS(1);
9128 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).landData; 9145 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
9129 if (land.OwnerID == m_host.OwnerID) 9146 if (land.OwnerID == m_host.OwnerID)
9130 { 9147 {
9131 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 9148 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList)
@@ -9142,7 +9159,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9142 public void llResetLandPassList() 9159 public void llResetLandPassList()
9143 { 9160 {
9144 m_host.AddScriptLPS(1); 9161 m_host.AddScriptLPS(1);
9145 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).landData; 9162 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
9146 if (land.OwnerID == m_host.OwnerID) 9163 if (land.OwnerID == m_host.OwnerID)
9147 { 9164 {
9148 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 9165 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList)
@@ -9226,7 +9243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9226 LSL_List ret = new LSL_List(); 9243 LSL_List ret = new LSL_List();
9227 if (land != null) 9244 if (land != null)
9228 { 9245 {
9229 foreach (KeyValuePair<UUID, int> detectedParams in land.getLandObjectOwners()) 9246 foreach (KeyValuePair<UUID, int> detectedParams in land.GetLandObjectOwners())
9230 { 9247 {
9231 ret.Add(detectedParams.Key.ToString()); 9248 ret.Add(detectedParams.Key.ToString());
9232 ret.Add(detectedParams.Value); 9249 ret.Add(detectedParams.Value);