Exemple #1
0
        public DateTime llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            bool found  = false;
            UUID destId = UUID.Zero;
            UUID srcId  = UUID.Zero;

            if (!UUID.TryParse(target, out destId))
            {
                Error("llRemoteLoadScriptPin", "Can't parse key '" + target + "'");
                return(DateTime.Now);
            }

            // target must be a different prim than the one containing the script
            if (m_host.UUID == destId)
            {
                return(DateTime.Now);
            }

            // copy the first script found with this inventory name
            lock (m_host.TaskInventory) {
                foreach (KeyValuePair <UUID, TaskInventoryItem> inv in m_host.TaskInventory)
                {
                    if (inv.Value.Name == name)
                    {
                        // make sure the object is a script
                        if (10 == inv.Value.Type)
                        {
                            found = true;
                            srcId = inv.Key;
                            break;
                        }
                    }
                }
            }

            if (!found)
            {
                Error("llRemoteLoadScriptPin", "Can't find script '" + name + "'");
                return(DateTime.Now);
            }

            // the rest of the permission checks are done in RezScript, so check the pin there as well
            ILLClientInventory inventoryModule = World.RequestModuleInterface <ILLClientInventory>();

            if (inventoryModule != null)
            {
                inventoryModule.RezScript(srcId, m_host, destId, pin, running, start_param);
            }
            // this will cause the delay even if the script pin or permissions were wrong - seems ok
            return(PScriptSleep(m_sleepMsOnRemoteLoadScriptPin));
        }