aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-11-12 19:42:35 +0000
committerJustin Clark-Casey (justincc)2009-11-12 19:42:35 +0000
commitfe82471c2b5ad15ff95aabb1ac18ffa4e5f83b72 (patch)
tree0b7283477f786f7f8fad0fb854c6c26a0db28a2a /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentmove fake user service to a separate mock user service class (diff)
downloadopensim-SC-fe82471c2b5ad15ff95aabb1ac18ffa4e5f83b72.zip
opensim-SC-fe82471c2b5ad15ff95aabb1ac18ffa4e5f83b72.tar.gz
opensim-SC-fe82471c2b5ad15ff95aabb1ac18ffa4e5f83b72.tar.bz2
opensim-SC-fe82471c2b5ad15ff95aabb1ac18ffa4e5f83b72.tar.xz
Apply patch http://opensimulator.org/mantis/view.php?id=4369
Adds osGetMapTexture() and osGetRegionMapTexture() methods to retrieve region map texture uuids
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs75
1 files changed, 56 insertions, 19 deletions
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
199 //Dumps an error message on the debug console. 199 //Dumps an error message on the debug console.
200 // 200 //
201 201
202 internal void OSSLShoutError(string message) 202 internal void OSSLShoutError(string message)
203 { 203 {
204 if (message.Length > 1023) 204 if (message.Length > 1023)
205 message = message.Substring(0, 1023); 205 message = message.Substring(0, 1023);
@@ -1176,7 +1176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1176 1176
1177 land.SetMediaUrl(url); 1177 land.SetMediaUrl(url);
1178 } 1178 }
1179 1179
1180 public void osSetParcelSIPAddress(string SIPAddress) 1180 public void osSetParcelSIPAddress(string SIPAddress)
1181 { 1181 {
1182 // What actually is the difference to the LL function? 1182 // What actually is the difference to the LL function?
@@ -1184,7 +1184,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1184 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); 1184 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL");
1185 1185
1186 m_host.AddScriptLPS(1); 1186 m_host.AddScriptLPS(1);
1187 1187
1188 1188
1189 ILandObject land 1189 ILandObject land
1190 = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 1190 = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
@@ -1194,16 +1194,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1194 OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function"); 1194 OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function");
1195 return; 1195 return;
1196 } 1196 }
1197 1197
1198 // get the voice module 1198 // get the voice module
1199 IVoiceModule voiceModule = World.RequestModuleInterface<IVoiceModule>(); 1199 IVoiceModule voiceModule = World.RequestModuleInterface<IVoiceModule>();
1200 1200
1201 if (voiceModule != null) 1201 if (voiceModule != null)
1202 voiceModule.setLandSIPAddress(SIPAddress,land.LandData.GlobalID); 1202 voiceModule.setLandSIPAddress(SIPAddress,land.LandData.GlobalID);
1203 else 1203 else
1204 OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); 1204 OSSLError("osSetParcelSIPAddress: No voice module enabled for this land");
1205 1205
1206 1206
1207 } 1207 }
1208 1208
1209 public string osGetScriptEngineName() 1209 public string osGetScriptEngineName()
@@ -1525,10 +1525,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1525 } 1525 }
1526 1526
1527 1527
1528 /*Instead of using the LSL Dataserver event to pull notecard data, 1528 /*Instead of using the LSL Dataserver event to pull notecard data,
1529 this will simply read the requested line and return its data as a string. 1529 this will simply read the requested line and return its data as a string.
1530 1530
1531 Warning - due to the synchronous method this function uses to fetch assets, its use 1531 Warning - due to the synchronous method this function uses to fetch assets, its use
1532 may be dangerous and unreliable while running in grid mode. 1532 may be dangerous and unreliable while running in grid mode.
1533 */ 1533 */
1534 public string osGetNotecardLine(string name, int line) 1534 public string osGetNotecardLine(string name, int line)
@@ -1576,10 +1576,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1576 1576
1577 } 1577 }
1578 1578
1579 /*Instead of using the LSL Dataserver event to pull notecard data line by line, 1579 /*Instead of using the LSL Dataserver event to pull notecard data line by line,
1580 this will simply read the entire notecard and return its data as a string. 1580 this will simply read the entire notecard and return its data as a string.
1581 1581
1582 Warning - due to the synchronous method this function uses to fetch assets, its use 1582 Warning - due to the synchronous method this function uses to fetch assets, its use
1583 may be dangerous and unreliable while running in grid mode. 1583 may be dangerous and unreliable while running in grid mode.
1584 */ 1584 */
1585 1585
@@ -1634,10 +1634,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1634 1634
1635 } 1635 }
1636 1636
1637 /*Instead of using the LSL Dataserver event to pull notecard data, 1637 /*Instead of using the LSL Dataserver event to pull notecard data,
1638 this will simply read the number of note card lines and return this data as an integer. 1638 this will simply read the number of note card lines and return this data as an integer.
1639 1639
1640 Warning - due to the synchronous method this function uses to fetch assets, its use 1640 Warning - due to the synchronous method this function uses to fetch assets, its use
1641 may be dangerous and unreliable while running in grid mode. 1641 may be dangerous and unreliable while running in grid mode.
1642 */ 1642 */
1643 1643
@@ -1837,7 +1837,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1837 1837
1838 return World.RegionInfo.RegionSettings.LoadedCreationID; 1838 return World.RegionInfo.RegionSettings.LoadedCreationID;
1839 } 1839 }
1840 1840
1841 // Threat level is 'Low' because certain users could possibly be tricked into 1841 // Threat level is 'Low' because certain users could possibly be tricked into
1842 // dropping an unverified script into one of their own objects, which could 1842 // dropping an unverified script into one of their own objects, which could
1843 // then gather the physical construction details of the object and transmit it 1843 // then gather the physical construction details of the object and transmit it
@@ -1861,7 +1861,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1861 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom) 1861 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom)
1862 { 1862 {
1863 CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); 1863 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
1864 //QueueUserWorkItem 1864 //QueueUserWorkItem
1865 1865
1866 INPCModule module = World.RequestModuleInterface<INPCModule>(); 1866 INPCModule module = World.RequestModuleInterface<INPCModule>();
1867 if (module != null) 1867 if (module != null)
@@ -1910,5 +1910,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1910 module.DeleteNPC(new UUID(npc.m_string), World); 1910 module.DeleteNPC(new UUID(npc.m_string), World);
1911 } 1911 }
1912 } 1912 }
1913
1914 /// <summary>
1915 /// Get current region's map texture UUID
1916 /// </summary>
1917 /// <returns></returns>
1918 public LSL_Key osGetMapTexture()
1919 {
1920 CheckThreatLevel(ThreatLevel.None, "osGetMapTexture");
1921 return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString();
1922 }
1923
1924 /// <summary>
1925 /// Get a region's map texture UUID by region UUID or name.
1926 /// </summary>
1927 /// <param name="regionName"></param>
1928 /// <returns></returns>
1929 public LSL_Key osGetRegionMapTexture(string regionName)
1930 {
1931 CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture");
1932 Scene scene = m_ScriptEngine.World;
1933 UUID key = UUID.Zero;
1934 GridRegion region;
1935
1936 //If string is a key, use it. Otherwise, try to locate region by name.
1937 if (UUID.TryParse(regionName, out key))
1938 region = scene.GridService.GetRegionByUUID(UUID.Zero, key);
1939 else
1940 region = scene.GridService.GetRegionByName(UUID.Zero, regionName);
1941
1942 // If region was found, return the regions map texture key.
1943 if (region != null)
1944 key = region.TerrainImage;
1945
1946 ScriptSleep(1000);
1947
1948 return key.ToString();
1949 }
1913 } 1950 }
1914} 1951}