aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
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
parentmove fake user service to a separate mock user service class (diff)
downloadopensim-SC_OLD-fe82471c2b5ad15ff95aabb1ac18ffa4e5f83b72.zip
opensim-SC_OLD-fe82471c2b5ad15ff95aabb1ac18ffa4e5f83b72.tar.gz
opensim-SC_OLD-fe82471c2b5ad15ff95aabb1ac18ffa4e5f83b72.tar.bz2
opensim-SC_OLD-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')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs75
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs28
3 files changed, 81 insertions, 32 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}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index d8d3c31..2a403bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
79 79
80 // Avatar Info Commands 80 // Avatar Info Commands
81 string osGetAgentIP(string agent); 81 string osGetAgentIP(string agent);
82 LSL_List osGetAgents(); 82 LSL_List osGetAgents();
83 83
84 // Teleport commands 84 // Teleport commands
85 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 85 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
@@ -127,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
127 string osGetScriptEngineName(); 127 string osGetScriptEngineName();
128 string osGetSimulatorVersion(); 128 string osGetSimulatorVersion();
129 Hashtable osParseJSON(string JSON); 129 Hashtable osParseJSON(string JSON);
130 130
131 void osMessageObject(key objectUUID,string message); 131 void osMessageObject(key objectUUID,string message);
132 132
133 void osMakeNotecard(string notecardName, LSL_Types.list contents); 133 void osMakeNotecard(string notecardName, LSL_Types.list contents);
@@ -138,7 +138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
138 138
139 string osAvatarName2Key(string firstname, string lastname); 139 string osAvatarName2Key(string firstname, string lastname);
140 string osKey2Name(string id); 140 string osKey2Name(string id);
141 141
142 // Grid Info Functions 142 // Grid Info Functions
143 string osGetGridNick(); 143 string osGetGridNick();
144 string osGetGridName(); 144 string osGetGridName();
@@ -151,7 +151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
151 string osLoadedCreationDate(); 151 string osLoadedCreationDate();
152 string osLoadedCreationTime(); 152 string osLoadedCreationTime();
153 string osLoadedCreationID(); 153 string osLoadedCreationID();
154 154
155 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); 155 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
156 156
157 157
@@ -160,5 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
160 void osNpcSay(key npc, string message); 160 void osNpcSay(key npc, string message);
161 void osNpcRemove(key npc); 161 void osNpcRemove(key npc);
162 162
163 key osGetMapTexture();
164 key osGetRegionMapTexture(string regionName);
163 } 165 }
164} 166}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 8dcb1f5..4928e90 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
94 { 94 {
95 return m_OSSL_Functions.osWindActiveModelPluginName(); 95 return m_OSSL_Functions.osWindActiveModelPluginName();
96 } 96 }
97 97
98// Not yet plugged in as available OSSL functions, so commented out 98// Not yet plugged in as available OSSL functions, so commented out
99// void osWindParamSet(string plugin, string param, float value) 99// void osWindParamSet(string plugin, string param, float value)
100// { 100// {
@@ -138,14 +138,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
138 public string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, 138 public string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams,
139 bool blend, int disp, int timer, int alpha, int face) 139 bool blend, int disp, int timer, int alpha, int face)
140 { 140 {
141 return m_OSSL_Functions.osSetDynamicTextureURLBlendFace(dynamicID, contentType, url, extraParams, 141 return m_OSSL_Functions.osSetDynamicTextureURLBlendFace(dynamicID, contentType, url, extraParams,
142 blend, disp, timer, alpha, face); 142 blend, disp, timer, alpha, face);
143 } 143 }
144 144
145 public string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, 145 public string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams,
146 bool blend, int disp, int timer, int alpha, int face) 146 bool blend, int disp, int timer, int alpha, int face)
147 { 147 {
148 return m_OSSL_Functions.osSetDynamicTextureDataBlendFace(dynamicID, contentType, data, extraParams, 148 return m_OSSL_Functions.osSetDynamicTextureDataBlendFace(dynamicID, contentType, data, extraParams,
149 blend, disp, timer, alpha, face); 149 blend, disp, timer, alpha, face);
150 } 150 }
151 151
@@ -183,7 +183,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
183 { 183 {
184 m_OSSL_Functions.osSetParcelMediaURL(url); 184 m_OSSL_Functions.osSetParcelMediaURL(url);
185 } 185 }
186 186
187 public void osSetParcelSIPAddress(string SIPAddress) 187 public void osSetParcelSIPAddress(string SIPAddress)
188 { 188 {
189 m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress); 189 m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress);
@@ -211,7 +211,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
211 m_OSSL_Functions.osTeleportAgent(agent, position, lookat); 211 m_OSSL_Functions.osTeleportAgent(agent, position, lookat);
212 } 212 }
213 213
214 // Avatar info functions 214 // Avatar info functions
215 public string osGetAgentIP(string agent) 215 public string osGetAgentIP(string agent)
216 { 216 {
217 return m_OSSL_Functions.osGetAgentIP(agent); 217 return m_OSSL_Functions.osGetAgentIP(agent);
@@ -326,17 +326,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
326 { 326 {
327 return m_OSSL_Functions.osGetScriptEngineName(); 327 return m_OSSL_Functions.osGetScriptEngineName();
328 } 328 }
329 329
330 public string osGetSimulatorVersion() 330 public string osGetSimulatorVersion()
331 { 331 {
332 return m_OSSL_Functions.osGetSimulatorVersion(); 332 return m_OSSL_Functions.osGetSimulatorVersion();
333 } 333 }
334 334
335 public Hashtable osParseJSON(string JSON) 335 public Hashtable osParseJSON(string JSON)
336 { 336 {
337 return m_OSSL_Functions.osParseJSON(JSON); 337 return m_OSSL_Functions.osParseJSON(JSON);
338 } 338 }
339 339
340 public void osMessageObject(key objectUUID,string message) 340 public void osMessageObject(key objectUUID,string message)
341 { 341 {
342 m_OSSL_Functions.osMessageObject(objectUUID,message); 342 m_OSSL_Functions.osMessageObject(objectUUID,message);
@@ -412,7 +412,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
412 { 412 {
413 return m_OSSL_Functions.osLoadedCreationID(); 413 return m_OSSL_Functions.osLoadedCreationID();
414 } 414 }
415 415
416 public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules) 416 public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules)
417 { 417 {
418 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); 418 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules);
@@ -622,5 +622,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
622 } 622 }
623 } 623 }
624 } 624 }
625
626 public key osGetMapTexture()
627 {
628 return m_OSSL_Functions.osGetMapTexture();
629 }
630
631 public key osGetRegionMapTexture(string regionName)
632 {
633 return m_OSSL_Functions.osGetRegionMapTexture(regionName);
634 }
625 } 635 }
626} 636}