コード例 #1
0
        /// <summary>
        /// Move the given scene object into a new region
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="grp">Scene Object Group that we're crossing</param>
        /// <param name="attemptedPos"></param>
        /// <returns>
        /// true if the crossing itself was successful, false on failure
        /// </returns>
        protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, Vector3 attemptedPos)
        {
            bool successYN = false;
            if (destination != null)
            {
                if(grp.SitTargetAvatar.Count != 0)
                {
                    bool success = false;
                    foreach (UUID avID in grp.SitTargetAvatar)
                    {
                        IScenePresence SP = grp.Scene.GetScenePresence(avID);
                        SP.Velocity = grp.RootChild.PhysActor.Velocity;
                        InternalCross(SP, attemptedPos, false, destination);
                        success = grp.Scene.GetScenePresence(avID).IsChildAgent;
                    }
                    if(success)
                    {
                        foreach(ISceneChildEntity part in grp.ChildrenEntities())
                            part.SitTargetAvatar.Clear();

                        IBackupModule backup = grp.Scene.RequestModuleInterface<IBackupModule>();
                        if(backup != null)
                            return backup.DeleteSceneObjects(new[] { grp }, false, false);
                        return true;//They do all the work adding the prim in the other region
                    }
                    return false;
                }

                SceneObjectGroup copiedGroup = (SceneObjectGroup)grp.Copy(false);
                copiedGroup.SetAbsolutePosition(true, attemptedPos);
                if (grp.Scene != null)
                    successYN = grp.Scene.RequestModuleInterface<ISimulationService>().CreateObject(destination, copiedGroup);

                if (successYN)
                {
                    // We remove the object here
                    try
                    {
                        foreach (ISceneChildEntity part in grp.ChildrenEntities())
                            part.SitTargetAvatar.Clear();

                        IBackupModule backup = grp.Scene.RequestModuleInterface<IBackupModule>();
                        if (backup != null)
                            return backup.DeleteSceneObjects(new[] { grp }, false, true);
                    }
                    catch (Exception e)
                    {
                        MainConsole.Instance.ErrorFormat(
                            "[ENTITY TRANSFER MODULE]: Exception deleting the old object left behind on a border crossing for {0}, {1}",
                            grp, e);
                    }
                }
                else
                {
                    if (!grp.IsDeleted)
                    {
                        if (grp.RootPart.PhysActor != null)
                        {
                            grp.RootPart.PhysActor.CrossingFailure();
                        }
                    }

                    MainConsole.Instance.ErrorFormat("[ENTITY TRANSFER MODULE]: Prim crossing failed for {0}", grp);
                }
            }
            else
            {
                MainConsole.Instance.Error("[ENTITY TRANSFER MODULE]: destination was unexpectedly null in Scene.CrossPrimGroupIntoNewRegion()");
            }

            return successYN;
        }
コード例 #2
0
ファイル: FlockingView.cs プロジェクト: jonc/osboids
 private SceneObjectGroup CopyPrim(SceneObjectGroup prim, string name)
 {
     SceneObjectGroup copy = prim.Copy (true);
     copy.Name = name;
     copy.DetachFromBackup ();
     return copy;
 }
コード例 #3
0
ファイル: CMController.cs プロジェクト: ChrisD/opensim
 protected void GroupBeingDeleted(SceneObjectGroup group)
 {
     m_log.Debug("[CONTENT MANAGEMENT] Something was deleted!!!");
     Work moreWork = new Work();
     moreWork.Type = WorkType.OBJECTKILLED;
     moreWork.Data1 = group.Copy();
     m_WorkQueue.Enqueue(moreWork);
 }
コード例 #4
0
ファイル: MetaEntity.cs プロジェクト: ChrisD/opensim
 /// <summary>
 /// Makes a new meta entity by copying the given scene object group.
 /// The physics boolean is just a stub right now.
 /// </summary>
 public MetaEntity(SceneObjectGroup orig, bool physics)
 {
     m_Entity = orig.Copy(orig.RootPart.OwnerID, orig.RootPart.GroupID, false);
     Initialize(physics);
 }
コード例 #5
0
ファイル: SceneObjectGroup.cs プロジェクト: zwagoth/halcyon
 private static SceneObjectGroup CopyObjectForBackup(SceneObjectGroup group)
 {
     try
     {
         return group.Copy(group.OwnerID, group.GroupID, false, true);
     }
     catch (Exception e)
     {
         m_log.ErrorFormat("[BACKUP]: Exception copying object '{0}' at {1}: {2}\n{3}", 
             group.RootPart.Name, group.RootPart.AbsolutePosition, e.Message, e.StackTrace);
     }
     return null;
 }
コード例 #6
0
        /// <summary>
        /// Move the given scene object into a new region
        /// </summary>
        /// <param name="newRegionHandle"></param>
        /// <param name="grp">Scene Object Group that we're crossing</param>
        /// <returns>
        /// true if the crossing itself was successful, false on failure
        /// </returns>
        protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, Vector3 attemptedPos)
        {
            bool successYN = false;
            grp.RootPart.ClearUpdateScheduleOnce();
            if (destination != null)
            {
                if (grp.RootPart.SitTargetAvatar.Count != 0)
                {
                    lock (grp.RootPart.SitTargetAvatar)
                    {
                        foreach (UUID avID in grp.RootPart.SitTargetAvatar)
                        {
                            ScenePresence SP = grp.Scene.GetScenePresence(avID);
                            CrossAgentToNewRegionAsync(SP, grp.AbsolutePosition, destination, false);
                        }
                    }
                }

                SceneObjectGroup copiedGroup = (SceneObjectGroup)grp.Copy(false);
                copiedGroup.SetAbsolutePosition(true, attemptedPos);
                if (grp.Scene != null && grp.Scene.SimulationService != null)
                    successYN = grp.Scene.SimulationService.CreateObject(destination, copiedGroup);

                if (successYN)
                {
                    // We remove the object here
                    try
                    {
                        foreach (SceneObjectPart part in grp.ChildrenList)
                        {
                            lock (part.SitTargetAvatar)
                            {
                                part.SitTargetAvatar.Clear();
                            }
                        }
                        IBackupModule backup = grp.Scene.RequestModuleInterface<IBackupModule>();
                        if (backup != null)
                            return backup.DeleteSceneObjects(new SceneObjectGroup[1] { grp }, false);
                    }
                    catch (Exception e)
                    {
                        m_log.ErrorFormat(
                            "[ENTITY TRANSFER MODULE]: Exception deleting the old object left behind on a border crossing for {0}, {1}",
                            grp, e);
                    }
                }
                else
                {
                    if (!grp.IsDeleted)
                    {
                        if (grp.RootPart.PhysActor != null)
                        {
                            grp.RootPart.PhysActor.CrossingFailure();
                        }
                    }

                    m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: Prim crossing failed for {0}", grp);
                }
            }
            else
            {
                m_log.Error("[ENTITY TRANSFER MODULE]: destination was unexpectedly null in Scene.CrossPrimGroupIntoNewRegion()");
            }

            return successYN;
        }
コード例 #7
0
 public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics)
     : base(Unchanged, false)
 {
     m_UnchangedEntity = Unchanged.Copy(false);
 }
コード例 #8
0
ファイル: Backup.cs プロジェクト: mugginsm/Aurora-Sim
            /// <summary>
            /// Deal with backing up this prim
            /// </summary>
            /// <param name="datastore">Place to save the prim into</param>
            /// <param name="forcedBackup">Is this backup forced?</param>
            /// <param name="shouldReaddToLoop">Should we even check this prim again until it is changed again?</param>
            /// <param name="shouldReaddToLoopNow">Should this prim be readded to the backup loop for immediate checking next loop?</param>
            /// <returns></returns>
            protected bool BackupGroup(SceneObjectGroup grp)
            {
                // Since this is the top of the section of call stack for backing up a particular scene object, don't let
                // any exception propogate upwards.

                // don't backup while it's selected or you're asking for changes mid stream.
                DateTime startTime = DateTime.Now;

                SceneObjectGroup backup_group = (SceneObjectGroup)grp.Copy(true);
                //Do this we don't try to re-persist to the DB
                backup_group.m_isLoaded = false;
                m_scene.SimulationDataService.StoreObject(backup_group, m_scene.RegionInfo.RegionID);

                //Backup inventory, no lock as this isn't added ANYWHERE but here
                foreach (SceneObjectPart part in backup_group.ChildrenList)
                {
                    part.Inventory.ProcessInventoryBackup(m_scene.SimulationDataService);
                }

                m_log.DebugFormat(
                        "[BackupModule]: Stored {0}, {1} in {2} at {3} in {4} seconds",
                        backup_group.Name, backup_group.UUID, m_scene.RegionInfo.RegionName, backup_group.AbsolutePosition.ToString(), (DateTime.Now - startTime).TotalSeconds);


                grp.HasGroupChanged = false;
                backup_group = null;
                return true;
            }
コード例 #9
0
 public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics)
     : base(Unchanged, false)
 {
     m_UnchangedEntity = Unchanged.Copy(Unchanged.RootPart.OwnerID, Unchanged.RootPart.GroupID, false);
 }
コード例 #10
0
ファイル: MetaEntity.cs プロジェクト: N3X15/VoxelSim
 /// <summary>
 /// Makes a new meta entity by copying the given scene object group.
 /// The physics boolean is just a stub right now.
 /// </summary>
 public MetaEntity(SceneObjectGroup orig, bool physics)
 {
     m_Entity = orig.Copy(false);
     Initialize(physics);
 }