* Ooops, attachments now teleport/cross region borders along with your avatar. Those dastardly objects stick to you.
parent
3dc60c1433
commit
323038ceb9
|
@ -310,13 +310,22 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Event Handling routine for Attach Object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="objectLocalID"></param>
|
||||||
|
/// <param name="AttachmentPt"></param>
|
||||||
|
/// <param name="rot"></param>
|
||||||
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot)
|
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot)
|
||||||
|
{
|
||||||
|
// Calls attach with a Zero position
|
||||||
|
AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos)
|
||||||
{
|
{
|
||||||
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)
|
||||||
|
@ -324,7 +333,20 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (((SceneObjectGroup)obj).LocalId == objectLocalID)
|
if (((SceneObjectGroup)obj).LocalId == objectLocalID)
|
||||||
{
|
{
|
||||||
SceneObjectGroup group = (SceneObjectGroup)obj;
|
SceneObjectGroup group = (SceneObjectGroup)obj;
|
||||||
group.AttachToAgent(remoteClient.AgentId, AttachmentPt);
|
if (AttachmentPt == 0)
|
||||||
|
{
|
||||||
|
// Check object for stored attachment point
|
||||||
|
AttachmentPt = (uint)group.GetAttachmentPoint();
|
||||||
|
|
||||||
|
// if we still didn't find a suitable attachment point.......
|
||||||
|
if (AttachmentPt == 0)
|
||||||
|
{
|
||||||
|
AttachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1457,6 +1457,28 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (XMLMethod == 0)
|
if (XMLMethod == 0)
|
||||||
{
|
{
|
||||||
m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData);
|
m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData);
|
||||||
|
SceneObjectPart RootPrim = GetSceneObjectPart(primID);
|
||||||
|
if (RootPrim != null)
|
||||||
|
{
|
||||||
|
if (RootPrim.Shape.PCode == (byte)PCode.Prim)
|
||||||
|
{
|
||||||
|
SceneObjectGroup grp = RootPrim.ParentGroup;
|
||||||
|
if (grp != null)
|
||||||
|
{
|
||||||
|
if (RootPrim.Shape.State != 0)
|
||||||
|
{
|
||||||
|
// Attachment
|
||||||
|
ScenePresence sp = GetScenePresence(grp.OwnerID);
|
||||||
|
if (sp != null)
|
||||||
|
{
|
||||||
|
m_innerScene.AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -580,6 +580,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
|
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
|
||||||
capsPath);
|
capsPath);
|
||||||
avatar.MakeChildAgent();
|
avatar.MakeChildAgent();
|
||||||
|
System.Threading.Thread.Sleep(5000);
|
||||||
|
avatar.CrossAttachmentsIntoNewRegion(regionHandle);
|
||||||
if (KillObject != null)
|
if (KillObject != null)
|
||||||
{
|
{
|
||||||
KillObject(avatar.LocalId);
|
KillObject(avatar.LocalId);
|
||||||
|
|
|
@ -628,24 +628,39 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void AttachToAgent(LLUUID agentID, uint attachmentpoint)
|
public void AttachToAgent(LLUUID agentID, uint attachmentpoint, LLVector3 AttachOffset)
|
||||||
{
|
{
|
||||||
ScenePresence avatar = m_scene.GetScenePresence(agentID);
|
ScenePresence avatar = m_scene.GetScenePresence(agentID);
|
||||||
if (avatar != null)
|
if (avatar != null)
|
||||||
{
|
{
|
||||||
|
DetachFromBackup(this);
|
||||||
m_rootPart.m_attachedAvatar = agentID;
|
m_rootPart.m_attachedAvatar = agentID;
|
||||||
m_rootPart.SetParentLocalId(avatar.LocalId);
|
|
||||||
m_rootPart.SetAttachmentPoint(attachmentpoint);
|
|
||||||
m_rootPart.m_IsAttachment = true;
|
|
||||||
if (m_rootPart.PhysActor != null)
|
if (m_rootPart.PhysActor != null)
|
||||||
{
|
{
|
||||||
m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
|
m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
|
||||||
m_rootPart.PhysActor = null;
|
m_rootPart.PhysActor = null;
|
||||||
AbsolutePosition = LLVector3.Zero;
|
AbsolutePosition = AttachOffset;
|
||||||
|
m_rootPart.m_attachedPos = AttachOffset;
|
||||||
}
|
}
|
||||||
|
m_rootPart.m_IsAttachment = true;
|
||||||
|
|
||||||
|
m_rootPart.SetParentLocalId(avatar.LocalId);
|
||||||
|
m_rootPart.SetAttachmentPoint(attachmentpoint);
|
||||||
|
|
||||||
|
avatar.AddAttachment(this);
|
||||||
m_rootPart.ScheduleFullUpdate();
|
m_rootPart.ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public byte GetAttachmentPoint()
|
||||||
|
{
|
||||||
|
if (m_rootPart != null)
|
||||||
|
{
|
||||||
|
return m_rootPart.Shape.State;
|
||||||
|
}
|
||||||
|
return (byte)0;
|
||||||
|
}
|
||||||
|
|
||||||
public void DetachToGround()
|
public void DetachToGround()
|
||||||
{
|
{
|
||||||
|
@ -654,6 +669,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (avatar != null)
|
if (avatar != null)
|
||||||
{
|
{
|
||||||
detachedpos = avatar.AbsolutePosition;
|
detachedpos = avatar.AbsolutePosition;
|
||||||
|
avatar.RemoveAttachment(this);
|
||||||
}
|
}
|
||||||
AbsolutePosition = detachedpos;
|
AbsolutePosition = detachedpos;
|
||||||
m_rootPart.m_attachedAvatar = LLUUID.Zero;
|
m_rootPart.m_attachedAvatar = LLUUID.Zero;
|
||||||
|
@ -661,6 +677,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_rootPart.SetAttachmentPoint((byte)0);
|
m_rootPart.SetAttachmentPoint((byte)0);
|
||||||
m_rootPart.m_IsAttachment = false;
|
m_rootPart.m_IsAttachment = false;
|
||||||
m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim);
|
m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim);
|
||||||
|
AttachToBackup();
|
||||||
m_rootPart.ScheduleFullUpdate();
|
m_rootPart.ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1395,26 +1412,36 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
lock (m_parts)
|
lock (m_parts)
|
||||||
{
|
{
|
||||||
|
//if (m_rootPart.m_IsAttachment)
|
||||||
|
//{
|
||||||
|
//foreach (SceneObjectPart part in m_parts.Values)
|
||||||
|
//{
|
||||||
|
//part.SendScheduledUpdates();
|
||||||
|
//}
|
||||||
|
//return;
|
||||||
|
//}
|
||||||
|
|
||||||
if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
|
if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
m_rootPart.UpdateFlag = 1;
|
||||||
{
|
|
||||||
if (part.UpdateFlag == 0) part.UpdateFlag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastPhysGroupPos = AbsolutePosition;
|
lastPhysGroupPos = AbsolutePosition;
|
||||||
checkAtTargets();
|
|
||||||
}
|
}
|
||||||
|
//foreach (SceneObjectPart part in m_parts.Values)
|
||||||
|
//{
|
||||||
|
//if (part.UpdateFlag == 0) part.UpdateFlag = 1;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
checkAtTargets();
|
||||||
|
|
||||||
|
|
||||||
if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
|
if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
|
||||||
|| (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
|
|| (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
|
||||||
|| (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
|
|| (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
|
||||||
|| (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))
|
|| (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
m_rootPart.UpdateFlag = 1;
|
||||||
{
|
|
||||||
if (part.UpdateFlag == 0) part.UpdateFlag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastPhysGroupRot = GroupRotation;
|
lastPhysGroupRot = GroupRotation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1300,6 +1300,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void SetAttachmentPoint(uint AttachmentPoint)
|
public void SetAttachmentPoint(uint AttachmentPoint)
|
||||||
{
|
{
|
||||||
m_attachmentPoint = AttachmentPoint;
|
m_attachmentPoint = AttachmentPoint;
|
||||||
|
|
||||||
|
// save the attachment point.
|
||||||
|
//if (AttachmentPoint != 0)
|
||||||
|
//{
|
||||||
|
m_shape.State = (byte)AttachmentPoint;
|
||||||
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
|
@ -117,6 +117,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
protected AvatarAppearance m_appearance;
|
protected AvatarAppearance m_appearance;
|
||||||
|
|
||||||
|
protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
|
||||||
|
|
||||||
//neighbouring regions we have enabled a child agent in
|
//neighbouring regions we have enabled a child agent in
|
||||||
private readonly List<ulong> m_knownChildRegions = new List<ulong>();
|
private readonly List<ulong> m_knownChildRegions = new List<ulong>();
|
||||||
|
|
||||||
|
@ -1673,7 +1675,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
// This means we need to remove the current caps handler here and possibly compensate later,
|
// This means we need to remove the current caps handler here and possibly compensate later,
|
||||||
// in case both scenes are being hosted on the same region server. Messy
|
// in case both scenes are being hosted on the same region server. Messy
|
||||||
m_scene.RemoveCapsHandler(UUID);
|
m_scene.RemoveCapsHandler(UUID);
|
||||||
|
newpos = newpos + (vel);
|
||||||
bool res =
|
bool res =
|
||||||
m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos,
|
m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos,
|
||||||
m_physicsActor.Flying);
|
m_physicsActor.Flying);
|
||||||
|
@ -1692,6 +1694,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
|
m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
|
||||||
capsPath);
|
capsPath);
|
||||||
MakeChildAgent();
|
MakeChildAgent();
|
||||||
|
CrossAttachmentsIntoNewRegion(neighbourHandle);
|
||||||
m_scene.SendKillObject(m_localId);
|
m_scene.SendKillObject(m_localId);
|
||||||
m_scene.NotifyMyCoarseLocationChange();
|
m_scene.NotifyMyCoarseLocationChange();
|
||||||
}
|
}
|
||||||
|
@ -1943,7 +1946,43 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
DefaultTexture = textu.ToBytes();
|
DefaultTexture = textu.ToBytes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void AddAttachment(SceneObjectGroup gobj)
|
||||||
|
{
|
||||||
|
lock (m_attachments)
|
||||||
|
{
|
||||||
|
m_attachments.Add(gobj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void RemoveAttachment(SceneObjectGroup gobj)
|
||||||
|
{
|
||||||
|
lock (m_attachments)
|
||||||
|
{
|
||||||
|
if (m_attachments.Contains(gobj))
|
||||||
|
{
|
||||||
|
m_attachments.Remove(gobj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void CrossAttachmentsIntoNewRegion(ulong regionHandle)
|
||||||
|
{
|
||||||
|
lock (m_attachments)
|
||||||
|
{
|
||||||
|
foreach (SceneObjectGroup gobj in m_attachments)
|
||||||
|
{
|
||||||
|
// If the prim group is null then something must have happened to it!
|
||||||
|
if (gobj != null)
|
||||||
|
{
|
||||||
|
// Set the parent localID to 0 so it transfers over properly.
|
||||||
|
gobj.RootPart.SetParentLocalId(0);
|
||||||
|
gobj.RootPart.m_IsAttachment = false;
|
||||||
|
gobj.AbsolutePosition = gobj.RootPart.m_attachedPos;
|
||||||
|
m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_attachments.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene)
|
public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene)
|
||||||
{
|
{
|
||||||
m_controllingClient = client;
|
m_controllingClient = client;
|
||||||
|
|
Loading…
Reference in New Issue