diff options
Diffstat (limited to 'OpenSim')
3 files changed, 105 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 2eba2b1..525c3c3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -8173,23 +8173,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8173 | { | 8173 | { |
8174 | m_host.AddScriptLPS(1); | 8174 | m_host.AddScriptLPS(1); |
8175 | ScriptSleep(1000); | 8175 | ScriptSleep(1000); |
8176 | return GetPrimMediaParams(m_host, face, rules); | ||
8177 | } | ||
8178 | |||
8179 | public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) | ||
8180 | { | ||
8181 | m_host.AddScriptLPS(1); | ||
8182 | ScriptSleep(1000); | ||
8183 | if (link == ScriptBaseClass.LINK_ROOT) | ||
8184 | return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); | ||
8185 | else if (link == ScriptBaseClass.LINK_THIS) | ||
8186 | return GetPrimMediaParams(m_host, face, rules); | ||
8187 | else | ||
8188 | { | ||
8189 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
8190 | if (null != part) | ||
8191 | return GetPrimMediaParams(part, face, rules); | ||
8192 | } | ||
8193 | |||
8194 | return new LSL_List(); | ||
8195 | } | ||
8176 | 8196 | ||
8197 | private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules) | ||
8198 | { | ||
8177 | // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid | 8199 | // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid |
8178 | // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). | 8200 | // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). |
8179 | // Assuming silently fail means give back an empty list. Ideally, need to check this. | 8201 | // Assuming silently fail means give back an empty list. Ideally, need to check this. |
8180 | if (face < 0 || face > m_host.GetNumberOfSides() - 1) | 8202 | if (face < 0 || face > part.GetNumberOfSides() - 1) |
8181 | return new LSL_List(); | 8203 | return new LSL_List(); |
8182 | 8204 | ||
8183 | return GetPrimMediaParams(face, rules); | ||
8184 | } | ||
8185 | |||
8186 | private LSL_List GetPrimMediaParams(int face, LSL_List rules) | ||
8187 | { | ||
8188 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | 8205 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); |
8189 | if (null == module) | 8206 | if (null == module) |
8190 | throw new Exception("Media on a prim functions not available"); | 8207 | return new LSL_List(); |
8191 | 8208 | ||
8192 | MediaEntry me = module.GetMediaEntry(m_host, face); | 8209 | MediaEntry me = module.GetMediaEntry(part, face); |
8193 | 8210 | ||
8194 | // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams | 8211 | // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams |
8195 | if (null == me) | 8212 | if (null == me) |
@@ -8271,33 +8288,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8271 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: | 8288 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: |
8272 | res.Add(new LSL_Integer((int)me.ControlPermissions)); | 8289 | res.Add(new LSL_Integer((int)me.ControlPermissions)); |
8273 | break; | 8290 | break; |
8291 | |||
8292 | default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; | ||
8274 | } | 8293 | } |
8275 | } | 8294 | } |
8276 | 8295 | ||
8277 | return res; | 8296 | return res; |
8278 | } | 8297 | } |
8279 | 8298 | ||
8280 | public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) | 8299 | public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) |
8281 | { | 8300 | { |
8282 | m_host.AddScriptLPS(1); | 8301 | m_host.AddScriptLPS(1); |
8283 | ScriptSleep(1000); | 8302 | ScriptSleep(1000); |
8303 | return SetPrimMediaParams(m_host, face, rules); | ||
8304 | } | ||
8284 | 8305 | ||
8285 | // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid | 8306 | public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) |
8286 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. | 8307 | { |
8287 | // Don't perform the media check directly | 8308 | m_host.AddScriptLPS(1); |
8288 | if (face < 0 || face > m_host.GetNumberOfSides() - 1) | 8309 | ScriptSleep(1000); |
8289 | return ScriptBaseClass.LSL_STATUS_OK; | 8310 | if (link == ScriptBaseClass.LINK_ROOT) |
8311 | return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); | ||
8312 | else if (link == ScriptBaseClass.LINK_THIS) | ||
8313 | return SetPrimMediaParams(m_host, face, rules); | ||
8314 | else | ||
8315 | { | ||
8316 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
8317 | if (null != part) | ||
8318 | return SetPrimMediaParams(part, face, rules); | ||
8319 | } | ||
8290 | 8320 | ||
8291 | return SetPrimMediaParams(face, rules); | 8321 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; |
8292 | } | 8322 | } |
8293 | 8323 | ||
8294 | private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) | 8324 | private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules) |
8295 | { | 8325 | { |
8326 | // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid | ||
8327 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. | ||
8328 | // Don't perform the media check directly | ||
8329 | if (face < 0 || face > part.GetNumberOfSides() - 1) | ||
8330 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; | ||
8331 | |||
8296 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | 8332 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); |
8297 | if (null == module) | 8333 | if (null == module) |
8298 | throw new Exception("Media on a prim functions not available"); | 8334 | return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; |
8299 | 8335 | ||
8300 | MediaEntry me = module.GetMediaEntry(m_host, face); | 8336 | MediaEntry me = module.GetMediaEntry(part, face); |
8301 | if (null == me) | 8337 | if (null == me) |
8302 | me = new MediaEntry(); | 8338 | me = new MediaEntry(); |
8303 | 8339 | ||
@@ -8376,10 +8412,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8376 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: | 8412 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: |
8377 | me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); | 8413 | me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); |
8378 | break; | 8414 | break; |
8415 | |||
8416 | default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; | ||
8379 | } | 8417 | } |
8380 | } | 8418 | } |
8381 | 8419 | ||
8382 | module.SetMediaEntry(m_host, face, me); | 8420 | module.SetMediaEntry(part, face, me); |
8383 | 8421 | ||
8384 | return ScriptBaseClass.LSL_STATUS_OK; | 8422 | return ScriptBaseClass.LSL_STATUS_OK; |
8385 | } | 8423 | } |
@@ -8388,18 +8426,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8388 | { | 8426 | { |
8389 | m_host.AddScriptLPS(1); | 8427 | m_host.AddScriptLPS(1); |
8390 | ScriptSleep(1000); | 8428 | ScriptSleep(1000); |
8429 | return ClearPrimMedia(m_host, face); | ||
8430 | } | ||
8391 | 8431 | ||
8432 | public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) | ||
8433 | { | ||
8434 | m_host.AddScriptLPS(1); | ||
8435 | ScriptSleep(1000); | ||
8436 | if (link == ScriptBaseClass.LINK_ROOT) | ||
8437 | return ClearPrimMedia(m_host.ParentGroup.RootPart, face); | ||
8438 | else if (link == ScriptBaseClass.LINK_THIS) | ||
8439 | return ClearPrimMedia(m_host, face); | ||
8440 | else | ||
8441 | { | ||
8442 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
8443 | if (null != part) | ||
8444 | return ClearPrimMedia(part, face); | ||
8445 | } | ||
8446 | |||
8447 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; | ||
8448 | } | ||
8449 | |||
8450 | private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face) | ||
8451 | { | ||
8392 | // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid | 8452 | // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid |
8393 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. | 8453 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. |
8394 | // FIXME: Don't perform the media check directly | 8454 | // FIXME: Don't perform the media check directly |
8395 | if (face < 0 || face > m_host.GetNumberOfSides() - 1) | 8455 | if (face < 0 || face > part.GetNumberOfSides() - 1) |
8396 | return ScriptBaseClass.LSL_STATUS_OK; | 8456 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; |
8397 | 8457 | ||
8398 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | 8458 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); |
8399 | if (null == module) | 8459 | if (null == module) |
8400 | throw new Exception("Media on a prim functions not available"); | 8460 | return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; |
8401 | 8461 | ||
8402 | module.ClearMediaEntry(m_host, face); | 8462 | module.ClearMediaEntry(part, face); |
8403 | 8463 | ||
8404 | return ScriptBaseClass.LSL_STATUS_OK; | 8464 | return ScriptBaseClass.LSL_STATUS_OK; |
8405 | } | 8465 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 7d39ccc..0f53bc3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
64 | LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); | 64 | LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); |
65 | LSL_Integer llCeil(double f); | 65 | LSL_Integer llCeil(double f); |
66 | void llClearCameraParams(); | 66 | void llClearCameraParams(); |
67 | LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face); | ||
67 | LSL_Integer llClearPrimMedia(LSL_Integer face); | 68 | LSL_Integer llClearPrimMedia(LSL_Integer face); |
68 | void llCloseRemoteDataChannel(string channel); | 69 | void llCloseRemoteDataChannel(string channel); |
69 | LSL_Float llCloud(LSL_Vector offset); | 70 | LSL_Float llCloud(LSL_Vector offset); |
@@ -139,7 +140,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
139 | LSL_String llGetLinkName(int linknum); | 140 | LSL_String llGetLinkName(int linknum); |
140 | LSL_Integer llGetLinkNumber(); | 141 | LSL_Integer llGetLinkNumber(); |
141 | LSL_Integer llGetLinkNumberOfSides(int link); | 142 | LSL_Integer llGetLinkNumberOfSides(int link); |
142 | LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); | 143 | LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); |
144 | LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); | ||
143 | LSL_Integer llGetListEntryType(LSL_List src, int index); | 145 | LSL_Integer llGetListEntryType(LSL_List src, int index); |
144 | LSL_Integer llGetListLength(LSL_List src); | 146 | LSL_Integer llGetListLength(LSL_List src); |
145 | LSL_Vector llGetLocalPos(); | 147 | LSL_Vector llGetLocalPos(); |
@@ -335,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
335 | void llSetInventoryPermMask(string item, int mask, int value); | 337 | void llSetInventoryPermMask(string item, int mask, int value); |
336 | void llSetLinkAlpha(int linknumber, double alpha, int face); | 338 | void llSetLinkAlpha(int linknumber, double alpha, int face); |
337 | void llSetLinkColor(int linknumber, LSL_Vector color, int face); | 339 | void llSetLinkColor(int linknumber, LSL_Vector color, int face); |
340 | LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); | ||
338 | void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); | 341 | void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); |
339 | void llSetLinkTexture(int linknumber, string texture, int face); | 342 | void llSetLinkTexture(int linknumber, string texture, int face); |
340 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); | 343 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); |
@@ -345,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
345 | void llSetParcelMusicURL(string url); | 348 | void llSetParcelMusicURL(string url); |
346 | void llSetPayPrice(int price, LSL_List quick_pay_buttons); | 349 | void llSetPayPrice(int price, LSL_List quick_pay_buttons); |
347 | void llSetPos(LSL_Vector pos); | 350 | void llSetPos(LSL_Vector pos); |
348 | LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); | 351 | LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules); |
349 | void llSetPrimitiveParams(LSL_List rules); | 352 | void llSetPrimitiveParams(LSL_List rules); |
350 | void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); | 353 | void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); |
351 | void llSetPrimURL(string url); | 354 | void llSetPrimURL(string url); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 24c3d95..f8e3c36 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1887,17 +1887,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1887 | { | 1887 | { |
1888 | return m_LSL_Functions.llGetPrimMediaParams(face, rules); | 1888 | return m_LSL_Functions.llGetPrimMediaParams(face, rules); |
1889 | } | 1889 | } |
1890 | 1890 | ||
1891 | public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) | ||
1892 | { | ||
1893 | return m_LSL_Functions.llGetLinkMedia(link, face, rules); | ||
1894 | } | ||
1895 | |||
1891 | public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) | 1896 | public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) |
1892 | { | 1897 | { |
1893 | return m_LSL_Functions.llSetPrimMediaParams(face, rules); | 1898 | return m_LSL_Functions.llSetPrimMediaParams(face, rules); |
1894 | } | 1899 | } |
1895 | 1900 | ||
1901 | public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) | ||
1902 | { | ||
1903 | return m_LSL_Functions.llSetLinkMedia(link, face, rules); | ||
1904 | } | ||
1905 | |||
1896 | public LSL_Integer llClearPrimMedia(LSL_Integer face) | 1906 | public LSL_Integer llClearPrimMedia(LSL_Integer face) |
1897 | { | 1907 | { |
1898 | return m_LSL_Functions.llClearPrimMedia(face); | 1908 | return m_LSL_Functions.llClearPrimMedia(face); |
1899 | } | 1909 | } |
1900 | 1910 | ||
1911 | public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) | ||
1912 | { | ||
1913 | return m_LSL_Functions.llClearLinkMedia(link, face); | ||
1914 | } | ||
1915 | |||
1901 | public void print(string str) | 1916 | public void print(string str) |
1902 | { | 1917 | { |
1903 | m_LSL_Functions.print(str); | 1918 | m_LSL_Functions.print(str); |