aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
authorMelanie2012-09-07 19:49:46 +0100
committerMelanie2012-09-07 19:49:46 +0100
commit924df14c5e15185e14c144164dd80d9859d5c583 (patch)
tree110f0e402b879f49943ff2e76598e2241e20057c /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
parentRevert "made setting rotation match Second Life" (diff)
parentMove addin attributes to RegionCombinerModule.addin.xml (diff)
downloadopensim-SC_OLD-924df14c5e15185e14c144164dd80d9859d5c583.zip
opensim-SC_OLD-924df14c5e15185e14c144164dd80d9859d5c583.tar.gz
opensim-SC_OLD-924df14c5e15185e14c144164dd80d9859d5c583.tar.bz2
opensim-SC_OLD-924df14c5e15185e14c144164dd80d9859d5c583.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs OpenSim/Framework/Servers/VersionInfo.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs176
1 files changed, 176 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7aacfd4..a44ced4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1682,6 +1682,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1682 return; 1682 return;
1683 } 1683 }
1684 1684
1685 MessageObject(objUUID, message);
1686 }
1687
1688 private void MessageObject(UUID objUUID, string message)
1689 {
1685 object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; 1690 object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) };
1686 1691
1687 SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID); 1692 SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID);
@@ -3272,6 +3277,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3272 } 3277 }
3273 } 3278 }
3274 3279
3280 #region Attachment commands
3281
3275 public void osForceAttachToAvatar(int attachmentPoint) 3282 public void osForceAttachToAvatar(int attachmentPoint)
3276 { 3283 {
3277 CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); 3284 CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar");
@@ -3361,6 +3368,175 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3361 ((LSL_Api)m_LSL_Api).DetachFromAvatar(); 3368 ((LSL_Api)m_LSL_Api).DetachFromAvatar();
3362 } 3369 }
3363 3370
3371 public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints)
3372 {
3373 CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments");
3374
3375 m_host.AddScriptLPS(1);
3376
3377 UUID targetUUID;
3378 ScenePresence target;
3379 LSL_List resp = new LSL_List();
3380
3381 if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target))
3382 {
3383 foreach (object point in attachmentPoints.Data)
3384 {
3385 LSL_Integer ipoint = new LSL_Integer(
3386 (point is LSL_Integer || point is int || point is uint) ?
3387 (int)point :
3388 0
3389 );
3390 resp.Add(ipoint);
3391 if (ipoint == 0)
3392 {
3393 // indicates zero attachments
3394 resp.Add(new LSL_Integer(0));
3395 }
3396 else
3397 {
3398 // gets the number of attachments on the attachment point
3399 resp.Add(new LSL_Integer(target.GetAttachments((uint)ipoint).Count));
3400 }
3401 }
3402 }
3403
3404 return resp;
3405 }
3406
3407 public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int options)
3408 {
3409 CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments");
3410 m_host.AddScriptLPS(1);
3411
3412 UUID targetUUID;
3413 ScenePresence target;
3414
3415 if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target))
3416 {
3417 List<int> aps = new List<int>();
3418 foreach (object point in attachmentPoints.Data)
3419 {
3420 int ipoint;
3421 if (int.TryParse(point.ToString(), out ipoint))
3422 {
3423 aps.Add(ipoint);
3424 }
3425 }
3426
3427 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
3428
3429 bool msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL);
3430 bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0;
3431
3432 if (msgAll && invertPoints)
3433 {
3434 return;
3435 }
3436 else if (msgAll || invertPoints)
3437 {
3438 attachments = target.GetAttachments();
3439 }
3440 else
3441 {
3442 foreach (int point in aps)
3443 {
3444 if (point > 0)
3445 {
3446 attachments.AddRange(target.GetAttachments((uint)point));
3447 }
3448 }
3449 }
3450
3451 // if we have no attachments at this point, exit now
3452 if (attachments.Count == 0)
3453 {
3454 return;
3455 }
3456
3457 List<SceneObjectGroup> ignoreThese = new List<SceneObjectGroup>();
3458
3459 if (invertPoints)
3460 {
3461 foreach (SceneObjectGroup attachment in attachments)
3462 {
3463 if (aps.Contains((int)attachment.AttachmentPoint))
3464 {
3465 ignoreThese.Add(attachment);
3466 }
3467 }
3468 }
3469
3470 foreach (SceneObjectGroup attachment in ignoreThese)
3471 {
3472 attachments.Remove(attachment);
3473 }
3474 ignoreThese.Clear();
3475
3476 // if inverting removed all attachments to check, exit now
3477 if (attachments.Count < 1)
3478 {
3479 return;
3480 }
3481
3482 if ((options & ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0)
3483 {
3484 foreach (SceneObjectGroup attachment in attachments)
3485 {
3486 if (attachment.RootPart.CreatorID != m_host.CreatorID)
3487 {
3488 ignoreThese.Add(attachment);
3489 }
3490 }
3491
3492 foreach (SceneObjectGroup attachment in ignoreThese)
3493 {
3494 attachments.Remove(attachment);
3495 }
3496 ignoreThese.Clear();
3497
3498 // if filtering by same object creator removed all
3499 // attachments to check, exit now
3500 if (attachments.Count == 0)
3501 {
3502 return;
3503 }
3504 }
3505
3506 if ((options & ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0)
3507 {
3508 foreach (SceneObjectGroup attachment in attachments)
3509 {
3510 if (attachment.RootPart.CreatorID != m_item.CreatorID)
3511 {
3512 ignoreThese.Add(attachment);
3513 }
3514 }
3515
3516 foreach (SceneObjectGroup attachment in ignoreThese)
3517 {
3518 attachments.Remove(attachment);
3519 }
3520 ignoreThese.Clear();
3521
3522 // if filtering by object creator must match originating
3523 // script creator removed all attachments to check,
3524 // exit now
3525 if (attachments.Count == 0)
3526 {
3527 return;
3528 }
3529 }
3530
3531 foreach (SceneObjectGroup attachment in attachments)
3532 {
3533 MessageObject(attachment.RootPart.UUID, message);
3534 }
3535 }
3536 }
3537
3538 #endregion
3539
3364 /// <summary> 3540 /// <summary>
3365 /// Checks if thing is a UUID. 3541 /// Checks if thing is a UUID.
3366 /// </summary> 3542 /// </summary>