aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-12 19:46:23 +0100
committerJustin Clark-Casey (justincc)2010-07-26 23:34:19 +0100
commita5ad792e6c90eb9412325e636c6e4eafc4a8a91d (patch)
treef1acb8a3b4bcd249d4d913e5ea15f5ba45d234de /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentImplement llGetPrimMediaParams() (diff)
downloadopensim-SC_OLD-a5ad792e6c90eb9412325e636c6e4eafc4a8a91d.zip
opensim-SC_OLD-a5ad792e6c90eb9412325e636c6e4eafc4a8a91d.tar.gz
opensim-SC_OLD-a5ad792e6c90eb9412325e636c6e4eafc4a8a91d.tar.bz2
opensim-SC_OLD-a5ad792e6c90eb9412325e636c6e4eafc4a8a91d.tar.xz
implement llSetPrimMediaParams()
Untested
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs113
1 files changed, 112 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e18e33e..4d57193 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7816,7 +7816,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7816 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid 7816 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
7817 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). 7817 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
7818 // Assuming silently fail means give back an empty list. Ideally, need to check this. 7818 // Assuming silently fail means give back an empty list. Ideally, need to check this.
7819 if (face < 0 || face > m_host.Shape.Media.Count - 1) 7819 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
7820 return new LSL_List(); 7820 return new LSL_List();
7821 7821
7822 return GetLinkPrimMediaParams(face, rules); 7822 return GetLinkPrimMediaParams(face, rules);
@@ -7830,6 +7830,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7830 7830
7831 MediaEntry me = module.GetMediaEntry(m_host, face); 7831 MediaEntry me = module.GetMediaEntry(m_host, face);
7832 7832
7833 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
7834 if (null == me)
7835 return new LSL_List();
7836
7833 LSL_List res = new LSL_List(); 7837 LSL_List res = new LSL_List();
7834 7838
7835 for (int i = 0; i < rules.Length; i++) 7839 for (int i = 0; i < rules.Length; i++)
@@ -7912,6 +7916,113 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7912 return res; 7916 return res;
7913 } 7917 }
7914 7918
7919 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
7920 {
7921 m_host.AddScriptLPS(1);
7922 ScriptSleep(1000);
7923
7924 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
7925 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
7926 // Don't perform the media check directly
7927 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
7928 return ScriptBaseClass.LSL_STATUS_OK;
7929
7930 return SetPrimMediaParams(face, rules);
7931 }
7932
7933 public LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
7934 {
7935 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
7936 if (null == module)
7937 throw new Exception("Media on a prim functions not available");
7938
7939 MediaEntry me = module.GetMediaEntry(m_host, face);
7940 if (null == me)
7941 me = new MediaEntry();
7942
7943 int i = 0;
7944
7945 while (i < rules.Length - 1)
7946 {
7947 int code = rules.GetLSLIntegerItem(i++);
7948
7949 switch (code)
7950 {
7951 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
7952 me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ? true : false);
7953 break;
7954
7955 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
7956 int v = rules.GetLSLIntegerItem(i++);
7957 if (ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD == v)
7958 me.Controls = MediaControls.Standard;
7959 else
7960 me.Controls = MediaControls.Mini;
7961 break;
7962
7963 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
7964 me.CurrentURL = rules.GetLSLStringItem(i++);
7965 break;
7966
7967 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
7968 me.HomeURL = rules.GetLSLStringItem(i++);
7969 break;
7970
7971 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
7972 me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7973 break;
7974
7975 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
7976 me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7977 break;
7978
7979 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
7980 me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7981 break;
7982
7983 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
7984 me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7985 break;
7986
7987 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
7988 me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7989 break;
7990
7991 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
7992 me.Width = (int)rules.GetLSLIntegerItem(i++);
7993 break;
7994
7995 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
7996 me.Height = (int)rules.GetLSLIntegerItem(i++);
7997 break;
7998
7999 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
8000 me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8001 break;
8002
8003 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
8004 string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' });
8005 List<string> whiteListUrls = new List<string>();
8006 Array.ForEach(
8007 rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); });
8008 me.WhiteList = whiteListUrls.ToArray();
8009 break;
8010
8011 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
8012 me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8013 break;
8014
8015 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8016 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8017 break;
8018 }
8019 }
8020
8021 module.SetMediaEntry(m_host, face, me);
8022
8023 return ScriptBaseClass.LSL_STATUS_OK;
8024 }
8025
7915 // <remarks> 8026 // <remarks>
7916 // <para> 8027 // <para>
7917 // The .NET definition of base 64 is: 8028 // The .NET definition of base 64 is: