From fe82471c2b5ad15ff95aabb1ac18ffa4e5f83b72 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 Nov 2009 19:42:35 +0000 Subject: Apply patch http://opensimulator.org/mantis/view.php?id=4369 Adds osGetMapTexture() and osGetRegionMapTexture() methods to retrieve region map texture uuids --- .../Shared/Api/Implementation/OSSL_Api.cs | 75 ++++++++++++++++------ 1 file changed, 56 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f7ee3d9..3ffcff0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -199,7 +199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //Dumps an error message on the debug console. // - internal void OSSLShoutError(string message) + internal void OSSLShoutError(string message) { if (message.Length > 1023) message = message.Substring(0, 1023); @@ -1176,7 +1176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api land.SetMediaUrl(url); } - + public void osSetParcelSIPAddress(string SIPAddress) { // What actually is the difference to the LL function? @@ -1184,7 +1184,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); m_host.AddScriptLPS(1); - + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); @@ -1194,16 +1194,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function"); return; } - + // get the voice module IVoiceModule voiceModule = World.RequestModuleInterface(); - - if (voiceModule != null) + + if (voiceModule != null) voiceModule.setLandSIPAddress(SIPAddress,land.LandData.GlobalID); else OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); - - + + } public string osGetScriptEngineName() @@ -1525,10 +1525,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - /*Instead of using the LSL Dataserver event to pull notecard data, + /*Instead of using the LSL Dataserver event to pull notecard data, this will simply read the requested line and return its data as a string. - - Warning - due to the synchronous method this function uses to fetch assets, its use + + Warning - due to the synchronous method this function uses to fetch assets, its use may be dangerous and unreliable while running in grid mode. */ public string osGetNotecardLine(string name, int line) @@ -1576,10 +1576,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - /*Instead of using the LSL Dataserver event to pull notecard data line by line, + /*Instead of using the LSL Dataserver event to pull notecard data line by line, this will simply read the entire notecard and return its data as a string. - - Warning - due to the synchronous method this function uses to fetch assets, its use + + Warning - due to the synchronous method this function uses to fetch assets, its use may be dangerous and unreliable while running in grid mode. */ @@ -1634,10 +1634,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - /*Instead of using the LSL Dataserver event to pull notecard data, + /*Instead of using the LSL Dataserver event to pull notecard data, this will simply read the number of note card lines and return this data as an integer. - - Warning - due to the synchronous method this function uses to fetch assets, its use + + Warning - due to the synchronous method this function uses to fetch assets, its use may be dangerous and unreliable while running in grid mode. */ @@ -1837,7 +1837,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return World.RegionInfo.RegionSettings.LoadedCreationID; } - + // Threat level is 'Low' because certain users could possibly be tricked into // dropping an unverified script into one of their own objects, which could // then gather the physical construction details of the object and transmit it @@ -1861,7 +1861,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom) { CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); - //QueueUserWorkItem + //QueueUserWorkItem INPCModule module = World.RequestModuleInterface(); if (module != null) @@ -1910,5 +1910,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api module.DeleteNPC(new UUID(npc.m_string), World); } } + + /// + /// Get current region's map texture UUID + /// + /// + public LSL_Key osGetMapTexture() + { + CheckThreatLevel(ThreatLevel.None, "osGetMapTexture"); + return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString(); + } + + /// + /// Get a region's map texture UUID by region UUID or name. + /// + /// + /// + public LSL_Key osGetRegionMapTexture(string regionName) + { + CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture"); + Scene scene = m_ScriptEngine.World; + UUID key = UUID.Zero; + GridRegion region; + + //If string is a key, use it. Otherwise, try to locate region by name. + if (UUID.TryParse(regionName, out key)) + region = scene.GridService.GetRegionByUUID(UUID.Zero, key); + else + region = scene.GridService.GetRegionByName(UUID.Zero, regionName); + + // If region was found, return the regions map texture key. + if (region != null) + key = region.TerrainImage; + + ScriptSleep(1000); + + return key.ToString(); + } } } -- cgit v1.1