/// <summary> /// Move the given scene object into a new region depending on which region its absolute position has moved /// into. /// This method locates the new region handle and offsets the prim position for the new region /// </summary> /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> /// <param name="grp">the scene object that we're crossing</param> /// <param name="destination"></param> public bool CrossGroupToNewRegion(ISceneEntity grp, Vector3 attemptedPosition, GridRegion destination) { if (grp == null) return false; if (grp.IsDeleted) return false; if (grp.Scene == null) return false; if (grp.RootChild.DIE_AT_EDGE) { // We remove the object here try { IBackupModule backup = grp.Scene.RequestModuleInterface<IBackupModule>(); if (backup != null) return backup.DeleteSceneObjects(new[] {grp}, true, true); } catch (Exception) { MainConsole.Instance.Warn( "[DATABASE]: exception when trying to remove the prim that crossed the border."); } return false; } if (grp.RootChild.RETURN_AT_EDGE) { // We remove the object here try { List<ISceneEntity> objects = new List<ISceneEntity> {grp}; ILLClientInventory inventoryModule = grp.Scene.RequestModuleInterface<ILLClientInventory>(); if (inventoryModule != null) return inventoryModule.ReturnObjects(objects.ToArray(), UUID.Zero); } catch (Exception) { MainConsole.Instance.Warn( "[SCENE]: exception when trying to return the prim that crossed the border."); } return false; } Vector3 oldGroupPosition = grp.RootChild.GroupPosition; // If we fail to cross the border, then reset the position of the scene object on that border. if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, attemptedPosition)) { grp.OffsetForNewRegion(oldGroupPosition); grp.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate); return false; } return true; }
/// <summary> /// Move the given scene object into a new region depending on which region its absolute position has moved /// into. /// This method locates the new region handle and offsets the prim position for the new region /// </summary> /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> /// <param name="grp">the scene object that we're crossing</param> /// <param name="destination"></param> public bool CrossGroupToNewRegion(ISceneEntity grp, Vector3 attemptedPosition, GridRegion destination) { if (grp == null) { return(false); } if (grp.IsDeleted) { return(false); } if (grp.Scene == null) { return(false); } if (grp.RootChild.DIE_AT_EDGE) { // We remove the object here try { IBackupModule backup = grp.Scene.RequestModuleInterface <IBackupModule> (); if (backup != null) { return(backup.DeleteSceneObjects(new [] { grp }, true, true)); } } catch (Exception) { MainConsole.Instance.Warn( "[Database]: exception when trying to remove the prim that crossed the border."); } return(false); } if (grp.RootChild.RETURN_AT_EDGE) { // We remove the object here try { List <ISceneEntity> objects = new List <ISceneEntity> { grp }; ILLClientInventory inventoryModule = grp.Scene.RequestModuleInterface <ILLClientInventory> (); if (inventoryModule != null) { return(inventoryModule.ReturnObjects(objects.ToArray(), UUID.Zero)); } } catch (Exception) { MainConsole.Instance.Warn( "[Scene]: exception when trying to return the prim that crossed the border."); } return(false); } Vector3 oldGroupPosition = grp.RootChild.GroupPosition; // If we fail to cross the border, then reset the position of the scene object on that border. if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, attemptedPosition)) { grp.OffsetForNewRegion(oldGroupPosition); grp.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate); return(false); } return(true); }