* 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
0.6.0-stable
Teravus Ovares 2008-04-25 21:41:55 +00:00
parent 6fec9c789b
commit a534257b0e
5 changed files with 65 additions and 5 deletions

View File

@ -168,12 +168,25 @@ namespace OpenSim.Region.Environment
/// <returns>Has permission?</returns> /// <returns>Has permission?</returns>
public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos) 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 land1 = m_scene.LandChannel.getLandObject(oldPos.X, oldPos.Y);
ILandObject land2 = m_scene.LandChannel.getLandObject(newPos.X, newPos.Y); ILandObject land2 = m_scene.LandChannel.getLandObject(newPos.X, newPos.Y);
if (land1 == null || land2 == null) if (land1 == null || land2 == null)
{ {
return false; return false;
} }
if (land2 == null)
{
// need this for crossing borders
return true;
}
if (land1.landData.globalID == land2.landData.globalID) if (land1.landData.globalID == land2.landData.globalID)
{ {

View File

@ -314,6 +314,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
List<EntityBase> EntityList = GetEntities(); List<EntityBase> EntityList = GetEntities();
if (AttachmentPt == 0)
AttachmentPt = (uint)AttachmentPoint.LeftHand;
foreach (EntityBase obj in EntityList) foreach (EntityBase obj in EntityList)
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)

View File

@ -1368,14 +1368,19 @@ namespace OpenSim.Region.Environment.Scenes
m_sceneXmlLoader.SavePrimsToXml2(fileName); m_sceneXmlLoader.SavePrimsToXml2(fileName);
} }
/// <summary>
/// Locate New region Handle and offset the prim position for the new region
///
/// </summary>
/// <param name="position">current position of Group</param>
/// <param name="grp">Scene Object Group that we're crossing</param>
public void CrossPrimGroupIntoNewRegion(LLVector3 position, SceneObjectGroup grp) public void CrossPrimGroupIntoNewRegion(LLVector3 position, SceneObjectGroup grp)
{ {
m_log.Warn("Prim crossing: " + grp.UUID.ToString()); m_log.Warn("Prim crossing: " + grp.UUID.ToString());
int thisx = (int)RegionInfo.RegionLocX; int thisx = (int)RegionInfo.RegionLocX;
int thisy = (int)RegionInfo.RegionLocY; int thisy = (int)RegionInfo.RegionLocY;
int primcrossingXMLmethod = 0;
ulong newRegionHandle = 0; ulong newRegionHandle = 0;
LLVector3 pos = position; LLVector3 pos = position;
@ -1410,6 +1415,12 @@ namespace OpenSim.Region.Environment.Scenes
// Offset the positions for the new region across the border // Offset the positions for the new region across the border
grp.OffsetForNewRegion(pos); grp.OffsetForNewRegion(pos);
CrossPrimGroupIntoNewRegion(newRegionHandle, grp);
}
public void CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp)
{
int primcrossingXMLmethod = 0;
if (newRegionHandle != 0) if (newRegionHandle != 0)
{ {
bool successYN = false; bool successYN = false;

View File

@ -1077,7 +1077,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (m_rootPart.UUID == part.UUID) 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 else
{ {
@ -1094,7 +1101,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (m_rootPart.UUID == part.UUID) 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 else
{ {
@ -2143,6 +2157,11 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{ {
if (m_rootPart.m_IsAttachment)
{
m_rootPart.m_attachedPos = pos;
}
AbsolutePosition = pos; AbsolutePosition = pos;
} }
//we need to do a terse update even if the move wasn't allowed //we need to do a terse update even if the move wasn't allowed

View File

@ -103,6 +103,7 @@ namespace OpenSim.Region.Environment.Scenes
[XmlIgnore] public bool m_IsAttachment = false; [XmlIgnore] public bool m_IsAttachment = false;
[XmlIgnore] public uint m_attachmentPoint = (byte)0; [XmlIgnore] public uint m_attachmentPoint = (byte)0;
[XmlIgnore] public LLUUID m_attachedAvatar = LLUUID.Zero; [XmlIgnore] public LLUUID m_attachedAvatar = LLUUID.Zero;
[XmlIgnore] public LLVector3 m_attachedPos = LLVector3.Zero;
public Int32 CreationDate; public Int32 CreationDate;
public uint ParentID = 0; public uint ParentID = 0;
@ -276,6 +277,15 @@ namespace OpenSim.Region.Environment.Scenes
m_groupPosition.Y = PhysActor.Position.Y; m_groupPosition.Y = PhysActor.Position.Y;
m_groupPosition.Z = PhysActor.Position.Z; 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; return m_groupPosition;
} }
set set
@ -340,7 +350,11 @@ namespace OpenSim.Region.Environment.Scenes
public LLVector3 AbsolutePosition public LLVector3 AbsolutePosition
{ {
get { return m_offsetPosition + m_groupPosition; } get {
if (m_IsAttachment)
return GroupPosition;
return m_offsetPosition + m_groupPosition; }
} }
protected LLQuaternion m_rotationOffset; protected LLQuaternion m_rotationOffset;