Esempio n. 1
0
        protected MapBlockData MapBlockFromGridRegion(GridRegion r, int x, int y)
        {
            MapBlockData block = new MapBlockData();

            if (r == null)
            {
                block.Access     = (byte)SimAccess.NonExistent;
                block.X          = (ushort)x;
                block.Y          = (ushort)y;
                block.MapImageID = UUID.Zero;
                return(block);
            }
            if ((r.Flags & (int)RegionFlags.RegionOnline) ==
                (int)RegionFlags.RegionOnline)
            {
                block.Access = r.Access;
            }
            else
            {
                block.Access = (byte)OpenMetaverse.SimAccess.Down;
            }
            block.MapImageID = r.TerrainImage;
            block.Name       = r.RegionName;
            block.X          = (ushort)(r.RegionLocX / Constants.RegionSize);
            block.Y          = (ushort)(r.RegionLocY / Constants.RegionSize);
            block.SizeX      = (ushort)r.RegionSizeX;
            block.SizeY      = (ushort)r.RegionSizeY;

            return(block);
        }
Esempio n. 2
0
        protected MapBlockData TerrainBlockFromGridRegion(GridRegion r)
        {
            MapBlockData block = new MapBlockData();

            if (r == null)
            {
                block.Access     = (byte)SimAccess.Down;
                block.MapImageID = UUID.Zero;
                return(block);
            }
            block.Access     = r.Access;
            block.MapImageID = r.TerrainMapImage;
            if ((r.Flags & (int)RegionFlags.RegionOnline) !=
                (int)RegionFlags.RegionOnline)
            {
                block.Name = r.RegionName + " (offline)";
            }
            else
            {
                block.Name = r.RegionName;
            }
            block.X     = (ushort)(r.RegionLocX / Constants.RegionSize);
            block.Y     = (ushort)(r.RegionLocY / Constants.RegionSize);
            block.SizeX = (ushort)r.RegionSizeX;
            block.SizeY = (ushort)r.RegionSizeY;
            return(block);
        }
 private void EventManager_OnMakeChildAgent(IScenePresence presence, GridRegion destination)
 {
     lock (scriptedcontrols)
     {
         scriptedcontrols.Clear(); //Remove all controls when we leave the region
     }
 }
Esempio n. 4
0
 protected void AgentIsLeaving(IScenePresence presence, GridRegion destination)
 {
     //If its a root agent, we need to save all attachments as well
     if (!presence.IsChildAgent)
     {
         SuspendAvatar(presence, destination);
     }
 }
Esempio n. 5
0
        public void SuspendAvatar(IScenePresence presence, GridRegion destination)
        {
            IAvatarAppearanceModule appearance = presence.RequestModuleInterface <IAvatarAppearanceModule>();

            presence.AttachmentsLoaded = false;
            ISceneEntity[] attachments = GetAttachmentsForAvatar(presence.UUID);
            foreach (ISceneEntity group in attachments)
            {
                if (group.RootChild.AttachedPos != group.RootChild.SavedAttachedPos ||
                    group.RootChild.SavedAttachmentPoint != group.RootChild.AttachmentPoint)
                {
                    group.RootChild.SavedAttachedPos     = group.RootChild.AttachedPos;
                    group.RootChild.SavedAttachmentPoint = group.RootChild.AttachmentPoint;
                    //Make sure we get updated
                    group.HasGroupChanged = true;
                }

                // If an item contains scripts, it's always changed.
                // This ensures script state is saved on detach
                foreach (ISceneChildEntity p in group.ChildrenEntities())
                {
                    if (p.Inventory.ContainsScripts())
                    {
                        group.HasGroupChanged = true;
                        break;
                    }
                }
                if (group.HasGroupChanged)
                {
                    UUID assetID = UpdateKnownItem(presence.ControllingClient, group,
                                                   group.RootChild.FromUserInventoryItemID,
                                                   group.OwnerID);
                    group.RootChild.FromUserInventoryAssetID = assetID;
                }
            }
            if (appearance != null)
            {
                appearance.Appearance.SetAttachments(attachments);
                presence.Scene.AvatarService.SetAppearance(presence.UUID,
                                                           appearance.Appearance);
            }
            IBackupModule backup = presence.Scene.RequestModuleInterface <IBackupModule>();

            if (backup != null)
            {
                bool sendUpdates = destination == null;
                if (!sendUpdates)
                {
                    List <GridRegion> regions =
                        presence.Scene.RequestModuleInterface <IGridRegisterModule>()
                        .GetNeighbors(presence.Scene);
                    regions.RemoveAll((r) => r.RegionID != destination.RegionID);
                    sendUpdates = regions.Count == 0;
                }
                backup.DeleteSceneObjects(attachments, false, sendUpdates);
            }
        }
Esempio n. 6
0
        protected List <MapBlockData> Map2BlockFromGridRegion(GridRegion r)
        {
            List <MapBlockData> blocks = new List <MapBlockData>();
            MapBlockData        block  = new MapBlockData();

            if (r == null)
            {
                block.Access     = (byte)SimAccess.Down;
                block.MapImageID = UUID.Zero;
                blocks.Add(block);
                return(blocks);
            }
            if ((r.Flags & (int)RegionFlags.RegionOnline) ==
                (int)RegionFlags.RegionOnline)
            {
                block.Access = r.Access;
            }
            else
            {
                block.Access = (byte)OpenMetaverse.SimAccess.Down;
            }
            block.MapImageID = r.TerrainImage;
            block.Name       = r.RegionName;
            block.X          = (ushort)(r.RegionLocX / Constants.RegionSize);
            block.Y          = (ushort)(r.RegionLocY / Constants.RegionSize);
            block.SizeX      = (ushort)r.RegionSizeX;
            block.SizeY      = (ushort)r.RegionSizeY;
            blocks.Add(block);
            if (r.RegionSizeX > Constants.RegionSize || r.RegionSizeY > Constants.RegionSize)
            {
                for (int x = 0; x < r.RegionSizeX / Constants.RegionSize; x++)
                {
                    for (int y = 0; y < r.RegionSizeY / Constants.RegionSize; y++)
                    {
                        if (x == 0 && y == 0)
                        {
                            continue;
                        }
                        block = new MapBlockData
                        {
                            Access     = r.Access,
                            MapImageID = r.TerrainImage,
                            Name       = r.RegionName,
                            X          = (ushort)((r.RegionLocX / Constants.RegionSize) + x),
                            Y          = (ushort)((r.RegionLocY / Constants.RegionSize) + y),
                            SizeX      = (ushort)r.RegionSizeX,
                            SizeY      = (ushort)r.RegionSizeY
                        };
                        //Child piece, so ignore it
                        blocks.Add(block);
                    }
                }
            }
            return(blocks);
        }
Esempio n. 7
0
        public void OnMakeChildAgent(IScenePresence agent, GridRegion destination)
        {
            MainConsole.Instance.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, m_scene.RegionInfo.RegionName);
            IEntityCountModule entityCountModule = m_scene.RequestModuleInterface <IEntityCountModule>();

            if (entityCountModule != null)
            {
                AnnounceToAgentsRegion(m_scene, String.Format(m_announceLeaving, agent.Name,
                                                              m_scene.RegionInfo.RegionName, entityCountModule.RootAgents));
                UpdateBroker(m_scene);
            }
        }
Esempio n. 8
0
 protected MapBlockData TerrainBlockFromGridRegion(GridRegion r)
 {
     MapBlockData block = new MapBlockData();
     if (r == null)
     {
         block.Access = (byte) SimAccess.Down;
         block.MapImageID = UUID.Zero;
         return block;
     }
     block.Access = r.Access;
     block.MapImageID = r.TerrainMapImage;
     if ((r.Access & (byte) SimAccess.Down) == (byte) SimAccess.Down)
         block.Name = r.RegionName + " (offline)";
     else
         block.Name = r.RegionName;
     block.X = (ushort) (r.RegionLocX/Constants.RegionSize);
     block.Y = (ushort) (r.RegionLocY/Constants.RegionSize);
     block.SizeX = (ushort) r.RegionSizeX;
     block.SizeY = (ushort) r.RegionSizeY;
     return block;
 }
Esempio n. 9
0
        protected MapBlockData MapBlockFromGridRegion(GridRegion r, int x, int y)
        {
            MapBlockData block = new MapBlockData();
            if (r == null)
            {
                block.Access = (byte) SimAccess.NonExistent;
                block.X = (ushort) x;
                block.Y = (ushort) y;
                block.MapImageID = UUID.Zero;
                return block;
            }
            if ((r.Flags & (int) RegionFlags.RegionOnline) ==
                (int) RegionFlags.RegionOnline)
                block.Access = r.Access;
            else
                block.Access = (byte) OpenMetaverse.SimAccess.Down;
            block.MapImageID = r.TerrainImage;
            block.Name = r.RegionName;
            block.X = (ushort) (r.RegionLocX/Constants.RegionSize);
            block.Y = (ushort) (r.RegionLocY/Constants.RegionSize);
            block.SizeX = (ushort) r.RegionSizeX;
            block.SizeY = (ushort) r.RegionSizeY;

            return block;
        }
Esempio n. 10
0
 protected List<MapBlockData> Map2BlockFromGridRegion(GridRegion r)
 {
     List<MapBlockData> blocks = new List<MapBlockData>();
     MapBlockData block = new MapBlockData();
     if (r == null)
     {
         block.Access = (byte) SimAccess.Down;
         block.MapImageID = UUID.Zero;
         blocks.Add(block);
         return blocks;
     }
     if ((r.Flags & (int) RegionFlags.RegionOnline) ==
         (int) RegionFlags.RegionOnline)
         block.Access = r.Access;
     else
         block.Access = (byte) OpenMetaverse.SimAccess.Down;
     block.MapImageID = r.TerrainImage;
     block.Name = r.RegionName;
     block.X = (ushort) (r.RegionLocX/Constants.RegionSize);
     block.Y = (ushort) (r.RegionLocY/Constants.RegionSize);
     block.SizeX = (ushort) r.RegionSizeX;
     block.SizeY = (ushort) r.RegionSizeY;
     blocks.Add(block);
     if (r.RegionSizeX > Constants.RegionSize || r.RegionSizeY > Constants.RegionSize)
     {
         for (int x = 0; x < r.RegionSizeX/Constants.RegionSize; x++)
         {
             for (int y = 0; y < r.RegionSizeY/Constants.RegionSize; y++)
             {
                 if (x == 0 && y == 0)
                     continue;
                 block = new MapBlockData
                             {
                                 Access = r.Access,
                                 MapImageID = r.TerrainImage,
                                 Name = r.RegionName,
                                 X = (ushort) ((r.RegionLocX/Constants.RegionSize) + x),
                                 Y = (ushort) ((r.RegionLocY/Constants.RegionSize) + y),
                                 SizeX = (ushort) r.RegionSizeX,
                                 SizeY = (ushort) r.RegionSizeY
                             };
                 //Child piece, so ignore it
                 blocks.Add(block);
             }
         }
     }
     return blocks;
 }
Esempio n. 11
0
 private void EventManager_OnMakeChildAgent(IScenePresence presence, GridRegion destination)
 {
     RemoveAvatarFromView(presence);
 }
 protected void OnMakeChildAgent(IScenePresence presence, GridRegion destination)
 {
     //Switch child agent to root agent
     m_rootAgents--;
     m_childAgents++;
 }
 void EventManager_OnMakeChildAgent(IScenePresence presence, GridRegion destination)
 {
     CloseClient(presence);
     presence.ControllingClient.OnPreSendInstantMessage -= ControllingClient_OnInstantMessage;
 }
 private void EventManager_OnMakeChildAgent(IScenePresence presence, GridRegion destination)
 {
     lock (scriptedcontrols)
     {
         scriptedcontrols.Clear(); //Remove all controls when we leave the region
     }
 }
Esempio n. 15
0
 protected void OnMakeChildAgent(IScenePresence presence, GridRegion destination)
 {
     //Switch child agent to root agent
     m_rootAgents--;
     m_childAgents++;
 }
Esempio n. 16
0
 protected void AgentIsLeaving(IScenePresence presence, GridRegion destination)
 {
     //If its a root agent, we need to save all attachments as well
     if (!presence.IsChildAgent)
         SuspendAvatar(presence, destination);
 }
Esempio n. 17
0
        private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
        {
            if (mapName.Length < 1)
            {
                remoteClient.SendAlertMessage("Use a search string with at least 1 character");
                return;
            }

            bool TryCoordsSearch = false;
            int  XCoord          = 0;
            int  YCoord          = 0;

            string[] splitSearch = mapName.Split(',');
            if (splitSearch.Length != 1)
            {
                if (splitSearch[1].StartsWith(" "))
                {
                    splitSearch[1] = splitSearch[1].Remove(0, 1);
                }
                if (int.TryParse(splitSearch[0], out XCoord) && int.TryParse(splitSearch[1], out YCoord))
                {
                    TryCoordsSearch = true;
                }
            }

            List <MapBlockData> blocks = new List <MapBlockData>();

            List <GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(remoteClient.AllScopeIDs, mapName, 0, 20);

            if (TryCoordsSearch)
            {
                GridRegion region = m_scene.GridService.GetRegionByPosition(remoteClient.AllScopeIDs,
                                                                            XCoord * Constants.RegionSize,
                                                                            YCoord * Constants.RegionSize);
                if (region != null)
                {
                    region.RegionName = mapName + " - " + region.RegionName;
                    regionInfos.Add(region);
                }
            }
            List <GridRegion> allRegions = new List <GridRegion>();

            if (regionInfos != null)
            {
                foreach (GridRegion region in regionInfos)
                {
                    //Add the found in search region first
                    if (!allRegions.Contains(region))
                    {
                        allRegions.Add(region);
                        blocks.Add(SearchMapBlockFromGridRegion(region));
                    }
                    //Then send surrounding regions
                    List <GridRegion> regions = m_scene.GridService.GetRegionRange(remoteClient.AllScopeIDs,
                                                                                   (region.RegionLocX -
                                                                                    (4 * Constants.RegionSize)),
                                                                                   (region.RegionLocX +
                                                                                    (4 * Constants.RegionSize)),
                                                                                   (region.RegionLocY -
                                                                                    (4 * Constants.RegionSize)),
                                                                                   (region.RegionLocY +
                                                                                    (4 * Constants.RegionSize)));
                    if (regions != null)
                    {
                        foreach (GridRegion r in regions)
                        {
                            if (!allRegions.Contains(region))
                            {
                                allRegions.Add(region);
                                blocks.Add(SearchMapBlockFromGridRegion(r));
                            }
                        }
                    }
                }
            }

            // final block, closing the search result
            MapBlockData data = new MapBlockData
            {
                Agents      = 0,
                Access      = 255,
                MapImageID  = UUID.Zero,
                Name        = mapName,
                RegionFlags = 0,
                WaterHeight = 0,
                X           = 0,
                Y           = 0,
                SizeX       = 256,
                SizeY       = 256
            };

            // not used
            blocks.Add(data);

            remoteClient.SendMapBlock(blocks, flags);
        }
Esempio n. 18
0
        public void SuspendAvatar(IScenePresence presence, GridRegion destination)
        {
            IAvatarAppearanceModule appearance = presence.RequestModuleInterface<IAvatarAppearanceModule>();
            Util.FireAndForget((o0) =>
                                   {
                                       presence.AttachmentsLoaded = false;
                                       ISceneEntity[] attachments = GetAttachmentsForAvatar(presence.UUID);
                                       foreach (ISceneEntity group in attachments)
                                       {
                                           if (group.RootChild.AttachedPos != group.RootChild.SavedAttachedPos ||
                                               group.RootChild.SavedAttachmentPoint != group.RootChild.AttachmentPoint)
                                           {
                                               group.RootChild.SavedAttachedPos = group.RootChild.AttachedPos;
                                               group.RootChild.SavedAttachmentPoint = group.RootChild.AttachmentPoint;
                                               //Make sure we get updated
                                               group.HasGroupChanged = true;
                                           }

                                           // If an item contains scripts, it's always changed.
                                           // This ensures script state is saved on detach
                                           foreach (ISceneChildEntity p in group.ChildrenEntities())
                                           {
                                               if (p.Inventory.ContainsScripts())
                                               {
                                                   group.HasGroupChanged = true;
                                                   break;
                                               }
                                           }
                                           if (group.HasGroupChanged)
                                           {
                                               UUID assetID = UpdateKnownItem(presence.ControllingClient, group,
                                                                              group.RootChild.FromUserInventoryItemID,
                                                                              group.OwnerID);
                                               group.RootChild.FromUserInventoryAssetID = assetID;
                                           }
                                       }
                                       if (appearance != null)
                                       {
                                           appearance.Appearance.SetAttachments(attachments);
                                           presence.Scene.AvatarService.SetAppearance(presence.UUID,
                                                                                      appearance.Appearance);
                                       }
                                       IBackupModule backup = presence.Scene.RequestModuleInterface<IBackupModule>();
                                       if (backup != null)
                                       {
                                           bool sendUpdates = destination == null;
                                           if (!sendUpdates)
                                           {
                                               List<GridRegion> regions =
                                                   presence.Scene.RequestModuleInterface<IGridRegisterModule>()
                                                           .GetNeighbors(presence.Scene);
                                               regions.RemoveAll((r) => r.RegionID != destination.RegionID);
                                               sendUpdates = regions.Count == 0;
                                           }
                                           backup.DeleteSceneObjects(attachments, false, sendUpdates);
                                       }
                                   });
        }
Esempio n. 19
0
 void EventManager_OnMakeChildAgent(IScenePresence presence, GridRegion destination)
 {
     CloseClient(presence);
     presence.ControllingClient.OnPreSendInstantMessage -= ControllingClient_OnInstantMessage;
 }
 public void OnMakeChildAgent(IScenePresence agent, GridRegion destination)
 {
     MainConsole.Instance.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, m_scene.RegionInfo.RegionName);
     IEntityCountModule entityCountModule = m_scene.RequestModuleInterface<IEntityCountModule>();
     if (entityCountModule != null)
     {
         AnnounceToAgentsRegion(m_scene, String.Format(m_announceLeaving, agent.Name,
                                                    m_scene.RegionInfo.RegionName, entityCountModule.RootAgents));
         UpdateBroker(m_scene);
     }
 }