aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie2010-08-06 17:47:55 +0100
committerMelanie2010-08-06 17:47:55 +0100
commit1cd441d5de0e19aac230e3bc8eac211662f209b5 (patch)
tree6b6a69e755fd72d894f8b3742efde6189883570e /OpenSim/Region/ScriptEngine
parentFixes: llSetLinkPrimitiveParams - PRIM_POSITION is not relative to root, caus... (diff)
parentMerge branch 'moap' (diff)
downloadopensim-SC_OLD-1cd441d5de0e19aac230e3bc8eac211662f209b5.zip
opensim-SC_OLD-1cd441d5de0e19aac230e3bc8eac211662f209b5.tar.gz
opensim-SC_OLD-1cd441d5de0e19aac230e3bc8eac211662f209b5.tar.bz2
opensim-SC_OLD-1cd441d5de0e19aac230e3bc8eac211662f209b5.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs235
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs36
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs15
4 files changed, 289 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 50ea489..ba1a5f1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7848,6 +7848,241 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7848 return res; 7848 return res;
7849 } 7849 }
7850 7850
7851 public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
7852 {
7853 m_host.AddScriptLPS(1);
7854 ScriptSleep(1000);
7855
7856 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
7857 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
7858 // Assuming silently fail means give back an empty list. Ideally, need to check this.
7859 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
7860 return new LSL_List();
7861
7862 return GetPrimMediaParams(face, rules);
7863 }
7864
7865 private LSL_List GetPrimMediaParams(int face, LSL_List rules)
7866 {
7867 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
7868 if (null == module)
7869 throw new Exception("Media on a prim functions not available");
7870
7871 MediaEntry me = module.GetMediaEntry(m_host, face);
7872
7873 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
7874 if (null == me)
7875 return new LSL_List();
7876
7877 LSL_List res = new LSL_List();
7878
7879 for (int i = 0; i < rules.Length; i++)
7880 {
7881 int code = (int)rules.GetLSLIntegerItem(i);
7882
7883 switch (code)
7884 {
7885 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
7886 // Not implemented
7887 res.Add(new LSL_Integer(0));
7888 break;
7889
7890 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
7891 if (me.Controls == MediaControls.Standard)
7892 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD));
7893 else
7894 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI));
7895 break;
7896
7897 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
7898 res.Add(new LSL_String(me.CurrentURL));
7899 break;
7900
7901 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
7902 res.Add(new LSL_String(me.HomeURL));
7903 break;
7904
7905 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
7906 res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7907 break;
7908
7909 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
7910 res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7911 break;
7912
7913 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
7914 res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7915 break;
7916
7917 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
7918 res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7919 break;
7920
7921 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
7922 res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7923 break;
7924
7925 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
7926 res.Add(new LSL_Integer(me.Width));
7927 break;
7928
7929 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
7930 res.Add(new LSL_Integer(me.Height));
7931 break;
7932
7933 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
7934 res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7935 break;
7936
7937 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
7938 string[] urls = (string[])me.WhiteList.Clone();
7939
7940 for (int j = 0; j < urls.Length; j++)
7941 urls[j] = Uri.EscapeDataString(urls[j]);
7942
7943 res.Add(new LSL_String(string.Join(", ", urls)));
7944 break;
7945
7946 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
7947 res.Add(new LSL_Integer((int)me.InteractPermissions));
7948 break;
7949
7950 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
7951 res.Add(new LSL_Integer((int)me.ControlPermissions));
7952 break;
7953 }
7954 }
7955
7956 return res;
7957 }
7958
7959 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
7960 {
7961 m_host.AddScriptLPS(1);
7962 ScriptSleep(1000);
7963
7964 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
7965 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
7966 // Don't perform the media check directly
7967 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
7968 return ScriptBaseClass.LSL_STATUS_OK;
7969
7970 return SetPrimMediaParams(face, rules);
7971 }
7972
7973 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
7974 {
7975 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
7976 if (null == module)
7977 throw new Exception("Media on a prim functions not available");
7978
7979 MediaEntry me = module.GetMediaEntry(m_host, face);
7980 if (null == me)
7981 me = new MediaEntry();
7982
7983 int i = 0;
7984
7985 while (i < rules.Length - 1)
7986 {
7987 int code = rules.GetLSLIntegerItem(i++);
7988
7989 switch (code)
7990 {
7991 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
7992 me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ? true : false);
7993 break;
7994
7995 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
7996 int v = rules.GetLSLIntegerItem(i++);
7997 if (ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD == v)
7998 me.Controls = MediaControls.Standard;
7999 else
8000 me.Controls = MediaControls.Mini;
8001 break;
8002
8003 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
8004 me.CurrentURL = rules.GetLSLStringItem(i++);
8005 break;
8006
8007 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
8008 me.HomeURL = rules.GetLSLStringItem(i++);
8009 break;
8010
8011 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
8012 me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8013 break;
8014
8015 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
8016 me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8017 break;
8018
8019 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
8020 me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8021 break;
8022
8023 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
8024 me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8025 break;
8026
8027 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
8028 me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8029 break;
8030
8031 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
8032 me.Width = (int)rules.GetLSLIntegerItem(i++);
8033 break;
8034
8035 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
8036 me.Height = (int)rules.GetLSLIntegerItem(i++);
8037 break;
8038
8039 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
8040 me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8041 break;
8042
8043 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
8044 string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' });
8045 List<string> whiteListUrls = new List<string>();
8046 Array.ForEach(
8047 rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); });
8048 me.WhiteList = whiteListUrls.ToArray();
8049 break;
8050
8051 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
8052 me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8053 break;
8054
8055 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8056 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8057 break;
8058 }
8059 }
8060
8061 module.SetMediaEntry(m_host, face, me);
8062
8063 return ScriptBaseClass.LSL_STATUS_OK;
8064 }
8065
8066 public LSL_Integer llClearPrimMedia(LSL_Integer face)
8067 {
8068 m_host.AddScriptLPS(1);
8069 ScriptSleep(1000);
8070
8071 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
8072 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
8073 // FIXME: Don't perform the media check directly
8074 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
8075 return ScriptBaseClass.LSL_STATUS_OK;
8076
8077 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8078 if (null == module)
8079 throw new Exception("Media on a prim functions not available");
8080
8081 module.ClearMediaEntry(m_host, face);
8082
8083 return ScriptBaseClass.LSL_STATUS_OK;
8084 }
8085
7851 // <remarks> 8086 // <remarks>
7852 // <para> 8087 // <para>
7853 // The .NET definition of base 64 is: 8088 // The .NET definition of base 64 is:
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index cba46a3..561e3b3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -62,6 +62,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
62 void llBreakLink(int linknum); 62 void llBreakLink(int linknum);
63 LSL_Integer llCeil(double f); 63 LSL_Integer llCeil(double f);
64 void llClearCameraParams(); 64 void llClearCameraParams();
65 LSL_Integer llClearPrimMedia(LSL_Integer face);
65 void llCloseRemoteDataChannel(string channel); 66 void llCloseRemoteDataChannel(string channel);
66 LSL_Float llCloud(LSL_Vector offset); 67 LSL_Float llCloud(LSL_Vector offset);
67 void llCollisionFilter(string name, string id, int accept); 68 void llCollisionFilter(string name, string id, int accept);
@@ -162,6 +163,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
162 LSL_List llGetParcelPrimOwners(LSL_Vector pos); 163 LSL_List llGetParcelPrimOwners(LSL_Vector pos);
163 LSL_Integer llGetPermissions(); 164 LSL_Integer llGetPermissions();
164 LSL_Key llGetPermissionsKey(); 165 LSL_Key llGetPermissionsKey();
166 LSL_List llGetPrimMediaParams(int face, LSL_List rules);
165 LSL_Vector llGetPos(); 167 LSL_Vector llGetPos();
166 LSL_List llGetPrimitiveParams(LSL_List rules); 168 LSL_List llGetPrimitiveParams(LSL_List rules);
167 LSL_Integer llGetRegionAgentCount(); 169 LSL_Integer llGetRegionAgentCount();
@@ -332,6 +334,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
332 void llSetParcelMusicURL(string url); 334 void llSetParcelMusicURL(string url);
333 void llSetPayPrice(int price, LSL_List quick_pay_buttons); 335 void llSetPayPrice(int price, LSL_List quick_pay_buttons);
334 void llSetPos(LSL_Vector pos); 336 void llSetPos(LSL_Vector pos);
337 LSL_Integer llSetPrimMediaParams(int face, LSL_List rules);
335 void llSetPrimitiveParams(LSL_List rules); 338 void llSetPrimitiveParams(LSL_List rules);
336 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); 339 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
337 void llSetPrimURL(string url); 340 void llSetPrimURL(string url);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 69f48c9..5da6bb9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -277,6 +277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
277 public const int CHANGED_TELEPORT = 512; 277 public const int CHANGED_TELEPORT = 512;
278 public const int CHANGED_REGION_RESTART = 1024; 278 public const int CHANGED_REGION_RESTART = 1024;
279 public const int CHANGED_REGION_START = 1024; //LL Changed the constant from CHANGED_REGION_RESTART 279 public const int CHANGED_REGION_START = 1024; //LL Changed the constant from CHANGED_REGION_RESTART
280 public const int CHANGED_MEDIA = 2048;
280 public const int CHANGED_ANIMATION = 16384; 281 public const int CHANGED_ANIMATION = 16384;
281 public const int TYPE_INVALID = 0; 282 public const int TYPE_INVALID = 0;
282 public const int TYPE_INTEGER = 1; 283 public const int TYPE_INTEGER = 1;
@@ -518,6 +519,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
518 public const int TOUCH_INVALID_FACE = -1; 519 public const int TOUCH_INVALID_FACE = -1;
519 public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); 520 public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0);
520 public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR; 521 public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR;
522
523 // constants for llGetPrimMediaParams/llSetPrimMediaParams
524 public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0;
525 public const int PRIM_MEDIA_CONTROLS = 1;
526 public const int PRIM_MEDIA_CURRENT_URL = 2;
527 public const int PRIM_MEDIA_HOME_URL = 3;
528 public const int PRIM_MEDIA_AUTO_LOOP = 4;
529 public const int PRIM_MEDIA_AUTO_PLAY = 5;
530 public const int PRIM_MEDIA_AUTO_SCALE = 6;
531 public const int PRIM_MEDIA_AUTO_ZOOM = 7;
532 public const int PRIM_MEDIA_FIRST_CLICK_INTERACT = 8;
533 public const int PRIM_MEDIA_WIDTH_PIXELS = 9;
534 public const int PRIM_MEDIA_HEIGHT_PIXELS = 10;
535 public const int PRIM_MEDIA_WHITELIST_ENABLE = 11;
536 public const int PRIM_MEDIA_WHITELIST = 12;
537 public const int PRIM_MEDIA_PERMS_INTERACT = 13;
538 public const int PRIM_MEDIA_PERMS_CONTROL = 14;
539
540 public const int PRIM_MEDIA_CONTROLS_STANDARD = 0;
541 public const int PRIM_MEDIA_CONTROLS_MINI = 1;
542
543 public const int PRIM_MEDIA_PERM_NONE = 0;
544 public const int PRIM_MEDIA_PERM_OWNER = 1;
545 public const int PRIM_MEDIA_PERM_GROUP = 2;
546 public const int PRIM_MEDIA_PERM_ANYONE = 4;
547
548 // extra constants for llSetPrimMediaParams
549 public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0);
550 public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000);
551 public static readonly LSLInteger LSL_STATUS_TYPE_MISMATCH = new LSLInteger(1001);
552 public static readonly LSLInteger LSL_STATUS_BOUNDS_ERROR = new LSLInteger(1002);
553 public static readonly LSLInteger LSL_STATUS_NOT_FOUND = new LSLInteger(1003);
554 public static readonly LSLInteger LSL_STATUS_NOT_SUPPORTED = new LSLInteger(1004);
555 public static readonly LSLInteger LSL_STATUS_INTERNAL_ERROR = new LSLInteger(1999);
556 public static readonly LSLInteger LSL_STATUS_WHITELIST_FAILED = new LSLInteger(2001);
521 557
522 // Constants for default textures 558 // Constants for default textures
523 public const string TEXTURE_BLANK = "5748decc-f629-461c-9a36-a35a221fe21f"; 559 public const string TEXTURE_BLANK = "5748decc-f629-461c-9a36-a35a221fe21f";
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 3339995..451163f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1832,5 +1832,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1832 { 1832 {
1833 return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); 1833 return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2);
1834 } 1834 }
1835
1836 public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
1837 {
1838 return m_LSL_Functions.llGetPrimMediaParams(face, rules);
1839 }
1840
1841 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
1842 {
1843 return m_LSL_Functions.llSetPrimMediaParams(face, rules);
1844 }
1845
1846 public LSL_Integer llClearPrimMedia(LSL_Integer face)
1847 {
1848 return m_LSL_Functions.llClearPrimMedia(face);
1849 }
1835 } 1850 }
1836} 1851}