aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
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 f26fc2e..139b4f1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7842,6 +7842,241 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7842 return res; 7842 return res;
7843 } 7843 }
7844 7844
7845 public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
7846 {
7847 m_host.AddScriptLPS(1);
7848 ScriptSleep(1000);
7849
7850 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
7851 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
7852 // Assuming silently fail means give back an empty list. Ideally, need to check this.
7853 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
7854 return new LSL_List();
7855
7856 return GetPrimMediaParams(face, rules);
7857 }
7858
7859 private LSL_List GetPrimMediaParams(int face, LSL_List rules)
7860 {
7861 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
7862 if (null == module)
7863 throw new Exception("Media on a prim functions not available");
7864
7865 MediaEntry me = module.GetMediaEntry(m_host, face);
7866
7867 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
7868 if (null == me)
7869 return new LSL_List();
7870
7871 LSL_List res = new LSL_List();
7872
7873 for (int i = 0; i < rules.Length; i++)
7874 {
7875 int code = (int)rules.GetLSLIntegerItem(i);
7876
7877 switch (code)
7878 {
7879 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
7880 // Not implemented
7881 res.Add(new LSL_Integer(0));
7882 break;
7883
7884 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
7885 if (me.Controls == MediaControls.Standard)
7886 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD));
7887 else
7888 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI));
7889 break;
7890
7891 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
7892 res.Add(new LSL_String(me.CurrentURL));
7893 break;
7894
7895 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
7896 res.Add(new LSL_String(me.HomeURL));
7897 break;
7898
7899 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
7900 res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7901 break;
7902
7903 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
7904 res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7905 break;
7906
7907 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
7908 res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7909 break;
7910
7911 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
7912 res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7913 break;
7914
7915 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
7916 res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7917 break;
7918
7919 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
7920 res.Add(new LSL_Integer(me.Width));
7921 break;
7922
7923 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
7924 res.Add(new LSL_Integer(me.Height));
7925 break;
7926
7927 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
7928 res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7929 break;
7930
7931 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
7932 string[] urls = (string[])me.WhiteList.Clone();
7933
7934 for (int j = 0; j < urls.Length; j++)
7935 urls[j] = Uri.EscapeDataString(urls[j]);
7936
7937 res.Add(new LSL_String(string.Join(", ", urls)));
7938 break;
7939
7940 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
7941 res.Add(new LSL_Integer((int)me.InteractPermissions));
7942 break;
7943
7944 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
7945 res.Add(new LSL_Integer((int)me.ControlPermissions));
7946 break;
7947 }
7948 }
7949
7950 return res;
7951 }
7952
7953 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
7954 {
7955 m_host.AddScriptLPS(1);
7956 ScriptSleep(1000);
7957
7958 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
7959 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
7960 // Don't perform the media check directly
7961 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
7962 return ScriptBaseClass.LSL_STATUS_OK;
7963
7964 return SetPrimMediaParams(face, rules);
7965 }
7966
7967 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
7968 {
7969 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
7970 if (null == module)
7971 throw new Exception("Media on a prim functions not available");
7972
7973 MediaEntry me = module.GetMediaEntry(m_host, face);
7974 if (null == me)
7975 me = new MediaEntry();
7976
7977 int i = 0;
7978
7979 while (i < rules.Length - 1)
7980 {
7981 int code = rules.GetLSLIntegerItem(i++);
7982
7983 switch (code)
7984 {
7985 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
7986 me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ? true : false);
7987 break;
7988
7989 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
7990 int v = rules.GetLSLIntegerItem(i++);
7991 if (ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD == v)
7992 me.Controls = MediaControls.Standard;
7993 else
7994 me.Controls = MediaControls.Mini;
7995 break;
7996
7997 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
7998 me.CurrentURL = rules.GetLSLStringItem(i++);
7999 break;
8000
8001 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
8002 me.HomeURL = rules.GetLSLStringItem(i++);
8003 break;
8004
8005 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
8006 me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8007 break;
8008
8009 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
8010 me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8011 break;
8012
8013 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
8014 me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8015 break;
8016
8017 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
8018 me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8019 break;
8020
8021 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
8022 me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8023 break;
8024
8025 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
8026 me.Width = (int)rules.GetLSLIntegerItem(i++);
8027 break;
8028
8029 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
8030 me.Height = (int)rules.GetLSLIntegerItem(i++);
8031 break;
8032
8033 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
8034 me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8035 break;
8036
8037 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
8038 string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' });
8039 List<string> whiteListUrls = new List<string>();
8040 Array.ForEach(
8041 rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); });
8042 me.WhiteList = whiteListUrls.ToArray();
8043 break;
8044
8045 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
8046 me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8047 break;
8048
8049 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8050 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8051 break;
8052 }
8053 }
8054
8055 module.SetMediaEntry(m_host, face, me);
8056
8057 return ScriptBaseClass.LSL_STATUS_OK;
8058 }
8059
8060 public LSL_Integer llClearPrimMedia(LSL_Integer face)
8061 {
8062 m_host.AddScriptLPS(1);
8063 ScriptSleep(1000);
8064
8065 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
8066 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
8067 // FIXME: Don't perform the media check directly
8068 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
8069 return ScriptBaseClass.LSL_STATUS_OK;
8070
8071 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8072 if (null == module)
8073 throw new Exception("Media on a prim functions not available");
8074
8075 module.ClearMediaEntry(m_host, face);
8076
8077 return ScriptBaseClass.LSL_STATUS_OK;
8078 }
8079
7845 // <remarks> 8080 // <remarks>
7846 // <para> 8081 // <para>
7847 // The .NET definition of base 64 is: 8082 // 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}