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

llSameGroup() public method

public llSameGroup ( string id ) : OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger
id string
return OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger
        public LSL_Integer llSameGroup(string id)
        {
            m_host.AddScriptLPS(1);
            UUID uuid = new UUID();
            if (!UUID.TryParse(id, out uuid))
                return new LSL_Integer(0);

            // Check if it's a group key
            if (uuid == m_host.ParentGroup.RootPart.GroupID)
                return new LSL_Integer(1);

            // Handle object case
            SceneObjectPart part = World.GetSceneObjectPart(uuid);
            if (part != null)
            {
                
                if(part.ParentGroup.IsAttachment)
                {
                    uuid = part.ParentGroup.AttachedAvatar;   
                }
                else
                {
                    // This will handle both deed and non-deed and also the no
                    // group case
                    if (part.ParentGroup.RootPart.GroupID == m_host.ParentGroup.RootPart.GroupID)
                        return new LSL_Integer(1);

                    return new LSL_Integer(0);
                }
            }

            // Handle the case where id names an avatar
            ScenePresence presence = World.GetScenePresence(uuid);
            if (presence != null)
            {
                if (presence.IsChildAgent)
                    return new LSL_Integer(0);

                IClientAPI client = presence.ControllingClient;
                if (m_host.ParentGroup.RootPart.GroupID == client.ActiveGroupId)
                    return new LSL_Integer(1);

                return new LSL_Integer(0);
            }

            return new LSL_Integer(0);
        }
LSL_Api