OpenSim.Region.ScriptEngine.Shared.Api.LSL_Api.llGetAgentList C# (CSharp) Method

llGetAgentList() public method

http://wiki.secondlife.com/wiki/LlGetAgentList The list of options is currently not used in SL scope is one of:- AGENT_LIST_REGION - all in the region AGENT_LIST_PARCEL - all in the same parcel as the scripted object AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the current parcel.
public llGetAgentList ( OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger scope, OpenSim.Region.ScriptEngine.Shared.LSL_Types.list options ) : OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
scope OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger
options OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
return OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
        public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
        {
            m_host.AddScriptLPS(1);

            // the constants are 1, 2 and 4 so bits are being set, but you
            // get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4
            bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION;
            bool parcelOwned = scope == ScriptBaseClass.AGENT_LIST_PARCEL_OWNER;
            bool parcel = scope == ScriptBaseClass.AGENT_LIST_PARCEL;

            LSL_List result = new LSL_List();

            if (!regionWide && !parcelOwned && !parcel)
            {
                result.Add("INVALID_SCOPE");
                return result;
            }

            ILandObject land;
            UUID id = UUID.Zero;

            if (parcel || parcelOwned)
            {
                land = World.LandChannel.GetLandObject(m_host.ParentGroup.RootPart.GetWorldPosition());
                if (land == null)
                {
                    id = UUID.Zero;
                }
                else
                {
                    if (parcelOwned)
                    {
                        id = land.LandData.OwnerID;
                    }
                    else
                    {
                        id = land.LandData.GlobalID;
                    }
                }
            }

            World.ForEachRootScenePresence(
                delegate (ScenePresence ssp)
                {
                    // Gods are not listed in SL
                    if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent)
                    {
                        if (!regionWide)
                        {
                            land = World.LandChannel.GetLandObject(ssp.AbsolutePosition);
                            if (land != null)
                            {
                                if (parcelOwned && land.LandData.OwnerID == id ||
                                    parcel && land.LandData.GlobalID == id)
                                {
                                    result.Add(new LSL_Key(ssp.UUID.ToString()));
                                }
                            }
                        }
                        else
                        {
                            result.Add(new LSL_Key(ssp.UUID.ToString()));
                        }
                    }
                    // Maximum of 100 results
                    if (result.Length > 99)
                    {
                        return;
                    }
                }
            );
            return result;
        }
LSL_Api