diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index b91eb838a2..733392f5c0 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1618,19 +1618,17 @@ namespace OpenSim.Region.Environment.Scenes { string sceneObjectXml = objectGroup.ToXmlString(); - CachedUserInfo userInfo = - CommsManager.UserProfileCacheService.GetUserDetails( - remoteClient.AgentId); + CachedUserInfo userInfo; if (remoteClient == null) { userInfo = CommsManager.UserProfileCacheService.GetUserDetails( - objectGroup.RootPart.OwnerID); + objectGroup.RootPart.OwnerID); } else { userInfo = CommsManager.UserProfileCacheService.GetUserDetails( - remoteClient.AgentId); + remoteClient.AgentId); } if (userInfo != null) @@ -1648,9 +1646,22 @@ namespace OpenSim.Region.Environment.Scenes (int)AssetType.LostAndFoundFolder); if (folder != null) + { folderID = folder.ID; + } else - folderID = userInfo.RootFolder.ID; + { + if (userInfo.RootFolder != null) + { + folderID = userInfo.RootFolder.ID; + } + else + { + CommsManager.UserProfileCacheService.RequestInventoryForUser(objectGroup.RootPart.OwnerID); + m_log.WarnFormat("[SCENE] Can't find root folder for user, requesting inventory"); + return; + } + } } AssetBase asset = CreateAsset( @@ -1677,7 +1688,7 @@ namespace OpenSim.Region.Environment.Scenes item.InvType = (int)InventoryType.Object; item.Folder = folderID; - if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) + if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) { uint perms=objectGroup.GetEffectivePermissions(); uint nextPerms=(perms & 7) << 13; @@ -1706,7 +1717,7 @@ namespace OpenSim.Region.Environment.Scenes item.CreationDate = Util.UnixTimeSinceEpoch(); userInfo.AddItem(item); - if (item.Owner == remoteClient.AgentId) + if (remoteClient != null && item.Owner == remoteClient.AgentId) { remoteClient.SendInventoryItemCreateUpdate(item); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 139281d565..50d0a724a1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -3385,6 +3385,12 @@ namespace OpenSim.Region.Environment.Scenes // User needs to be logged into this sim if (m_scenePresences.ContainsKey(agentID)) { + if (godLike == false) + { + m_scenePresences[agentID].GrantGodlikePowers(agentID, sessionID, token, godLike); + return; + } + // First check that this is the sim owner if (ExternalChecks.ExternalChecksCanBeGodLike(agentID)) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 60cf061e16..f24e6fb7e8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1009,7 +1009,7 @@ namespace OpenSim.Region.Environment.Scenes // that they don't happen, otherwise the deleted objects will reappear m_isDeleted = true; - DetachFromBackup(); +// DetachFromBackup(); foreach (SceneObjectPart part in m_parts.Values) { diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 4517d11270..2caeb14e54 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -580,7 +580,13 @@ namespace OpenSim.Region.Environment.Scenes { m_pendingObjects = new Queue(); - foreach (EntityBase e in m_scene.Entities.Values) + List ents = new List(m_scene.Entities.Values); + ents.Sort(delegate(EntityBase a, EntityBase b) + { + return Vector3.Distance(AbsolutePosition, a.AbsolutePosition).CompareTo(Vector3.Distance(AbsolutePosition, b.AbsolutePosition)); + }); + + foreach (EntityBase e in ents) if (e is SceneObjectGroup) m_pendingObjects.Enqueue((SceneObjectGroup)e); }