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,84 +2145,93 @@ 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)
SceneObjectPart RootPrim = GetSceneObjectPart(primID);
if (RootPrim != null)
{ {
if (m_regInfo.EstateSettings.IsBanned(RootPrim.OwnerID)) if(sceneObject.RootPart.Shape.State != 0)
{ {
SceneObjectGroup grp = RootPrim.ParentGroup; // Fix up attachment Parent Local ID
if (grp != null) //
DeleteSceneObject(grp, false); ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
m_log.Info("[INTERREGION]: Denied prim crossing for banned avatar"); uint parentLocalID = 0;
if (sp != null)
parentLocalID = sp.LocalId;
return false; sceneObject.RootPart.SetParentLocalId(parentLocalID);
}
if (RootPrim.Shape.PCode == (byte)PCode.Prim) AddRestoredSceneObject(sceneObject, false, false);
{
SceneObjectGroup grp = RootPrim.ParentGroup; // Handle attachment special case
if((RootPrim.Shape.State == 0) && //
(!Permissions.CanObjectEntry(RootPrim.UUID, SceneObjectPart RootPrim = GetSceneObjectPart(primID);
true, RootPrim.AbsolutePosition)))
RootPrim.SetParentLocalId(parentLocalID);
if (RootPrim != null)
{ {
SceneObjectGroup grp = RootPrim.ParentGroup;
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);
} }
} }
} }
} }
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;
}
}
AddRestoredSceneObject(sceneObject, true, false);
} }
return true;
}
else
{
return false;
} }
return true;
} }
#endregion #endregion

View File

@ -592,7 +592,8 @@ namespace OpenSim.Region.Environment.Scenes
m_scene = scene; m_scene = scene;
RegionHandle = m_scene.RegionInfo.RegionHandle; RegionHandle = m_scene.RegionInfo.RegionHandle;
m_rootPart.ParentID = 0; if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 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);
part.ParentID = 0;
part.LinkNum = 0;
m_rootPart = part; m_rootPart = part;
if (!IsAttachment)
part.ParentID = 0;
part.LinkNum = 0;
// 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