示例#1
0
        public void llMessageLinked(int linknumber, int num, string msg, string id)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }


            List <ISceneChildEntity> parts = GetLinkParts(linknumber);

            foreach (ISceneChildEntity part in parts)
            {
                int linkNumber = m_host.LinkNum;
                if (m_host.ParentEntity.ChildrenEntities().Count == 1)
                {
                    linkNumber = 0;
                }

                object[] resobj = { new LSL_Integer(linkNumber),
                                    new LSL_Integer(num),
                                    new LSL_String(msg),
                                    new LSL_String(id) };

                m_ScriptEngine.PostObjectEvent(part.UUID, "link_message", resobj);
            }
        }
示例#2
0
        public LSL_String llXorBase64StringsCorrect(string str1, string str2)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return("");
            }

            string ret  = string.Empty;
            string src1 = llBase64ToString(str1);
            string src2 = llBase64ToString(str2);
            int    c    = 0;

            foreach (char t in src1)
            {
                ret += (char)(t ^ src2[c]);

                c++;
                if (c >= src2.Length)
                {
                    c = 0;
                }
            }

            PScriptSleep(m_sleepMsOnXorBase64Strings);
            return(llStringToBase64(ret));
        }
        public DateTime llTextBox(string agent, string message, int chatChannel)
        {
            IDialogModule dm = World.RequestModuleInterface <IDialogModule>();

            if (dm == null)
            {
                return(DateTime.Now);
            }

            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            UUID av = new UUID();

            if (!UUID.TryParse(agent, out av))
            {
                Error("llDialog", "First parameter must be a key");
                return(DateTime.Now);
            }

            if (message != null && message.Length > 1024)
            {
                message = message.Substring(0, 1024);
            }

            dm.SendTextBoxToUser(av, message, chatChannel, m_host.Name, m_host.UUID, m_host.OwnerID);
            return(PScriptSleep(m_sleepMsOnTextBox));
        }
        public void llBreakAllLinks()
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            ISceneEntity parentPrim = m_host.ParentEntity;

            if (parentPrim.RootChild.AttachmentPoint != 0)
            {
                return; // Fail silently if attached
            }
            List <ISceneChildEntity> parts = new List <ISceneChildEntity>(parentPrim.ChildrenEntities());

            parts.Remove(parentPrim.RootChild);

            foreach (ISceneChildEntity part in parts)
            {
                parentPrim.DelinkFromGroup(part, true);
                parentPrim.TriggerScriptChangedEvent(Changed.LINK);
                part.ParentEntity.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
            }
            parentPrim.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
        }
示例#5
0
        public void llRegionSayTo(LSL_Key toID, int channelID, string text)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            IChatModule chatModule = World.RequestModuleInterface <IChatModule>();

            if (text.Length > 1023)
            {
                text = text.Substring(0, 1023);
            }
            if (channelID == 0)
            {
                IScenePresence presence = World.GetScenePresence(UUID.Parse(toID.m_string));
                if (presence != null)
                {
                    if (chatModule != null)
                    {
                        chatModule.TrySendChatMessage(presence, m_host.AbsolutePosition,
                                                      m_host.UUID, m_host.Name, ChatTypeEnum.Say, text,
                                                      ChatSourceType.Object, 10000);
                    }
                }
            }

            if (m_comms != null)
            {
                m_comms.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID,
                                       UUID.Parse(toID.m_string), text);
            }
        }
示例#6
0
        public DateTime llResetLandPassList()
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            IParcelManagementModule parcelManagement = World.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                LandData land =
                    parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
                if (land.OwnerID == m_host.OwnerID)
                {
                    foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList)
                    {
                        if (entry.Flags == AccessList.Access)
                        {
                            land.ParcelAccessList.Remove(entry);
                        }
                    }
                }
            }
            return(PScriptSleep(m_sleepMsOnResetLandPassList));
        }
示例#7
0
        public void llRegionSay(int channelID, string text)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            if (text.Length > 1023)
            {
                text = text.Substring(0, 1023);
            }

            if (channelID == 0) //0 isn't normally allowed, so check against a higher threat level
            {
                if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "LSL", m_host, "LSL", m_itemID))
                {
                    return;
                }
            }

            IChatModule chatModule = World.RequestModuleInterface <IChatModule>();

            if (chatModule != null)
            {
                chatModule.SimChat(text, ChatTypeEnum.Region, channelID,
                                   m_host.ParentEntity.RootChild.AbsolutePosition, m_host.Name, m_host.UUID, false,
                                   World);
            }

            if (m_comms != null)
            {
                m_comms.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text);
            }
        }
示例#8
0
        public DateTime llRemoveFromLandBanList(string avatar)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            IParcelManagementModule parcelManagement = World.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                LandData land =
                    parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
                if (land.OwnerID == m_host.OwnerID)
                {
                    UUID key;
                    if (UUID.TryParse(avatar, out key))
                    {
                        foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList)
                        {
                            if (entry.AgentID == key && entry.Flags == AccessList.Ban)
                            {
                                land.ParcelAccessList.Remove(entry);
                                break;
                            }
                        }
                    }
                }
            }
            return(PScriptSleep(m_sleepMsOnRemoveFromLandBanList));
        }
        public LSL_Float llList2Float(LSL_List src, int index)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(new LSL_Float());
            }

            if (index < 0)
            {
                index = src.Length + index;
            }
            if (index >= src.Length || index < 0)
            {
                return(0.0);
            }
            try {
                if (src.Data[index] is LSL_Integer)
                {
                    return(Convert.ToDouble(((LSL_Integer)src.Data[index]).value));
                }
                if (src.Data[index] is LSL_Float)
                {
                    return(Convert.ToDouble(((LSL_Float)src.Data[index]).value));
                }
                if (src.Data[index] is LSL_String)
                {
                    return(Convert.ToDouble(((LSL_String)src.Data[index]).m_string));
                }
                return(Convert.ToDouble(src.Data[index]));
            } catch (FormatException) {
                return(0.0);
            } catch (InvalidCastException) {
                return(0.0);
            }
        }
示例#10
0
        public void llGroundRepel(double height, int water, double tau)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            if (m_host.PhysActor != null)
            {
                float        ground     = (float)llGround(new LSL_Vector(0, 0, 0));
                float        waterLevel = (float)llWater(new LSL_Vector(0, 0, 0));
                PIDHoverType hoverType  = PIDHoverType.Ground;
                if (water != 0)
                {
                    hoverType = PIDHoverType.GroundAndWater;
                    if (ground < waterLevel)
                    {
                        height += waterLevel;
                    }
                    else
                    {
                        height += ground;
                    }
                }
                else
                {
                    height += ground;
                }

                m_host.SetHoverHeight((float)height, hoverType, (float)tau);
            }
        }
示例#11
0
        public DateTime llSetParcelMusicURL(string url)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            IParcelManagementModule parcelManagement = World.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                ILandObject land = parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);

                if (land == null)
                {
                    return(DateTime.Now);
                }

                if (!World.Permissions.CanEditParcel(m_host.OwnerID, land))
                {
                    return(DateTime.Now);
                }

                land.SetMusicUrl(url);
            }

            return(PScriptSleep(m_sleepMsOnSetParcelMusicURL));
        }
示例#12
0
        public LSL_Integer llSameGroup(string agent)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(new LSL_Integer());
            }

            UUID agentId = new UUID();

            if (!UUID.TryParse(agent, out agentId))
            {
                return(new LSL_Integer(0));
            }
            IScenePresence presence = World.GetScenePresence(agentId);

            if (presence == null || presence.IsChildAgent) // Return flase for child agents
            {
                return(new LSL_Integer(0));
            }
            IClientAPI client = presence.ControllingClient;

            if (m_host.GroupID == client.ActiveGroupId)
            {
                return(new LSL_Integer(1));
            }
            return(new LSL_Integer(0));
        }
        // Returns the angle of a quaternion (see llRot2Axis for the axis)
        public LSL_Float llRot2Angle(LSL_Rotation rot)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(new LSL_Float());
            }


            if (rot.s > 1) // normalization needed
            {
                double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
                                          rot.z * rot.z + rot.s * rot.s);

                if (FloatAlmostEqual(length, 0))
                {
                    return(0);
                }
                //                rot.x /= length;
                //                rot.y /= length;
                //                rot.z /= length;
                rot.s /= length;
            }

            double angle = 2 * Math.Acos(rot.s);

            return(angle);
        }
示例#14
0
        public void llSetObjectPermMask(int mask, int value)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }


            if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
            {
                if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
                {
                    if (mask == ScriptBaseClass.MASK_BASE) //0
                    {
                        m_host.BaseMask = (uint)value;
                    }
                    else if (mask == ScriptBaseClass.MASK_OWNER)   //1
                    {
                        m_host.OwnerMask = (uint)value;
                    }
                    else if (mask == ScriptBaseClass.MASK_GROUP)   //2
                    {
                        m_host.GroupMask = (uint)value;
                    }
                    else if (mask == ScriptBaseClass.MASK_EVERYONE)   //3
                    {
                        m_host.EveryoneMask = (uint)value;
                    }
                    else if (mask == ScriptBaseClass.MASK_NEXT)   //4
                    {
                        m_host.NextOwnerMask = (uint)value;
                    }
                }
            }
        }
示例#15
0
        public void llShout(int channelID, string text)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            if (text.Length > 1023)
            {
                text = text.Substring(0, 1023);
            }

            IChatModule chatModule = World.RequestModuleInterface <IChatModule>();

            if (chatModule != null)
            {
                chatModule.SimChat(text, ChatTypeEnum.Shout, channelID,
                                   m_host.ParentEntity.RootChild.AbsolutePosition, m_host.Name, m_host.UUID, true, World);
            }

            if (m_comms != null)
            {
                m_comms.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text);
            }
        }
示例#16
0
        public void llAttachToAvatar(int attachmentPoint)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }


            if (m_host.ParentEntity.RootChild.AttachmentPoint != 0)
            {
                return;
            }

            TaskInventoryItem item;

            lock (m_host.TaskInventory) {
                if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
                {
                    return;
                }
                item = m_host.TaskInventory[InventorySelf()];
            }

            if (item.PermsGranter != m_host.OwnerID)
            {
                return;
            }

            if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
            {
                AttachToAvatar(attachmentPoint, false);
            }
        }
示例#17
0
        public DateTime llAddToLandBanList(string avatar, double hours)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            IParcelManagementModule parcelManagement = World.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                LandData land =
                    parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
                if (land.OwnerID == m_host.OwnerID)
                {
                    ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
                    UUID key;
                    if (UUID.TryParse(avatar, out key))
                    {
                        entry.AgentID = key;
                        entry.Flags   = AccessList.Ban;
                        entry.Time    = DateTime.Now.AddHours(hours);
                        land.ParcelAccessList.Add(entry);
                    }
                }
            }
            return(PScriptSleep(m_sleepMsOnAddToLandBanList));
        }
        public LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(new LSL_Float());
            }


            double aa    = (a.x * a.x + a.y * a.y + a.z * a.z + a.s * a.s);
            double bb    = (b.x * b.x + b.y * b.y + b.z * b.z + b.s * b.s);
            double aa_bb = aa * bb;

            if (FloatAlmostEqual(aa_bb, 0))
            {
                return(0.0);
            }
            double ab       = (a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s);
            double quotient = (ab * ab) / aa_bb;

            if (quotient >= 1.0)
            {
                return(0.0);
            }
            return(Math.Acos(2 * quotient - 1));
        }
        //  <summary>
        //  Converts a 32-bit integer into a Base64
        //  character string. Base64 character strings
        //  are always 8 characters long. All iinteger
        //  values are acceptable.
        //  </summary>
        //  <param name="number">
        //  32-bit integer to be converted.
        //  </param>
        //  <returns>
        //  8 character string. The 1st six characters
        //  contain the encoded number, the last two
        //  characters are padded with "=".
        //  </returns>

        public LSL_String llIntegerToBase64(int number)
        {
            // uninitialized string

            char[] imdt = new char[8];

            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return("");
            }


            // Manually unroll the loop

            imdt[7] = '=';
            imdt[6] = '=';
            imdt[5] = i2ctable[number << 4 & 0x3F];
            imdt[4] = i2ctable[number >> 2 & 0x3F];
            imdt[3] = i2ctable[number >> 8 & 0x3F];
            imdt[2] = i2ctable[number >> 14 & 0x3F];
            imdt[1] = i2ctable[number >> 20 & 0x3F];
            imdt[0] = i2ctable[number >> 26 & 0x3F];

            return(new string(imdt));
        }
        public LSL_Vector llRot2Up(LSL_Rotation r)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(new LSL_Vector());
            }

            double m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s;

            // m is always greater than zero
            // if m is not equal to 1 then Rotation needs to be normalized
            if (Math.Abs(1.0 - m) > 0.000001) // allow a little slop here for calculation precision
            {
                m    = 1.0 / Math.Sqrt(m);
                r.x *= m;
                r.y *= m;
                r.z *= m;
                r.s *= m;
            }

            // Fast Algebric Calculations instead of Vectors & Quaternions Product
            double x = 2 * (r.x * r.z + r.y * r.s);
            double y = 2 * (-r.x * r.s + r.y * r.z);
            double z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s;

            return(new LSL_Vector(x, y, z));
        }
        public LSL_String llGetAnimation(string id)
        {
            // This should only return a value if the avatar is in the same region
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return("");
            }

            UUID           avatar   = (UUID)id;
            IScenePresence presence = World.GetScenePresence(avatar);

            if (presence == null)
            {
                return("");
            }

            if (m_host.ParentEntity.Scene.RegionInfo.RegionHandle == presence.Scene.RegionInfo.RegionHandle)
            {
                Dictionary <UUID, string> animationstateNames = AnimationSet.Animations.AnimStateNames;
                AnimationSet currentAnims          = presence.Animator.Animations;
                string       currentAnimationState = string.Empty;
                if (animationstateNames.TryGetValue(currentAnims.ImplicitDefaultAnimation.AnimID,
                                                    out currentAnimationState))
                {
                    return(currentAnimationState);
                }
            }

            return(string.Empty);
        }
示例#22
0
        public void llSay(int channelID, object m_text)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            string text = m_text.ToString();

            if (m_scriptConsoleChannelEnabled && (channelID == m_scriptConsoleChannel))
            {
                MainConsole.Instance.Debug(text);
            }
            else
            {
                if (text.Length > 1023)
                {
                    text = text.Substring(0, 1023);
                }

                IChatModule chatModule = World.RequestModuleInterface <IChatModule>();
                if (chatModule != null)
                {
                    chatModule.SimChat(text, ChatTypeEnum.Say, channelID,
                                       m_host.ParentEntity.RootChild.AbsolutePosition, m_host.Name, m_host.UUID, false,
                                       World);
                }

                if (m_comms != null)
                {
                    m_comms.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text);
                }
            }
        }
示例#23
0
        public LSL_String llKey2Name(string id)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return("");
            }

            UUID key = new UUID();

            if (UUID.TryParse(id, out key))
            {
                IScenePresence presence = World.GetScenePresence(key);

                if (presence != null)
                {
                    return(presence.Name);
                }

                if (World.GetSceneObjectPart(key) != null)
                {
                    return(World.GetSceneObjectPart(key).Name);
                }
            }
            return(string.Empty);
        }
示例#24
0
        public void llTakeControls(int controls, int accept, int pass_on)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            TaskInventoryItem item;

            lock (m_host.TaskInventory) {
                if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
                {
                    return;
                }
                item = m_host.TaskInventory[InventorySelf()];
            }

            if (item.PermsGranter != UUID.Zero)
            {
                IScenePresence presence = World.GetScenePresence(item.PermsGranter);

                if (presence != null)
                {
                    if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
                    {
                        IScriptControllerModule m = presence.RequestModuleInterface <IScriptControllerModule>();
                        if (m != null)
                        {
                            m.RegisterControlEventsToScript(controls, accept, pass_on, m_host, m_itemID);
                        }
                    }
                }
            }
        }
        // Xantor 20080528 we should do this differently.
        // 1) apply the sound to the object
        // 2) schedule full update
        // just sending the sound out once doesn't work so well when other avatars come in view later on
        // or when the prim gets moved, changed, sat on, whatever
        // see large number of mantises (mantes?)
        // 20080530 Updated to remove code duplication
        // 20080530 Stop sound if there is one, otherwise volume only changes don't work
        public void llLoopSound(string sound, double volume)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }

            if (m_host.Sound == KeyOrName(sound, AssetType.Sound, true))
            {
                return;
            }

            if (m_host.Sound != UUID.Zero)
            {
                llStopSound();
            }

            m_host.Sound      = KeyOrName(sound, AssetType.Sound, true);
            m_host.SoundGain  = volume;
            m_host.SoundFlags = (byte)SoundFlags.Loop; // looping
            if (FloatAlmostEqual(m_host.SoundRadius, 0))
            {
                m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
            }
            m_host.ScheduleUpdate(PrimUpdateFlags.FindBest);
        }
示例#26
0
        /// <summary>
        ///     illListReplaceList removes the sub-list defined by the inclusive indices
        ///     start and end and inserts the src list in its place. The inclusive
        ///     nature of the indices means that at least one element must be deleted
        ///     if the indices are within the bounds of the existing list. I.e. 2,2
        ///     will remove the element at index 2 and replace it with the source
        ///     list. Both indices may be negative, with the usual interpretation. An
        ///     interesting case is where end is lower than start. As these indices
        ///     bound the list to be removed, then 0->end, and start->lim are removed
        ///     and the source list is added as a suffix.
        /// </summary>
        public LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(new LSL_List());
            }


            // Note that although we have normalized, both
            // indices could still be negative.
            if (start < 0)
            {
                start = start + dest.Length;
            }

            if (end < 0)
            {
                end = end + dest.Length;
            }
            // The comventional case, remove a sequence starting with
            // start and ending with end. And then insert the source
            // list.
            if (start <= end)
            {
                // If greater than zero, then there is going to be a
                // surviving prefix. Otherwise the inclusive nature
                // of the indices mean that we're going to add the
                // source list as a prefix.
                if (start > 0)
                {
                    LSL_List pref = dest.GetSublist(0, start - 1);
                    // Only add a suffix if there is something
                    // beyond the end index (it's inclusive too).
                    if (end + 1 < dest.Length)
                    {
                        return(pref + src + dest.GetSublist(end + 1, -1));
                    }
                    return(pref + src);
                }
                // If start is less than or equal to zero, then
                // the new list is simply a prefix. We still need to
                // figure out any necessary surgery to the destination
                // based upon end. Note that if end exceeds the upper
                // bound in this case, the entire destination list
                // is removed.
                if (end + 1 < dest.Length)
                {
                    return(src + dest.GetSublist(end + 1, -1));
                }
                return(src);
            }
            // Finally, if start > end, we strip away a prefix and
            // a suffix, to leave the list that sits <between> ens
            // and start, and then tag on the src list. AT least
            // that's my interpretation. We can get sublist to do
            // this for us. Note that one, or both of the indices
            // might have been negative.
            return(dest.GetSublist(end + 1, start - 1) + src);
        }
        public void llStartAnimation(string anim)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return;
            }


            UUID invItemID = InventorySelf();

            if (invItemID == UUID.Zero)
            {
                return;
            }

            TaskInventoryItem item;

            lock (m_host.TaskInventory) {
                if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
                {
                    return;
                }
                item = m_host.TaskInventory[InventorySelf()];
            }

            if (item.PermsGranter == UUID.Zero)
            {
                return;
            }

            if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
            {
                IScenePresence presence = World.GetScenePresence(item.PermsGranter);

                if (presence != null)
                {
                    // Do NOT try to parse UUID, animations cannot be triggered by ID
                    UUID animID = KeyOrName(anim, AssetType.Animation, false);
                    if (animID == UUID.Zero)
                    {
                        bool RetVal = presence.Animator.AddAnimation(anim, m_host.UUID);
                        if (!RetVal)
                        {
                            IChatModule chatModule = World.RequestModuleInterface <IChatModule>();
                            if (chatModule != null)
                            {
                                chatModule.SimChat("Could not find animation '" + anim + "'.",
                                                   ChatTypeEnum.DebugChannel, 2147483647, m_host.AbsolutePosition,
                                                   m_host.Name, m_host.UUID, false, World);
                            }
                        }
                    }
                    else
                    {
                        presence.Animator.AddAnimation(animID, m_host.UUID);
                    }
                }
            }
        }
 /// <summary>
 ///     llSoundPreload is deprecated. In SL this appears to do absolutely nothing
 ///     and is documented to have no delay.
 /// </summary>
 public void llSoundPreload(string sound)
 {
     if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
     {
         return;
     }
     Deprecated("llSoundPreload", "Use llPreloadSound instead");
 }
 public LSL_Vector llVecNorm(LSL_Vector v)
 {
     if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
     {
         return(new LSL_Vector());
     }
     return(LSL_Vector.Norm(v));
 }
示例#30
0
 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
 {
     if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
     {
         return;
     }
     SitTarget(m_host, offset, rot);
 }