Exemplo n.º 1
0
        /// <summary>
        ///     Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                                      List <ISceneEntity> objectGroups, UUID AgentId,
                                      bool permissionToDelete, bool permissionToTake)
        {
            DeleteToInventoryHolder dtis = new DeleteToInventoryHolder
            {
                action             = action,
                folderID           = folderID,
                objectGroups       = objectGroups,
                agentId            = AgentId,
                permissionToDelete = permissionToDelete,
                permissionToTake   = permissionToTake
            };

            //Do this before the locking so that the objects 'appear' gone and the client doesn't think things have gone wrong
            if (permissionToDelete)
            {
                DeleteGroups(objectGroups);
            }

            m_removeFromSimQueue.Enqueue(dtis);

            if (!DeleteLoopInUse)
            {
                DeleteLoopInUse = true;
                //MainConsole.Instance.Debug("[SCENE]: Starting delete loop");
                Util.FireAndForget(DoDeleteObject);
            }
        }
Exemplo n.º 2
0
        public bool DeleteObject()
        {
            DeleteToInventoryHolder x = null;

            try
            {
                if (m_removeFromSimQueue.TryDequeue(out x))
                {
                    MainConsole.Instance.DebugFormat(
                        "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.",
                        m_removeFromSimQueue.Count);

                    if (x.permissionToTake)
                    {
                        try
                        {
                            IInventoryAccessModule invAccess = m_scene.RequestModuleInterface <IInventoryAccessModule>();
                            UUID itemID;
                            if (invAccess != null)
                            {
                                invAccess.DeleteToInventory(x.action, x.folderID, x.objectGroups, x.agentId, out itemID);
                            }
                        }
                        catch (Exception e)
                        {
                            MainConsole.Instance.ErrorFormat(
                                "[ASYNC DELETER]: Exception background sending object: {0}{1}", e.Message, e.StackTrace);
                        }
                    }

                    //Moved Delete To After Object Taken To Inventory. Prevents script variables not being updated before taken to inventory
                    if (x.permissionToDelete)
                    {
                        IBackupModule backup = m_scene.RequestModuleInterface <IBackupModule>();
                        if (backup != null)
                        {
                            backup.DeleteSceneObjects(x.objectGroups.ToArray(), true, true);
                        }
                    }
                    return(true);
                }
            }
            catch (Exception e)
            {
                // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
                // FIXME: This needs to be fixed.
                MainConsole.Instance.ErrorFormat(
                    "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}",
                    (x != null ? x.agentId.ToString() : "unavailable"),
                    (x != null ? x.agentId.ToString() : "unavailable"), e);
            }

            //MainConsole.Instance.Debug("[SCENE]: No objects left in delete queue.");
            return(false);
        }
        /// <summary>
        ///     Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory (DeRezAction action, UUID folderID,
                                      List<ISceneEntity> objectGroups, UUID agentId,
                                      bool permissionToDelete, bool permissionToTake)
        {
            DeleteToInventoryHolder dtis = new DeleteToInventoryHolder {
                action = action,
                folderID = folderID,
                objectGroups = objectGroups,
                agentId = agentId,
                permissionToDelete = permissionToDelete,
                permissionToTake = permissionToTake
            };
            //Do this before the locking so that the objects 'appear' gone and the client doesn't think things have gone wrong
            if (permissionToDelete) {
                DeleteGroups (objectGroups);
            }

            m_removeFromSimQueue.Enqueue (dtis);

            if (!DeleteLoopInUse) {
                DeleteLoopInUse = true;
                //MainConsole.Instance.Debug("[SCENE]: Starting delete loop");
                Util.FireAndForget (DoDeleteObject);
            }
        }