OpenSim.Region.Framework.Scenes.Scene.ForEachScenePresence C# (CSharp) Method

ForEachScenePresence() public method

Performs action on all scene presences.
public ForEachScenePresence ( Action action ) : void
action Action
return void
        public void ForEachScenePresence(Action<ScenePresence> action)
        {
            if (m_sceneGraph != null)
            {
                m_sceneGraph.ForEachScenePresence(action);
            }
        }

Usage Example

        public void OnClosingClient(UUID clientID, Scene scene)
        {
            //Clear out the auth speakers list
            lock (m_authorizedSpeakers)
            {
                if (m_authorizedSpeakers.Contains(clientID))
                    m_authorizedSpeakers.Remove(clientID);
            }

            ScenePresence presence = scene.GetScenePresence(clientID);
            //Announce the closing agent if enabled
            if (m_announceClosedAgents)
            {
                scene.ForEachScenePresence(delegate(ScenePresence SP)
                {
                    if (SP.UUID != clientID && !SP.IsChildAgent)
                    {
                        IEntityCountModule entityCountModule = scene.RequestModuleInterface<IEntityCountModule>();
                        if (entityCountModule != null)
                            SP.ControllingClient.SendChatMessage(presence.Name + " has left the region. Total Agents: " + entityCountModule.RootAgents, 1, SP.AbsolutePosition, "System",
                                                           UUID.Zero, (byte)ChatSourceType.System, (byte)ChatAudibleLevel.Fully);
                    }
                }
                );
            }
        }
All Usage Examples Of OpenSim.Region.Framework.Scenes.Scene::ForEachScenePresence
Scene