diff options
author | Melanie | 2012-02-14 23:16:20 +0100 |
---|---|---|
committer | Melanie | 2012-02-14 23:16:20 +0100 |
commit | 2d3381b795611a8857077d1effb41323c2cb8658 (patch) | |
tree | a1b8a6d7832858d14bfb08eac29fcf3e643ef17c /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Prevent object loss and positioning outside the region with failed object sim (diff) | |
download | opensim-SC-2d3381b795611a8857077d1effb41323c2cb8658.zip opensim-SC-2d3381b795611a8857077d1effb41323c2cb8658.tar.gz opensim-SC-2d3381b795611a8857077d1effb41323c2cb8658.tar.bz2 opensim-SC-2d3381b795611a8857077d1effb41323c2cb8658.tar.xz |
Implement region crossing of sitting avatars. Edit mode and llSetPos work
but unscripted default sit anim is lost. Still some Gfx glitching. Physical
crossing doesn't work yet.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 89 |
1 files changed, 86 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 877fe96..a4ca0fb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -465,10 +465,76 @@ namespace OpenSim.Region.Framework.Scenes | |||
465 | || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | 465 | || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) |
466 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | 466 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) |
467 | { | 467 | { |
468 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | 468 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
469 | uint x = 0; | ||
470 | uint y = 0; | ||
471 | string version = String.Empty; | ||
472 | Vector3 newpos = Vector3.Zero; | ||
473 | OpenSim.Services.Interfaces.GridRegion destination = null; | ||
474 | |||
475 | bool canCross = true; | ||
476 | foreach (ScenePresence av in m_linkedAvatars) | ||
477 | { | ||
478 | // We need to cross these agents. First, let's find | ||
479 | // out if any of them can't cross for some reason. | ||
480 | // We have to deny the crossing entirely if any | ||
481 | // of them are banned. Alternatively, we could | ||
482 | // unsit banned agents.... | ||
483 | |||
484 | |||
485 | // We set the avatar position as being the object | ||
486 | // position to get the region to send to | ||
487 | if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out x, out y, out version, out newpos)) == null) | ||
488 | { | ||
489 | canCross = false; | ||
490 | break; | ||
491 | } | ||
492 | |||
493 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); | ||
494 | } | ||
495 | |||
496 | if (canCross) | ||
497 | { | ||
498 | // We unparent the SP quietly so that it won't | ||
499 | // be made to stand up | ||
500 | foreach (ScenePresence av in m_linkedAvatars) | ||
501 | { | ||
502 | SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID); | ||
503 | if (parentPart != null) | ||
504 | av.ParentUUID = parentPart.UUID; | ||
505 | |||
506 | av.ParentID = 0; | ||
507 | } | ||
508 | |||
509 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | ||
510 | |||
511 | // Normalize | ||
512 | if (val.X >= Constants.RegionSize) | ||
513 | val.X -= Constants.RegionSize; | ||
514 | if (val.Y >= Constants.RegionSize) | ||
515 | val.Y -= Constants.RegionSize; | ||
516 | if (val.X < 0) | ||
517 | val.X += Constants.RegionSize; | ||
518 | if (val.Y < 0) | ||
519 | val.Y += Constants.RegionSize; | ||
520 | |||
521 | // If it's deleted, crossing was successful | ||
522 | if (IsDeleted) | ||
523 | { | ||
524 | foreach (ScenePresence av in m_linkedAvatars) | ||
525 | { | ||
526 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); | ||
527 | |||
528 | av.IsInTransit = true; | ||
529 | |||
530 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | ||
531 | d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); | ||
532 | } | ||
533 | |||
534 | return; | ||
535 | } | ||
536 | } | ||
469 | 537 | ||
470 | if (IsDeleted) | ||
471 | return; | ||
472 | val = AbsolutePosition; | 538 | val = AbsolutePosition; |
473 | } | 539 | } |
474 | } | 540 | } |
@@ -528,6 +594,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
528 | } | 594 | } |
529 | } | 595 | } |
530 | 596 | ||
597 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | ||
598 | { | ||
599 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; | ||
600 | ScenePresence agent = icon.EndInvoke(iar); | ||
601 | |||
602 | //// If the cross was successful, this agent is a child agent | ||
603 | //if (agent.IsChildAgent) | ||
604 | // agent.Reset(); | ||
605 | //else // Not successful | ||
606 | // agent.RestoreInCurrentScene(); | ||
607 | |||
608 | // In any case | ||
609 | agent.IsInTransit = false; | ||
610 | |||
611 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | ||
612 | } | ||
613 | |||
531 | public override uint LocalId | 614 | public override uint LocalId |
532 | { | 615 | { |
533 | get { return m_rootPart.LocalId; } | 616 | get { return m_rootPart.LocalId; } |