A try to better attachment crossing.

0.6.1-post-fixes
Melanie Thielker 2008-11-29 01:33:10 +00:00
parent 7823ca5c8b
commit 287c724b55
3 changed files with 67 additions and 54 deletions

View File

@ -2414,6 +2414,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (AttachPoint > 30 && ownerID != AgentId) // Someone else's HUD if (AttachPoint > 30 && ownerID != AgentId) // Someone else's HUD
return; return;
if (parentID == 0)
return;
if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0)
rotation = Quaternion.Identity; rotation = Quaternion.Identity;

View File

@ -2145,86 +2145,95 @@ namespace OpenSim.Region.Environment.Scenes
{ {
SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData);
// If the user is banned, we won't let any of their objects
// enter. Period.
//
if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID))
{
m_log.Info("[INTERREGION]: Denied prim crossing for "+
"banned avatar");
return false;
}
// Force allocation of new LocalId // Force allocation of new LocalId
// //
foreach (SceneObjectPart p in sceneObject.Children.Values) foreach (SceneObjectPart p in sceneObject.Children.Values)
p.LocalId = 0; p.LocalId = 0;
AddRestoredSceneObject(sceneObject, true, false); if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim)
{
if(sceneObject.RootPart.Shape.State != 0)
{
// Fix up attachment Parent Local ID
//
ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
uint parentLocalID = 0;
if (sp != null)
parentLocalID = sp.LocalId;
sceneObject.RootPart.SetParentLocalId(parentLocalID);
AddRestoredSceneObject(sceneObject, false, false);
// Handle attachment special case
//
SceneObjectPart RootPrim = GetSceneObjectPart(primID); SceneObjectPart RootPrim = GetSceneObjectPart(primID);
RootPrim.SetParentLocalId(parentLocalID);
if (RootPrim != null) if (RootPrim != null)
{
if (m_regInfo.EstateSettings.IsBanned(RootPrim.OwnerID))
{ {
SceneObjectGroup grp = RootPrim.ParentGroup; SceneObjectGroup grp = RootPrim.ParentGroup;
if (grp != null)
DeleteSceneObject(grp, false);
m_log.Info("[INTERREGION]: Denied prim crossing for banned avatar");
return false;
}
if (RootPrim.Shape.PCode == (byte)PCode.Prim)
{
SceneObjectGroup grp = RootPrim.ParentGroup;
if((RootPrim.Shape.State == 0) &&
(!Permissions.CanObjectEntry(RootPrim.UUID,
true, RootPrim.AbsolutePosition)))
{
if (grp != null) if (grp != null)
{ {
DeleteSceneObject(grp, false); m_log.DebugFormat("[ATTACHMENT]: Received "+
} "attachment {0}, inworld asset id {1}",
grp.RootPart.LastOwnerID.ToString(),
grp.UUID.ToString());
m_log.Info("[INTERREGION]: Denied prim crossing because of parcel settings");
return false;
}
if (grp != null)
{
if (RootPrim.Shape.State != 0)
{
// Never persist
m_log.DebugFormat("[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.RootPart.LastOwnerID.ToString(), grp.UUID.ToString());
grp.DetachFromBackup();
// Attachment
ScenePresence sp = GetScenePresence(grp.OwnerID);
if (sp != null) if (sp != null)
{ {
// hack assetID until we get assetID into the XML format.
// LastOwnerID is used for group deeding, so when you do stuff
// with the deeded object, it goes back to them
grp.SetFromAssetID(grp.RootPart.LastOwnerID); grp.SetFromAssetID(grp.RootPart.LastOwnerID);
m_log.DebugFormat("[ATTACHMENT]: Attach to avatar {0}", sp.UUID.ToString()); m_log.DebugFormat("[ATTACHMENT]: Attach "+
AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); "to avatar {0}",
sp.UUID.ToString());
AttachObject(sp.ControllingClient,
grp.LocalId, (uint)0,
grp.GroupRotation,
grp.AbsolutePosition, false);
} }
else else
{ {
// Remove, then add, to ensure the expire
// time is refreshed. Wouldn't do to
// have it poof before the avatar gets
// there.
//
RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez); RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
} }
} }
} }
} }
}
return true;
}
else else
{ {
if (!Permissions.CanObjectEntry(sceneObject.UUID,
true, sceneObject.AbsolutePosition))
{
// Deny non attachments based on parcel settings
//
m_log.Info("[INTERREGION]: Denied prim crossing "+
"because of parcel settings");
return false; return false;
} }
} }
AddRestoredSceneObject(sceneObject, true, false);
}
}
return true;
}
#endregion #endregion
#region Add/Remove Avatar Methods #region Add/Remove Avatar Methods

View File

@ -592,6 +592,7 @@ namespace OpenSim.Region.Environment.Scenes
m_scene = scene; m_scene = scene;
RegionHandle = m_scene.RegionInfo.RegionHandle; RegionHandle = m_scene.RegionInfo.RegionHandle;
if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0)
m_rootPart.ParentID = 0; m_rootPart.ParentID = 0;
if (m_rootPart.LocalId==0) if (m_rootPart.LocalId==0)
m_rootPart.LocalId = m_scene.AllocateLocalId(); m_rootPart.LocalId = m_scene.AllocateLocalId();
@ -921,9 +922,10 @@ namespace OpenSim.Region.Environment.Scenes
public void SetRootPart(SceneObjectPart part) public void SetRootPart(SceneObjectPart part)
{ {
part.SetParent(this); part.SetParent(this);
m_rootPart = part;
if (!IsAttachment)
part.ParentID = 0; part.ParentID = 0;
part.LinkNum = 0; part.LinkNum = 0;
m_rootPart = part;
// No locking required since the SOG should not be in the scene yet - one can't change root parts after // No locking required since the SOG should not be in the scene yet - one can't change root parts after
// the scene object has been attached to the scene // the scene object has been attached to the scene