From a534257b0e0861bb7656389675044fa905a11bf4 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Fri, 25 Apr 2008 21:41:55 +0000
Subject: * Fixes prim crossing. See bug 1050. * Causes the internal handling
of attachments to put the prim group conceptually at the position of the
avatar instead of 0,0,0
---
OpenSim/Region/Environment/PermissionManager.cs | 13 ++++++++++++
OpenSim/Region/Environment/Scenes/InnerScene.cs | 3 +++
OpenSim/Region/Environment/Scenes/Scene.cs | 15 ++++++++++++--
.../Region/Environment/Scenes/SceneObjectGroup.cs | 23 ++++++++++++++++++++--
.../Region/Environment/Scenes/SceneObjectPart.cs | 16 ++++++++++++++-
5 files changed, 65 insertions(+), 5 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 0343d21..5658be7 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -168,12 +168,25 @@ namespace OpenSim.Region.Environment
/// Has permission?
public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos)
{
+
+
+ if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f))
+ {
+ return true;
+ }
+
ILandObject land1 = m_scene.LandChannel.getLandObject(oldPos.X, oldPos.Y);
ILandObject land2 = m_scene.LandChannel.getLandObject(newPos.X, newPos.Y);
+
if (land1 == null || land2 == null)
{
return false;
}
+ if (land2 == null)
+ {
+ // need this for crossing borders
+ return true;
+ }
if (land1.landData.globalID == land2.landData.globalID)
{
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 668e50f..2aa51b8 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -314,6 +314,9 @@ namespace OpenSim.Region.Environment.Scenes
{
List EntityList = GetEntities();
+ if (AttachmentPt == 0)
+ AttachmentPt = (uint)AttachmentPoint.LeftHand;
+
foreach (EntityBase obj in EntityList)
{
if (obj is SceneObjectGroup)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index ae914b3..ce713c5 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1368,14 +1368,19 @@ namespace OpenSim.Region.Environment.Scenes
m_sceneXmlLoader.SavePrimsToXml2(fileName);
}
+ ///
+ /// Locate New region Handle and offset the prim position for the new region
+ ///
+ ///
+ /// current position of Group
+ /// Scene Object Group that we're crossing
+
public void CrossPrimGroupIntoNewRegion(LLVector3 position, SceneObjectGroup grp)
{
m_log.Warn("Prim crossing: " + grp.UUID.ToString());
int thisx = (int)RegionInfo.RegionLocX;
int thisy = (int)RegionInfo.RegionLocY;
- int primcrossingXMLmethod = 0;
-
ulong newRegionHandle = 0;
LLVector3 pos = position;
@@ -1410,6 +1415,12 @@ namespace OpenSim.Region.Environment.Scenes
// Offset the positions for the new region across the border
grp.OffsetForNewRegion(pos);
+ CrossPrimGroupIntoNewRegion(newRegionHandle, grp);
+
+ }
+ public void CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp)
+ {
+ int primcrossingXMLmethod = 0;
if (newRegionHandle != 0)
{
bool successYN = false;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 7251e9c..fbf0a73 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1077,7 +1077,14 @@ namespace OpenSim.Region.Environment.Scenes
{
if (m_rootPart.UUID == part.UUID)
{
- part.SendFullUpdateToClient(remoteClient, AbsolutePosition, clientFlags);
+ if (m_rootPart.m_IsAttachment)
+ {
+ part.SendFullUpdateToClient(remoteClient, m_rootPart.m_attachedPos, clientFlags);
+ }
+ else
+ {
+ part.SendFullUpdateToClient(remoteClient, AbsolutePosition, clientFlags);
+ }
}
else
{
@@ -1094,7 +1101,14 @@ namespace OpenSim.Region.Environment.Scenes
{
if (m_rootPart.UUID == part.UUID)
{
- part.SendTerseUpdateToClient(remoteClient, AbsolutePosition);
+ if (m_rootPart.m_IsAttachment)
+ {
+ part.SendTerseUpdateToClient(remoteClient, m_rootPart.m_attachedPos);
+ }
+ else
+ {
+ part.SendTerseUpdateToClient(remoteClient, AbsolutePosition);
+ }
}
else
{
@@ -2143,6 +2157,11 @@ namespace OpenSim.Region.Environment.Scenes
{
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{
+ if (m_rootPart.m_IsAttachment)
+ {
+ m_rootPart.m_attachedPos = pos;
+ }
+
AbsolutePosition = pos;
}
//we need to do a terse update even if the move wasn't allowed
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 2357c2f..6a12fb9 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -103,6 +103,7 @@ namespace OpenSim.Region.Environment.Scenes
[XmlIgnore] public bool m_IsAttachment = false;
[XmlIgnore] public uint m_attachmentPoint = (byte)0;
[XmlIgnore] public LLUUID m_attachedAvatar = LLUUID.Zero;
+ [XmlIgnore] public LLVector3 m_attachedPos = LLVector3.Zero;
public Int32 CreationDate;
public uint ParentID = 0;
@@ -276,6 +277,15 @@ namespace OpenSim.Region.Environment.Scenes
m_groupPosition.Y = PhysActor.Position.Y;
m_groupPosition.Z = PhysActor.Position.Z;
}
+ if (m_IsAttachment)
+ {
+ ScenePresence sp = m_parentGroup.Scene.GetScenePresence(m_attachedAvatar);
+ if (sp != null)
+ {
+ return sp.AbsolutePosition;
+ }
+ }
+
return m_groupPosition;
}
set
@@ -340,7 +350,11 @@ namespace OpenSim.Region.Environment.Scenes
public LLVector3 AbsolutePosition
{
- get { return m_offsetPosition + m_groupPosition; }
+ get {
+ if (m_IsAttachment)
+ return GroupPosition;
+
+ return m_offsetPosition + m_groupPosition; }
}
protected LLQuaternion m_rotationOffset;
--
cgit v1.1