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.cs228
1 files changed, 95 insertions, 133 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4b70ec8..4da1b3b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -198,50 +198,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
198 } 198 }
199 } 199 }
200 200
201 public void osSetRegionWaterHeight(double height)
202 {
203 m_host.AddScriptLPS(1);
204 //Check to make sure that the script's owner is the estate manager/master
205 //World.Permissions.GenericEstatePermission(
206 if (World.ExternalChecks.ExternalChecksCanBeGodLike(m_host.OwnerID))
207 {
208 World.EventManager.TriggerRequestChangeWaterHeight((float)height);
209 }
210 }
211
212 //These are the implementations of the various ll-functions used by the LSL scripts. 201 //These are the implementations of the various ll-functions used by the LSL scripts.
213 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 202 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
214 public double llSin(double f) 203 public LSL_Types.LSLFloat llSin(double f)
215 { 204 {
216 m_host.AddScriptLPS(1); 205 m_host.AddScriptLPS(1);
217 return (double)Math.Sin(f); 206 return (double)Math.Sin(f);
218 } 207 }
219 208
220 public double llCos(double f) 209 public LSL_Types.LSLFloat llCos(double f)
221 { 210 {
222 m_host.AddScriptLPS(1); 211 m_host.AddScriptLPS(1);
223 return (double)Math.Cos(f); 212 return (double)Math.Cos(f);
224 } 213 }
225 214
226 public double llTan(double f) 215 public LSL_Types.LSLFloat llTan(double f)
227 { 216 {
228 m_host.AddScriptLPS(1); 217 m_host.AddScriptLPS(1);
229 return (double)Math.Tan(f); 218 return (double)Math.Tan(f);
230 } 219 }
231 220
232 public double llAtan2(double x, double y) 221 public LSL_Types.LSLFloat llAtan2(double x, double y)
233 { 222 {
234 m_host.AddScriptLPS(1); 223 m_host.AddScriptLPS(1);
235 return (double)Math.Atan2(y, x); 224 return (double)Math.Atan2(y, x);
236 } 225 }
237 226
238 public double llSqrt(double f) 227 public LSL_Types.LSLFloat llSqrt(double f)
239 { 228 {
240 m_host.AddScriptLPS(1); 229 m_host.AddScriptLPS(1);
241 return (double)Math.Sqrt(f); 230 return (double)Math.Sqrt(f);
242 } 231 }
243 232
244 public double llPow(double fbase, double fexponent) 233 public LSL_Types.LSLFloat llPow(double fbase, double fexponent)
245 { 234 {
246 m_host.AddScriptLPS(1); 235 m_host.AddScriptLPS(1);
247 return (double)Math.Pow(fbase, fexponent); 236 return (double)Math.Pow(fbase, fexponent);
@@ -253,13 +242,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
253 return (int)Math.Abs(i); 242 return (int)Math.Abs(i);
254 } 243 }
255 244
256 public double llFabs(double f) 245 public LSL_Types.LSLFloat llFabs(double f)
257 { 246 {
258 m_host.AddScriptLPS(1); 247 m_host.AddScriptLPS(1);
259 return (double)Math.Abs(f); 248 return (double)Math.Abs(f);
260 } 249 }
261 250
262 public double llFrand(double mag) 251 public LSL_Types.LSLFloat llFrand(double mag)
263 { 252 {
264 m_host.AddScriptLPS(1); 253 m_host.AddScriptLPS(1);
265 lock (Util.RandomClass) 254 lock (Util.RandomClass)
@@ -288,7 +277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
288 } 277 }
289 278
290 //This next group are vector operations involving squaring and square root. ckrinke 279 //This next group are vector operations involving squaring and square root. ckrinke
291 public double llVecMag(LSL_Types.Vector3 v) 280 public LSL_Types.LSLFloat llVecMag(LSL_Types.Vector3 v)
292 { 281 {
293 m_host.AddScriptLPS(1); 282 m_host.AddScriptLPS(1);
294 return LSL_Types.Vector3.Mag(v); 283 return LSL_Types.Vector3.Mag(v);
@@ -305,7 +294,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
305 return nor; 294 return nor;
306 } 295 }
307 296
308 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) 297 public LSL_Types.LSLFloat llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b)
309 { 298 {
310 m_host.AddScriptLPS(1); 299 m_host.AddScriptLPS(1);
311 double dx = a.x - b.x; 300 double dx = a.x - b.x;
@@ -677,7 +666,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
677 return SensedObject.Name; 666 return SensedObject.Name;
678 } 667 }
679 668
680 public string llDetectedName(int number) 669 public LSL_Types.LSLString llDetectedName(int number)
681 { 670 {
682 m_host.AddScriptLPS(1); 671 m_host.AddScriptLPS(1);
683 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 672 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
@@ -686,7 +675,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
686 return d.Name; 675 return d.Name;
687 } 676 }
688 677
689 public string llDetectedKey(int number) 678 public LSL_Types.LSLString llDetectedKey(int number)
690 { 679 {
691 m_host.AddScriptLPS(1); 680 m_host.AddScriptLPS(1);
692 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 681 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
@@ -695,7 +684,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
695 return d.Key.ToString(); 684 return d.Key.ToString();
696 } 685 }
697 686
698 public string llDetectedOwner(int number) 687 public LSL_Types.LSLString llDetectedOwner(int number)
699 { 688 {
700 m_host.AddScriptLPS(1); 689 m_host.AddScriptLPS(1);
701 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 690 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
@@ -777,7 +766,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
777 throw new SelfDeleteException(); 766 throw new SelfDeleteException();
778 } 767 }
779 768
780 public double llGround(LSL_Types.Vector3 offset) 769 public LSL_Types.LSLFloat llGround(LSL_Types.Vector3 offset)
781 { 770 {
782 m_host.AddScriptLPS(1); 771 m_host.AddScriptLPS(1);
783 int x = (int)(m_host.AbsolutePosition.X + offset.x); 772 int x = (int)(m_host.AbsolutePosition.X + offset.x);
@@ -785,7 +774,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
785 return World.GetLandHeight(x, y); 774 return World.GetLandHeight(x, y);
786 } 775 }
787 776
788 public double llCloud(LSL_Types.Vector3 offset) 777 public LSL_Types.LSLFloat llCloud(LSL_Types.Vector3 offset)
789 { 778 {
790 m_host.AddScriptLPS(1); 779 m_host.AddScriptLPS(1);
791 return 0; 780 return 0;
@@ -1131,7 +1120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1131 } 1120 }
1132 } 1121 }
1133 1122
1134 public double llGetAlpha(int face) 1123 public LSL_Types.LSLFloat llGetAlpha(int face)
1135 { 1124 {
1136 m_host.AddScriptLPS(1); 1125 m_host.AddScriptLPS(1);
1137 Primitive.TextureEntry tex = m_host.Shape.Textures; 1126 Primitive.TextureEntry tex = m_host.Shape.Textures;
@@ -1458,7 +1447,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1458 } 1447 }
1459 } 1448 }
1460 1449
1461 public string llGetTexture(int face) 1450 public LSL_Types.LSLString llGetTexture(int face)
1462 { 1451 {
1463 m_host.AddScriptLPS(1); 1452 m_host.AddScriptLPS(1);
1464 Primitive.TextureEntry tex = m_host.Shape.Textures; 1453 Primitive.TextureEntry tex = m_host.Shape.Textures;
@@ -1695,19 +1684,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1695 return new LSL_Types.Vector3(m_host.RotationalVelocity.X, m_host.RotationalVelocity.Y, m_host.RotationalVelocity.Z); 1684 return new LSL_Types.Vector3(m_host.RotationalVelocity.X, m_host.RotationalVelocity.Y, m_host.RotationalVelocity.Z);
1696 } 1685 }
1697 1686
1698 public double llGetTimeOfDay() 1687 public LSL_Types.LSLFloat llGetTimeOfDay()
1699 { 1688 {
1700 m_host.AddScriptLPS(1); 1689 m_host.AddScriptLPS(1);
1701 return (double)(((DateTime.Now.TimeOfDay.TotalMilliseconds / 1000) % (3600 * 4)) * World.TimeDilation); 1690 return (double)(((DateTime.Now.TimeOfDay.TotalMilliseconds / 1000) % (3600 * 4)) * World.TimeDilation);
1702 } 1691 }
1703 1692
1704 public double llGetWallclock() 1693 public LSL_Types.LSLFloat llGetWallclock()
1705 { 1694 {
1706 m_host.AddScriptLPS(1); 1695 m_host.AddScriptLPS(1);
1707 return DateTime.Now.TimeOfDay.TotalSeconds; 1696 return DateTime.Now.TimeOfDay.TotalSeconds;
1708 } 1697 }
1709 1698
1710 public double llGetTime() 1699 public LSL_Types.LSLFloat llGetTime()
1711 { 1700 {
1712 m_host.AddScriptLPS(1); 1701 m_host.AddScriptLPS(1);
1713 TimeSpan ScriptTime = DateTime.Now - m_timer; 1702 TimeSpan ScriptTime = DateTime.Now - m_timer;
@@ -1720,7 +1709,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1720 m_timer = DateTime.Now; 1709 m_timer = DateTime.Now;
1721 } 1710 }
1722 1711
1723 public double llGetAndResetTime() 1712 public LSL_Types.LSLFloat llGetAndResetTime()
1724 { 1713 {
1725 m_host.AddScriptLPS(1); 1714 m_host.AddScriptLPS(1);
1726 TimeSpan ScriptTime = DateTime.Now - m_timer; 1715 TimeSpan ScriptTime = DateTime.Now - m_timer;
@@ -1825,7 +1814,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1825 /// this more complicated than it might otherwise seem. 1814 /// this more complicated than it might otherwise seem.
1826 /// </summary> 1815 /// </summary>
1827 1816
1828 public string llGetSubString(string src, int start, int end) 1817 public LSL_Types.LSLString llGetSubString(string src, int start, int end)
1829 { 1818 {
1830 1819
1831 m_host.AddScriptLPS(1); 1820 m_host.AddScriptLPS(1);
@@ -1921,7 +1910,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1921 /// i.e. end < start. 1910 /// i.e. end < start.
1922 /// </summary> 1911 /// </summary>
1923 1912
1924 public string llDeleteSubString(string src, int start, int end) 1913 public LSL_Types.LSLString llDeleteSubString(string src, int start, int end)
1925 { 1914 {
1926 1915
1927 m_host.AddScriptLPS(1); 1916 m_host.AddScriptLPS(1);
@@ -2004,7 +1993,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2004 /// string bound, with the result being a concatenation. 1993 /// string bound, with the result being a concatenation.
2005 /// </summary> 1994 /// </summary>
2006 1995
2007 public string llInsertString(string dest, int index, string src) 1996 public LSL_Types.LSLString llInsertString(string dest, int index, string src)
2008 { 1997 {
2009 1998
2010 m_host.AddScriptLPS(1); 1999 m_host.AddScriptLPS(1);
@@ -2042,13 +2031,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2042 2031
2043 } 2032 }
2044 2033
2045 public string llToUpper(string src) 2034 public LSL_Types.LSLString llToUpper(string src)
2046 { 2035 {
2047 m_host.AddScriptLPS(1); 2036 m_host.AddScriptLPS(1);
2048 return src.ToUpper(); 2037 return src.ToUpper();
2049 } 2038 }
2050 2039
2051 public string llToLower(string src) 2040 public LSL_Types.LSLString llToLower(string src)
2052 { 2041 {
2053 m_host.AddScriptLPS(1); 2042 m_host.AddScriptLPS(1);
2054 return src.ToLower(); 2043 return src.ToLower();
@@ -2221,7 +2210,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2221 Thread.Sleep((int)(sec * 1000)); 2210 Thread.Sleep((int)(sec * 1000));
2222 } 2211 }
2223 2212
2224 public double llGetMass() 2213 public LSL_Types.LSLFloat llGetMass()
2225 { 2214 {
2226 m_host.AddScriptLPS(1); 2215 m_host.AddScriptLPS(1);
2227 return m_host.GetMass(); 2216 return m_host.GetMass();
@@ -2308,7 +2297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2308 Deprecated("llReleaseCamera"); 2297 Deprecated("llReleaseCamera");
2309 } 2298 }
2310 2299
2311 public string llGetOwner() 2300 public LSL_Types.LSLString llGetOwner()
2312 { 2301 {
2313 m_host.AddScriptLPS(1); 2302 m_host.AddScriptLPS(1);
2314 2303
@@ -2398,7 +2387,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2398 2387
2399 } 2388 }
2400 2389
2401 public string llGetKey() 2390 public LSL_Types.LSLString llGetKey()
2402 { 2391 {
2403 m_host.AddScriptLPS(1); 2392 m_host.AddScriptLPS(1);
2404 return m_host.UUID.ToString(); 2393 return m_host.UUID.ToString();
@@ -2673,7 +2662,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2673 new DetectParams[0])); 2662 new DetectParams[0]));
2674 } 2663 }
2675 2664
2676 public string llGetPermissionsKey() 2665 public LSL_Types.LSLString llGetPermissionsKey()
2677 { 2666 {
2678 m_host.AddScriptLPS(1); 2667 m_host.AddScriptLPS(1);
2679 2668
@@ -2857,7 +2846,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2857 NotImplemented("llBreakAllLinks"); 2846 NotImplemented("llBreakAllLinks");
2858 } 2847 }
2859 2848
2860 public string llGetLinkKey(int linknum) 2849 public LSL_Types.LSLString llGetLinkKey(int linknum)
2861 { 2850 {
2862 m_host.AddScriptLPS(1); 2851 m_host.AddScriptLPS(1);
2863 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); 2852 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
@@ -2871,7 +2860,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2871 } 2860 }
2872 } 2861 }
2873 2862
2874 public string llGetLinkName(int linknum) 2863 public LSL_Types.LSLString llGetLinkName(int linknum)
2875 { 2864 {
2876 m_host.AddScriptLPS(1); 2865 m_host.AddScriptLPS(1);
2877 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); 2866 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
@@ -2899,7 +2888,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2899 return count; 2888 return count;
2900 } 2889 }
2901 2890
2902 public string llGetInventoryName(int type, int number) 2891 public LSL_Types.LSLString llGetInventoryName(int type, int number)
2903 { 2892 {
2904 m_host.AddScriptLPS(1); 2893 m_host.AddScriptLPS(1);
2905 ArrayList keys = new ArrayList(); 2894 ArrayList keys = new ArrayList();
@@ -2941,7 +2930,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2941 } 2930 }
2942 } 2931 }
2943 2932
2944 public double llGetEnergy() 2933 public LSL_Types.LSLFloat llGetEnergy()
2945 { 2934 {
2946 m_host.AddScriptLPS(1); 2935 m_host.AddScriptLPS(1);
2947 // TODO: figure out real energy value 2936 // TODO: figure out real energy value
@@ -3013,7 +3002,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3013 m_host.ParentGroup.HasGroupChanged = true; 3002 m_host.ParentGroup.HasGroupChanged = true;
3014 } 3003 }
3015 3004
3016 public double llWater(LSL_Types.Vector3 offset) 3005 public LSL_Types.LSLFloat llWater(LSL_Types.Vector3 offset)
3017 { 3006 {
3018 m_host.AddScriptLPS(1); 3007 m_host.AddScriptLPS(1);
3019 return World.RegionInfo.RegionSettings.WaterHeight; 3008 return World.RegionInfo.RegionSettings.WaterHeight;
@@ -3025,7 +3014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3025 NotImplemented("llPassTouches"); 3014 NotImplemented("llPassTouches");
3026 } 3015 }
3027 3016
3028 public string llRequestAgentData(string id, int data) 3017 public LSL_Types.LSLString llRequestAgentData(string id, int data)
3029 { 3018 {
3030 m_host.AddScriptLPS(1); 3019 m_host.AddScriptLPS(1);
3031 3020
@@ -3080,7 +3069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3080 return tid.ToString(); 3069 return tid.ToString();
3081 } 3070 }
3082 3071
3083 public string llRequestInventoryData(string name) 3072 public LSL_Types.LSLString llRequestInventoryData(string name)
3084 { 3073 {
3085 m_host.AddScriptLPS(1); 3074 m_host.AddScriptLPS(1);
3086 3075
@@ -3161,7 +3150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3161 NotImplemented("llCollisionSprite"); 3150 NotImplemented("llCollisionSprite");
3162 } 3151 }
3163 3152
3164 public string llGetAnimation(string id) 3153 public LSL_Types.LSLString llGetAnimation(string id)
3165 { 3154 {
3166 m_host.AddScriptLPS(1); 3155 m_host.AddScriptLPS(1);
3167 NotImplemented("llGetAnimation"); 3156 NotImplemented("llGetAnimation");
@@ -3365,7 +3354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3365 NotImplemented("llPassCollisions"); 3354 NotImplemented("llPassCollisions");
3366 } 3355 }
3367 3356
3368 public string llGetScriptName() 3357 public LSL_Types.LSLString llGetScriptName()
3369 { 3358 {
3370 3359
3371 string result = String.Empty; 3360 string result = String.Empty;
@@ -3589,7 +3578,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3589 3578
3590 3579
3591 // Returns the angle of a quaternion (see llRot2Axis for the axis) 3580 // Returns the angle of a quaternion (see llRot2Axis for the axis)
3592 public double llRot2Angle(LSL_Types.Quaternion rot) 3581 public LSL_Types.LSLFloat llRot2Angle(LSL_Types.Quaternion rot)
3593 { 3582 {
3594 m_host.AddScriptLPS(1); 3583 m_host.AddScriptLPS(1);
3595 3584
@@ -3612,27 +3601,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3612// NotImplemented("llRot2Angle"); 3601// NotImplemented("llRot2Angle");
3613 } 3602 }
3614 3603
3615 public double llAcos(double val) 3604 public LSL_Types.LSLFloat llAcos(double val)
3616 { 3605 {
3617 m_host.AddScriptLPS(1); 3606 m_host.AddScriptLPS(1);
3618 return (double)Math.Acos(val); 3607 return (double)Math.Acos(val);
3619 } 3608 }
3620 3609
3621 public double llAsin(double val) 3610 public LSL_Types.LSLFloat llAsin(double val)
3622 { 3611 {
3623 m_host.AddScriptLPS(1); 3612 m_host.AddScriptLPS(1);
3624 return (double)Math.Asin(val); 3613 return (double)Math.Asin(val);
3625 } 3614 }
3626 3615
3627 // Xantor 30/apr/2008 3616 // Xantor 30/apr/2008
3628 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) 3617 public LSL_Types.LSLFloat llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b)
3629 { 3618 {
3630 m_host.AddScriptLPS(1); 3619 m_host.AddScriptLPS(1);
3631 3620
3632 return (double) Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2; 3621 return (double) Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2;
3633 } 3622 }
3634 3623
3635 public string llGetInventoryKey(string name) 3624 public LSL_Types.LSLString llGetInventoryKey(string name)
3636 { 3625 {
3637 m_host.AddScriptLPS(1); 3626 m_host.AddScriptLPS(1);
3638 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 3627 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
@@ -3709,7 +3698,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3709 return scale; 3698 return scale;
3710 } 3699 }
3711 3700
3712 public double llGetTextureRot(int face) 3701 public LSL_Types.LSLFloat llGetTextureRot(int face)
3713 { 3702 {
3714 m_host.AddScriptLPS(1); 3703 m_host.AddScriptLPS(1);
3715 Primitive.TextureEntry tex = m_host.Shape.Textures; 3704 Primitive.TextureEntry tex = m_host.Shape.Textures;
@@ -3726,7 +3715,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3726 return source.IndexOf(pattern); 3715 return source.IndexOf(pattern);
3727 } 3716 }
3728 3717
3729 public string llGetOwnerKey(string id) 3718 public LSL_Types.LSLString llGetOwnerKey(string id)
3730 { 3719 {
3731 m_host.AddScriptLPS(1); 3720 m_host.AddScriptLPS(1);
3732 UUID key = new UUID(); 3721 UUID key = new UUID();
@@ -3799,27 +3788,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3799 } 3788 }
3800 } 3789 }
3801 3790
3802 public double osList2Double(LSL_Types.list src, int index) 3791 public LSL_Types.LSLFloat llList2Float(LSL_Types.list src, int index)
3803 {
3804 m_host.AddScriptLPS(1);
3805 if (index < 0)
3806 {
3807 index = src.Length + index;
3808 }
3809 if (index >= src.Length)
3810 {
3811 return 0.0;
3812 }
3813 if (src.Data[index] is LSL_Types.LSLInteger)
3814 return Convert.ToDouble(((LSL_Types.LSLInteger) src.Data[index]).value);
3815 else if (src.Data[index] is LSL_Types.LSLFloat)
3816 return Convert.ToDouble(((LSL_Types.LSLFloat) src.Data[index]).value);
3817 else if (src.Data[index] is LSL_Types.LSLString)
3818 return Convert.ToDouble(((LSL_Types.LSLString) src.Data[index]).m_string);
3819 return Convert.ToDouble(src.Data[index]);
3820 }
3821
3822 public double llList2Float(LSL_Types.list src, int index)
3823 { 3792 {
3824 m_host.AddScriptLPS(1); 3793 m_host.AddScriptLPS(1);
3825 if (index < 0) 3794 if (index < 0)
@@ -3846,7 +3815,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3846 } 3815 }
3847 } 3816 }
3848 3817
3849 public string llList2String(LSL_Types.list src, int index) 3818 public LSL_Types.LSLString llList2String(LSL_Types.list src, int index)
3850 { 3819 {
3851 m_host.AddScriptLPS(1); 3820 m_host.AddScriptLPS(1);
3852 if (index < 0) 3821 if (index < 0)
@@ -3860,7 +3829,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3860 return src.Data[index].ToString(); 3829 return src.Data[index].ToString();
3861 } 3830 }
3862 3831
3863 public string llList2Key(LSL_Types.list src, int index) 3832 public LSL_Types.LSLString llList2Key(LSL_Types.list src, int index)
3864 { 3833 {
3865 m_host.AddScriptLPS(1); 3834 m_host.AddScriptLPS(1);
3866 if (index < 0) 3835 if (index < 0)
@@ -3972,7 +3941,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3972 /// each comma. 3941 /// each comma.
3973 /// </summary> 3942 /// </summary>
3974 3943
3975 public string llList2CSV(LSL_Types.list src) 3944 public LSL_Types.LSLString llList2CSV(LSL_Types.list src)
3976 { 3945 {
3977 3946
3978 string ret = String.Empty; 3947 string ret = String.Empty;
@@ -4302,7 +4271,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4302 4271
4303 } 4272 }
4304 4273
4305 public string llGetObjectName() 4274 public LSL_Types.LSLString llGetObjectName()
4306 { 4275 {
4307 m_host.AddScriptLPS(1); 4276 m_host.AddScriptLPS(1);
4308 return m_host.Name!=null?m_host.Name:String.Empty; 4277 return m_host.Name!=null?m_host.Name:String.Empty;
@@ -4314,7 +4283,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4314 m_host.Name = name!=null?name:String.Empty; 4283 m_host.Name = name!=null?name:String.Empty;
4315 } 4284 }
4316 4285
4317 public string llGetDate() 4286 public LSL_Types.LSLString llGetDate()
4318 { 4287 {
4319 m_host.AddScriptLPS(1); 4288 m_host.AddScriptLPS(1);
4320 DateTime date = DateTime.Now.ToUniversalTime(); 4289 DateTime date = DateTime.Now.ToUniversalTime();
@@ -4355,7 +4324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4355 m_host.SoundRadius = radius; 4324 m_host.SoundRadius = radius;
4356 } 4325 }
4357 4326
4358 public string llKey2Name(string id) 4327 public LSL_Types.LSLString llKey2Name(string id)
4359 { 4328 {
4360 m_host.AddScriptLPS(1); 4329 m_host.AddScriptLPS(1);
4361 UUID key = new UUID(); 4330 UUID key = new UUID();
@@ -4504,7 +4473,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4504 return 0; 4473 return 0;
4505 } 4474 }
4506 4475
4507 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) 4476 public LSL_Types.LSLString llGetLandOwnerAt(LSL_Types.Vector3 pos)
4508 { 4477 {
4509 m_host.AddScriptLPS(1); 4478 m_host.AddScriptLPS(1);
4510 return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); 4479 return World.GetLandOwner((float)pos.x, (float)pos.y).ToString();
@@ -4632,19 +4601,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4632 return 0; 4601 return 0;
4633 } 4602 }
4634 4603
4635 public string llGetRegionName() 4604 public LSL_Types.LSLString llGetRegionName()
4636 { 4605 {
4637 m_host.AddScriptLPS(1); 4606 m_host.AddScriptLPS(1);
4638 return World.RegionInfo.RegionName; 4607 return World.RegionInfo.RegionName;
4639 } 4608 }
4640 4609
4641 public double llGetRegionTimeDilation() 4610 public LSL_Types.LSLFloat llGetRegionTimeDilation()
4642 { 4611 {
4643 m_host.AddScriptLPS(1); 4612 m_host.AddScriptLPS(1);
4644 return (double)World.TimeDilation; 4613 return (double)World.TimeDilation;
4645 } 4614 }
4646 4615
4647 public double llGetRegionFPS() 4616 public LSL_Types.LSLFloat llGetRegionFPS()
4648 { 4617 {
4649 m_host.AddScriptLPS(1); 4618 m_host.AddScriptLPS(1);
4650 //TODO: return actual FPS 4619 //TODO: return actual FPS
@@ -4959,7 +4928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4959 m_host.SitTargetOrientation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); 4928 m_host.SitTargetOrientation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
4960 } 4929 }
4961 4930
4962 public string llAvatarOnSitTarget() 4931 public LSL_Types.LSLString llAvatarOnSitTarget()
4963 { 4932 {
4964 m_host.AddScriptLPS(1); 4933 m_host.AddScriptLPS(1);
4965 return m_host.GetAvatarOnSitTarget().ToString(); 4934 return m_host.GetAvatarOnSitTarget().ToString();
@@ -5008,7 +4977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5008 m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); 4977 m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z));
5009 } 4978 }
5010 4979
5011 public string llDumpList2String(LSL_Types.list src, string seperator) 4980 public LSL_Types.LSLString llDumpList2String(LSL_Types.list src, string seperator)
5012 { 4981 {
5013 m_host.AddScriptLPS(1); 4982 m_host.AddScriptLPS(1);
5014 if (src.Length == 0) 4983 if (src.Length == 0)
@@ -5188,7 +5157,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5188 // ScriptSleep(1000); 5157 // ScriptSleep(1000);
5189 } 5158 }
5190 5159
5191 public string llSendRemoteData(string channel, string dest, int idata, string sdata) 5160 public LSL_Types.LSLString llSendRemoteData(string channel, string dest, int idata, string sdata)
5192 { 5161 {
5193 m_host.AddScriptLPS(1); 5162 m_host.AddScriptLPS(1);
5194 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 5163 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
@@ -5212,7 +5181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5212 // ScriptSleep(1000); 5181 // ScriptSleep(1000);
5213 } 5182 }
5214 5183
5215 public string llMD5String(string src, int nonce) 5184 public LSL_Types.LSLString llMD5String(string src, int nonce)
5216 { 5185 {
5217 m_host.AddScriptLPS(1); 5186 m_host.AddScriptLPS(1);
5218 return Util.Md5Hash(src + ":" + nonce.ToString()); 5187 return Util.Md5Hash(src + ":" + nonce.ToString());
@@ -5866,7 +5835,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5866 } 5835 }
5867 } 5836 }
5868 5837
5869 public string llStringToBase64(string str) 5838 public LSL_Types.LSLString llStringToBase64(string str)
5870 { 5839 {
5871 m_host.AddScriptLPS(1); 5840 m_host.AddScriptLPS(1);
5872 try 5841 try
@@ -5882,7 +5851,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5882 } 5851 }
5883 } 5852 }
5884 5853
5885 public string llBase64ToString(string str) 5854 public LSL_Types.LSLString llBase64ToString(string str)
5886 { 5855 {
5887 m_host.AddScriptLPS(1); 5856 m_host.AddScriptLPS(1);
5888 UTF8Encoding encoder = new UTF8Encoding(); 5857 UTF8Encoding encoder = new UTF8Encoding();
@@ -5915,13 +5884,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5915 NotImplemented("llRemoteDataSetRegion"); 5884 NotImplemented("llRemoteDataSetRegion");
5916 } 5885 }
5917 5886
5918 public double llLog10(double val) 5887 public LSL_Types.LSLFloat llLog10(double val)
5919 { 5888 {
5920 m_host.AddScriptLPS(1); 5889 m_host.AddScriptLPS(1);
5921 return (double)Math.Log10(val); 5890 return (double)Math.Log10(val);
5922 } 5891 }
5923 5892
5924 public double llLog(double val) 5893 public LSL_Types.LSLFloat llLog(double val)
5925 { 5894 {
5926 m_host.AddScriptLPS(1); 5895 m_host.AddScriptLPS(1);
5927 return (double)Math.Log(val); 5896 return (double)Math.Log(val);
@@ -5958,24 +5927,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5958 // ScriptSleep(2000); 5927 // ScriptSleep(2000);
5959 } 5928 }
5960 5929
5961 public void osSetParcelMediaURL(string url)
5962 {
5963 m_host.AddScriptLPS(1);
5964 UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
5965
5966 if (landowner == UUID.Zero)
5967 {
5968 return;
5969 }
5970
5971 if (landowner != m_host.ObjectOwner)
5972 {
5973 return;
5974 }
5975
5976 World.SetLandMediaURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url);
5977 }
5978
5979 public LSL_Types.Vector3 llGetRootPosition() 5930 public LSL_Types.Vector3 llGetRootPosition()
5980 { 5931 {
5981 m_host.AddScriptLPS(1); 5932 m_host.AddScriptLPS(1);
@@ -5988,7 +5939,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5988 return new LSL_Types.Quaternion(m_host.ParentGroup.GroupRotation.X, m_host.ParentGroup.GroupRotation.Y, m_host.ParentGroup.GroupRotation.Z, m_host.ParentGroup.GroupRotation.W); 5939 return new LSL_Types.Quaternion(m_host.ParentGroup.GroupRotation.X, m_host.ParentGroup.GroupRotation.Y, m_host.ParentGroup.GroupRotation.Z, m_host.ParentGroup.GroupRotation.W);
5989 } 5940 }
5990 5941
5991 public string llGetObjectDesc() 5942 public LSL_Types.LSLString llGetObjectDesc()
5992 { 5943 {
5993 return m_host.Description!=null?m_host.Description:String.Empty; 5944 return m_host.Description!=null?m_host.Description:String.Empty;
5994 } 5945 }
@@ -5999,13 +5950,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5999 m_host.Description = desc!=null?desc:String.Empty; 5950 m_host.Description = desc!=null?desc:String.Empty;
6000 } 5951 }
6001 5952
6002 public string llGetCreator() 5953 public LSL_Types.LSLString llGetCreator()
6003 { 5954 {
6004 m_host.AddScriptLPS(1); 5955 m_host.AddScriptLPS(1);
6005 return m_host.ObjectCreator.ToString(); 5956 return m_host.ObjectCreator.ToString();
6006 } 5957 }
6007 5958
6008 public string llGetTimestamp() 5959 public LSL_Types.LSLString llGetTimestamp()
6009 { 5960 {
6010 m_host.AddScriptLPS(1); 5961 m_host.AddScriptLPS(1);
6011 return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); 5962 return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
@@ -6480,7 +6431,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6480 // characters are padded with "=". 6431 // characters are padded with "=".
6481 // </returns> 6432 // </returns>
6482 6433
6483 public string llIntegerToBase64(int number) 6434 public LSL_Types.LSLString llIntegerToBase64(int number)
6484 { 6435 {
6485 // uninitialized string 6436 // uninitialized string
6486 6437
@@ -6603,13 +6554,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6603 return number; 6554 return number;
6604 } 6555 }
6605 6556
6606 public double llGetGMTclock() 6557 public LSL_Types.LSLFloat llGetGMTclock()
6607 { 6558 {
6608 m_host.AddScriptLPS(1); 6559 m_host.AddScriptLPS(1);
6609 return DateTime.UtcNow.TimeOfDay.TotalSeconds; 6560 return DateTime.UtcNow.TimeOfDay.TotalSeconds;
6610 } 6561 }
6611 6562
6612 public string llGetSimulatorHostname() 6563 public LSL_Types.LSLString llGetSimulatorHostname()
6613 { 6564 {
6614 m_host.AddScriptLPS(1); 6565 m_host.AddScriptLPS(1);
6615 return System.Environment.MachineName; 6566 return System.Environment.MachineName;
@@ -6902,7 +6853,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6902 NotImplemented("llSetInventoryPermMask"); 6853 NotImplemented("llSetInventoryPermMask");
6903 } 6854 }
6904 6855
6905 public string llGetInventoryCreator(string item) 6856 public LSL_Types.LSLString llGetInventoryCreator(string item)
6906 { 6857 {
6907 m_host.AddScriptLPS(1); 6858 m_host.AddScriptLPS(1);
6908 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 6859 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
@@ -6925,7 +6876,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6925// wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); 6876// wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg);
6926 } 6877 }
6927 6878
6928 public string llRequestSimulatorData(string simulator, int data) 6879 public LSL_Types.LSLString llRequestSimulatorData(string simulator, int data)
6929 { 6880 {
6930 try 6881 try
6931 { 6882 {
@@ -6999,7 +6950,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6999 m_host.SetForceMouselook(mouselook != 0); 6950 m_host.SetForceMouselook(mouselook != 0);
7000 } 6951 }
7001 6952
7002 public double llGetObjectMass(string id) 6953 public LSL_Types.LSLFloat llGetObjectMass(string id)
7003 { 6954 {
7004 m_host.AddScriptLPS(1); 6955 m_host.AddScriptLPS(1);
7005 UUID key = new UUID(); 6956 UUID key = new UUID();
@@ -7159,8 +7110,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7159 { 7110 {
7160 if (commandList.Data[i + 1] is string) 7111 if (commandList.Data[i + 1] is string)
7161 { 7112 {
7162 //Set the new media URL only if the user is the owner of the land 7113 UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
7163 osSetParcelMediaURL(commandList.Data[i + 1].ToString()); 7114
7115 if (landowner == UUID.Zero)
7116 {
7117 return;
7118 }
7119
7120 if (landowner != m_host.ObjectOwner)
7121 {
7122 return;
7123 }
7124
7125 World.SetLandMediaURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, (string)commandList.GetLSLStringItem(i + 1));
7164 7126
7165 List<ScenePresence> scenePresenceList = World.GetScenePresences(); 7127 List<ScenePresence> scenePresenceList = World.GetScenePresences();
7166 LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 7128 LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
@@ -7312,7 +7274,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7312 // ScriptSleep(20000); 7274 // ScriptSleep(20000);
7313 } 7275 }
7314 7276
7315 public string llEscapeURL(string url) 7277 public LSL_Types.LSLString llEscapeURL(string url)
7316 { 7278 {
7317 m_host.AddScriptLPS(1); 7279 m_host.AddScriptLPS(1);
7318 try 7280 try
@@ -7325,7 +7287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7325 } 7287 }
7326 } 7288 }
7327 7289
7328 public string llUnescapeURL(string url) 7290 public LSL_Types.LSLString llUnescapeURL(string url)
7329 { 7291 {
7330 m_host.AddScriptLPS(1); 7292 m_host.AddScriptLPS(1);
7331 try 7293 try
@@ -7484,7 +7446,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7484 presence.ControllingClient.SendClearFollowCamProperties(objectID); 7446 presence.ControllingClient.SendClearFollowCamProperties(objectID);
7485 } 7447 }
7486 7448
7487 public double llListStatistics(int operation, LSL_Types.list src) 7449 public LSL_Types.LSLFloat llListStatistics(int operation, LSL_Types.list src)
7488 { 7450 {
7489 m_host.AddScriptLPS(1); 7451 m_host.AddScriptLPS(1);
7490 LSL_Types.list nums = LSL_Types.list.ToDoubleList(src); 7452 LSL_Types.list nums = LSL_Types.list.ToDoubleList(src);
@@ -7538,7 +7500,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7538 return (int)estate.GetRegionFlags(); 7500 return (int)estate.GetRegionFlags();
7539 } 7501 }
7540 7502
7541 public string llXorBase64StringsCorrect(string str1, string str2) 7503 public LSL_Types.LSLString llXorBase64StringsCorrect(string str1, string str2)
7542 { 7504 {
7543 m_host.AddScriptLPS(1); 7505 m_host.AddScriptLPS(1);
7544 string ret = String.Empty; 7506 string ret = String.Empty;
@@ -7556,7 +7518,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7556 return llStringToBase64(ret); 7518 return llStringToBase64(ret);
7557 } 7519 }
7558 7520
7559 public string llHTTPRequest(string url, LSL_Types.list parameters, string body) 7521 public LSL_Types.LSLString llHTTPRequest(string url, LSL_Types.list parameters, string body)
7560 { 7522 {
7561 // Partial implementation: support for parameter flags needed 7523 // Partial implementation: support for parameter flags needed
7562 // see http://wiki.secondlife.com/wiki/LlHTTPRequest 7524 // see http://wiki.secondlife.com/wiki/LlHTTPRequest
@@ -7809,7 +7771,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7809 // ScriptSleep(200); 7771 // ScriptSleep(200);
7810 } 7772 }
7811 7773
7812 public string llStringTrim(string src, int type) 7774 public LSL_Types.LSLString llStringTrim(string src, int type)
7813 { 7775 {
7814 m_host.AddScriptLPS(1); 7776 m_host.AddScriptLPS(1);
7815 if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); } 7777 if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); }
@@ -7940,7 +7902,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7940 World.AssetCache.GetAsset(assetID, delegate(UUID i, AssetBase a) { cb(i, a); }, false); 7902 World.AssetCache.GetAsset(assetID, delegate(UUID i, AssetBase a) { cb(i, a); }, false);
7941 } 7903 }
7942 7904
7943 public string llGetNumberOfNotecardLines(string name) 7905 public LSL_Types.LSLString llGetNumberOfNotecardLines(string name)
7944 { 7906 {
7945 m_host.AddScriptLPS(1); 7907 m_host.AddScriptLPS(1);
7946 7908
@@ -7978,7 +7940,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7978 return UUID.Zero.ToString(); 7940 return UUID.Zero.ToString();
7979 } 7941 }
7980 7942
7981 public string llGetNotecardLine(string name, int line) 7943 public LSL_Types.LSLString llGetNotecardLine(string name, int line)
7982 { 7944 {
7983 m_host.AddScriptLPS(1); 7945 m_host.AddScriptLPS(1);
7984 7946