aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorMelanie2012-02-25 16:24:01 +0000
committerMelanie2012-02-25 16:24:01 +0000
commit6386fdcda774beacbbdf34c1472bbfe0090b00d8 (patch)
tree526eb46b696bde5abe134134e9bf0eedaa77b2f9 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentMerge branch 'master' into careminster (diff)
parentPRIM_SCULPT_FLAG_INVERT, PRIM_SCULPT_FLAG_MIRROR implemented (diff)
downloadopensim-SC-6386fdcda774beacbbdf34c1472bbfe0090b00d8.zip
opensim-SC-6386fdcda774beacbbdf34c1472bbfe0090b00d8.tar.gz
opensim-SC-6386fdcda774beacbbdf34c1472bbfe0090b00d8.tar.bz2
opensim-SC-6386fdcda774beacbbdf34c1472bbfe0090b00d8.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs116
1 files changed, 89 insertions, 27 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ba02a78..a6a2aa7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7550,10 +7550,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7550 shapeBlock.PathScaleX = 100; 7550 shapeBlock.PathScaleX = 100;
7551 shapeBlock.PathScaleY = 150; 7551 shapeBlock.PathScaleY = 150;
7552 7552
7553 if ((type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER) == 0 && 7553 int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR);
7554 (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE) == 0 && 7554
7555 (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE) == 0 && 7555 if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) &&
7556 (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) == 0) 7556 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) &&
7557 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) &&
7558 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
7557 { 7559 {
7558 // default 7560 // default
7559 type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; 7561 type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
@@ -8841,23 +8843,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8841 { 8843 {
8842 m_host.AddScriptLPS(1); 8844 m_host.AddScriptLPS(1);
8843 ScriptSleep(1000); 8845 ScriptSleep(1000);
8846 return GetPrimMediaParams(m_host, face, rules);
8847 }
8848
8849 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8850 {
8851 m_host.AddScriptLPS(1);
8852 ScriptSleep(1000);
8853 if (link == ScriptBaseClass.LINK_ROOT)
8854 return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
8855 else if (link == ScriptBaseClass.LINK_THIS)
8856 return GetPrimMediaParams(m_host, face, rules);
8857 else
8858 {
8859 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8860 if (null != part)
8861 return GetPrimMediaParams(part, face, rules);
8862 }
8863
8864 return new LSL_List();
8865 }
8844 8866
8867 private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules)
8868 {
8845 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid 8869 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
8846 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). 8870 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
8847 // Assuming silently fail means give back an empty list. Ideally, need to check this. 8871 // Assuming silently fail means give back an empty list. Ideally, need to check this.
8848 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8872 if (face < 0 || face > part.GetNumberOfSides() - 1)
8849 return new LSL_List(); 8873 return new LSL_List();
8850 8874
8851 return GetPrimMediaParams(face, rules);
8852 }
8853
8854 private LSL_List GetPrimMediaParams(int face, LSL_List rules)
8855 {
8856 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8875 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8857 if (null == module) 8876 if (null == module)
8858 throw new Exception("Media on a prim functions not available"); 8877 return new LSL_List();
8859 8878
8860 MediaEntry me = module.GetMediaEntry(m_host, face); 8879 MediaEntry me = module.GetMediaEntry(part, face);
8861 8880
8862 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams 8881 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
8863 if (null == me) 8882 if (null == me)
@@ -8939,33 +8958,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8939 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8958 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8940 res.Add(new LSL_Integer((int)me.ControlPermissions)); 8959 res.Add(new LSL_Integer((int)me.ControlPermissions));
8941 break; 8960 break;
8961
8962 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
8942 } 8963 }
8943 } 8964 }
8944 8965
8945 return res; 8966 return res;
8946 } 8967 }
8947 8968
8948 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 8969 public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
8949 { 8970 {
8950 m_host.AddScriptLPS(1); 8971 m_host.AddScriptLPS(1);
8951 ScriptSleep(1000); 8972 ScriptSleep(1000);
8973 return SetPrimMediaParams(m_host, face, rules);
8974 }
8952 8975
8953 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid 8976 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8954 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 8977 {
8955 // Don't perform the media check directly 8978 m_host.AddScriptLPS(1);
8956 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8979 ScriptSleep(1000);
8957 return ScriptBaseClass.LSL_STATUS_OK; 8980 if (link == ScriptBaseClass.LINK_ROOT)
8981 return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
8982 else if (link == ScriptBaseClass.LINK_THIS)
8983 return SetPrimMediaParams(m_host, face, rules);
8984 else
8985 {
8986 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8987 if (null != part)
8988 return SetPrimMediaParams(part, face, rules);
8989 }
8958 8990
8959 return SetPrimMediaParams(face, rules); 8991 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8960 } 8992 }
8961 8993
8962 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) 8994 private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules)
8963 { 8995 {
8996 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
8997 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
8998 // Don't perform the media check directly
8999 if (face < 0 || face > part.GetNumberOfSides() - 1)
9000 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
9001
8964 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 9002 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8965 if (null == module) 9003 if (null == module)
8966 throw new Exception("Media on a prim functions not available"); 9004 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
8967 9005
8968 MediaEntry me = module.GetMediaEntry(m_host, face); 9006 MediaEntry me = module.GetMediaEntry(part, face);
8969 if (null == me) 9007 if (null == me)
8970 me = new MediaEntry(); 9008 me = new MediaEntry();
8971 9009
@@ -9044,10 +9082,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9044 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 9082 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
9045 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 9083 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
9046 break; 9084 break;
9085
9086 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
9047 } 9087 }
9048 } 9088 }
9049 9089
9050 module.SetMediaEntry(m_host, face, me); 9090 module.SetMediaEntry(part, face, me);
9051 9091
9052 return ScriptBaseClass.LSL_STATUS_OK; 9092 return ScriptBaseClass.LSL_STATUS_OK;
9053 } 9093 }
@@ -9056,18 +9096,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9056 { 9096 {
9057 m_host.AddScriptLPS(1); 9097 m_host.AddScriptLPS(1);
9058 ScriptSleep(1000); 9098 ScriptSleep(1000);
9099 return ClearPrimMedia(m_host, face);
9100 }
9101
9102 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
9103 {
9104 m_host.AddScriptLPS(1);
9105 ScriptSleep(1000);
9106 if (link == ScriptBaseClass.LINK_ROOT)
9107 return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
9108 else if (link == ScriptBaseClass.LINK_THIS)
9109 return ClearPrimMedia(m_host, face);
9110 else
9111 {
9112 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
9113 if (null != part)
9114 return ClearPrimMedia(part, face);
9115 }
9059 9116
9117 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
9118 }
9119
9120 private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face)
9121 {
9060 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid 9122 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
9061 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 9123 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
9062 // FIXME: Don't perform the media check directly 9124 // FIXME: Don't perform the media check directly
9063 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 9125 if (face < 0 || face > part.GetNumberOfSides() - 1)
9064 return ScriptBaseClass.LSL_STATUS_OK; 9126 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
9065 9127
9066 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 9128 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
9067 if (null == module) 9129 if (null == module)
9068 throw new Exception("Media on a prim functions not available"); 9130 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
9069 9131
9070 module.ClearMediaEntry(m_host, face); 9132 module.ClearMediaEntry(part, face);
9071 9133
9072 return ScriptBaseClass.LSL_STATUS_OK; 9134 return ScriptBaseClass.LSL_STATUS_OK;
9073 } 9135 }