/**
         * @brief The script called llResetScript() while it was running and
         *        has suspended.  We want to reset the script to a never-has-
         *        ever-run-before state.
         *
         *        Caller must have m_RunLock locked so we know script isn't
         *        running.
         */
        private void ResetLocked(string from)
        {
            m_RunOnePhase = "ResetLocked: releasing controls";
            ReleaseControlsOrPermissions(true);
            m_Part.CollisionSound = UUID.Zero;

            if (m_XMRLSLApi != null)
            {
                m_XMRLSLApi.llResetTime();
            }

            m_RunOnePhase = "ResetLocked: removing script";
            IUrlModule urlModule = m_Engine.World.RequestModuleInterface <IUrlModule>();

            if (urlModule != null)
            {
                urlModule.ScriptRemoved(m_ItemID);
            }

            AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);

            m_RunOnePhase  = "ResetLocked: clearing current event";
            this.eventCode = ScriptEventCode.None; // not processing an event
            m_DetectParams = null;                 // not processing an event
            m_SleepUntil   = DateTime.MinValue;    // not doing llSleep()
            m_ResetCount++;                        // has been reset once more

            m_localsHeapUsed = 0;
            m_arraysHeapUsed = 0;
            glblVars.Clear();

            // Tell next call to 'default state_entry()' to reset all global
            // vars to their initial values.
            doGblInit = true;

            // Throw away all its stack frames.
            // If the script is resetting itself, there shouldn't be any stack frames.
            // If the script is being reset by something else, we throw them away cuz we want to start from the beginning of an event handler.
            stackFrames = null;

            // Set script to 'default' state and queue call to its
            // 'state_entry()' event handler.
            m_RunOnePhase = "ResetLocked: posting default:state_entry() event";
            stateCode     = 0;
            m_Part.RemoveScriptTargets(m_ItemID);
            m_Part.SetScriptEvents(m_ItemID, GetStateEventFlags(0));
            PostEvent(new EventParams("state_entry",
                                      zeroObjectArray,
                                      zeroDetectParams));

            // Tell CheckRun() to let script run.
            suspendOnCheckRunHold = false;
            suspendOnCheckRunTemp = false;
            m_RunOnePhase         = "ResetLocked: reset complete";
        }
Exemple #2
0
        /**
         * @brief The script called llResetScript() while it was running and
         *        has suspended.  We want to reset the script to a never-has-
         *        ever-run-before state.
         *
         *        Caller must have m_RunLock locked so we know script isn't
         *        running.
         */
        private void ResetLocked(string from)
        {
            m_RunOnePhase = "ResetLocked: releasing controls";
            ReleaseControls();

            m_RunOnePhase = "ResetLocked: removing script";
            m_Part.Inventory.GetInventoryItem(m_ItemID).PermsMask    = 0;
            m_Part.Inventory.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero;
            IUrlModule urlModule = m_Engine.World.RequestModuleInterface <IUrlModule>();

            if (urlModule != null)
            {
                urlModule.ScriptRemoved(m_ItemID);
            }

            AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);

            m_RunOnePhase  = "ResetLocked: clearing current event";
            this.eventCode = ScriptEventCode.None;  // not processing an event
            m_DetectParams = null;                  // not processing an event
            m_SleepUntil   = DateTime.MinValue;     // not doing llSleep()
            m_ResetCount++;                         // has been reset once more

            /*
             * Tell next call to 'default state_entry()' to reset all global
             * vars to their initial values.
             */
            doGblInit = true;

            /*
             * Throw away all its stack frames.
             * If the script is resetting itself, there shouldn't be any stack frames.
             * If the script is being reset by something else, we throw them away cuz we want to start from the beginning of an event handler.
             */
            stackFrames = null;

            /*
             * Set script to 'default' state and queue call to its
             * 'state_entry()' event handler.
             */
            m_RunOnePhase = "ResetLocked: posting default:state_entry() event";
            stateCode     = 0;
            m_Part.SetScriptEvents(m_ItemID, GetStateEventFlags(0));
            PostEvent(new EventParams("state_entry",
                                      zeroObjectArray,
                                      zeroDetectParams));

            /*
             * Tell CheckRun() to let script run.
             */
            suspendOnCheckRunHold = false;
            suspendOnCheckRunTemp = false;
            m_RunOnePhase         = "ResetLocked: reset complete";
        }
        public void Initialize(
            IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
        {
            m_ScriptEngine = scriptEngine;
            m_host = host;
            m_item = item;
            m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);

            m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();

            if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
            {
                m_OSFunctionsEnabled = true;
                // m_log.Warn("[OSSL] OSSL FUNCTIONS ENABLED");
            }

            m_ScriptDelayFactor =
                    m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
            m_ScriptDistanceFactor =
                    m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);

            string risk = m_ScriptEngine.Config.GetString("OSFunctionThreatLevel", "VeryLow");
            switch (risk)
            {
            case "NoAccess":
                m_MaxThreatLevel = ThreatLevel.NoAccess;
                break;
            case "None":
                m_MaxThreatLevel = ThreatLevel.None;
                break;
            case "VeryLow":
                m_MaxThreatLevel = ThreatLevel.VeryLow;
                break;
            case "Low":
                m_MaxThreatLevel = ThreatLevel.Low;
                break;
            case "Moderate":
                m_MaxThreatLevel = ThreatLevel.Moderate;
                break;
            case "High":
                m_MaxThreatLevel = ThreatLevel.High;
                break;
            case "VeryHigh":
                m_MaxThreatLevel = ThreatLevel.VeryHigh;
                break;
            case "Severe":
                m_MaxThreatLevel = ThreatLevel.Severe;
                break;
            default:
                break;
            }
         }
Exemple #4
0
        protected int EMAIL_PAUSE_TIME = 20;  // documented delay value for smtp.

        public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
        {
            m_ScriptEngine = ScriptEngine;
            m_host = host;
            m_item = item;

            LoadLimits();  // read script limits from config.

            m_TransferModule =
                    m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
            m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();

            AsyncCommands = new AsyncCommandManager(ScriptEngine);
        }
Exemple #5
0
        public void Initialize(IScriptModulePlugin ScriptEngine, SceneObjectPart host, uint localID, UUID itemID, ScriptProtectionModule module)
        {
            m_ScriptEngine = ScriptEngine;
            m_host = host;
            m_localID = localID;
            m_itemID = itemID;
            ScriptProtection = module;

            m_ScriptDelayFactor =
                m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
            m_ScriptDistanceFactor =
                m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);
            m_MinTimerInterval =
                m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f);
            m_automaticLinkPermission =
                m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
            m_notecardLineReadCharsMax =
                m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
            if (m_notecardLineReadCharsMax > 65535)
                m_notecardLineReadCharsMax = 65535;

            m_TransferModule =
                    World.RequestModuleInterface<IMessageTransferModule>();
            m_UrlModule = World.RequestModuleInterface<IUrlModule>();
            m_comms = World.RequestModuleInterface<IWorldComm>();
        }
Exemple #6
0
        public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
        {
            m_ScriptEngine = ScriptEngine;
            m_host = host;
            m_localID = localID;
            m_itemID = itemID;

            m_ScriptDelayFactor =
                m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
            m_ScriptDistanceFactor =
                m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);
            m_MinTimerInterval =
                m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f);
            m_automaticLinkPermission =
                m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
            m_notecardLineReadCharsMax =
                m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
            if (m_notecardLineReadCharsMax > 65535)
                m_notecardLineReadCharsMax = 65535;

            m_TransferModule =
                    m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
            m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
            if (m_UrlModule != null)
            {
                m_ScriptEngine.OnScriptRemoved += m_UrlModule.ScriptRemoved;
                m_ScriptEngine.OnObjectRemoved += m_UrlModule.ObjectRemoved;
            }

            AsyncCommands = new AsyncCommandManager(ScriptEngine);
        }
Exemple #7
0
        public void Initialize(
            IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
        {
            m_ScriptEngine = scriptEngine;
            m_host = host;
            m_item = item;
            m_coopSleepHandle = coopSleepHandle;

            LoadConfig();

            m_TransferModule =
                    m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
            m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
            m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();

            AsyncCommands = new AsyncCommandManager(m_ScriptEngine);
        }
Exemple #8
0
        public void Initialize(IScriptModulePlugin ScriptEngine, ISceneChildEntity host, uint localID, UUID itemID,
                               ScriptProtectionModule module)
        {
            m_ScriptEngine = ScriptEngine;
            m_host = host;
            m_localID = localID;
            m_itemID = itemID;
            ScriptProtection = module;

            m_ScriptDelayFactor =
                m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
            m_ScriptDistanceFactor =
                m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);
            m_MinTimerInterval =
                m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f);
            m_automaticLinkPermission =
                m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
            m_allowOpenSimParams =
                m_ScriptEngine.Config.GetBoolean("AllowOpenSimParamsInLLFunctions", false);
            m_notecardLineReadCharsMax =
                m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
            if (m_notecardLineReadCharsMax > 65535)
                m_notecardLineReadCharsMax = 65535;

            m_TransferModule =
                World.RequestModuleInterface<IMessageTransferModule>();
            m_UrlModule = World.RequestModuleInterface<IUrlModule>();
            m_comms = World.RequestModuleInterface<IWorldComm>();

            m_sleepMsOnEmail = EMAIL_PAUSE_TIME * 1000;
        }
Exemple #9
0
        public void Initialize(
            IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
        {
            m_lastSayShoutCheck = DateTime.UtcNow;

            m_ScriptEngine = scriptEngine;
            m_host = host;
            m_item = item;
            m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
 
            LoadConfig();

            m_TransferModule =
                    m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
            m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
            m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();

            AsyncCommands = new AsyncCommandManager(m_ScriptEngine);
        }
Exemple #10
0
        public void Initialize(
            IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
        {
            m_ScriptEngine = scriptEngine;
            m_host = host;
            m_item = item;

            m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();

            m_ScriptDelayFactor =
                    m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
            m_ScriptDistanceFactor =
                    m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);

            string risk = m_ScriptEngine.Config.GetString("OSFunctionThreatLevel", "VeryLow");
            switch (risk)
            {
            case "NoAccess":
                m_MaxThreatLevel = ThreatLevel.NoAccess;
                break;
            case "None":
                m_MaxThreatLevel = ThreatLevel.None;
                break;
            case "VeryLow":
                m_MaxThreatLevel = ThreatLevel.VeryLow;
                break;
            case "Low":
                m_MaxThreatLevel = ThreatLevel.Low;
                break;
            case "Moderate":
                m_MaxThreatLevel = ThreatLevel.Moderate;
                break;
            case "High":
                m_MaxThreatLevel = ThreatLevel.High;
                break;
            case "VeryHigh":
                m_MaxThreatLevel = ThreatLevel.VeryHigh;
                break;
            case "Severe":
                m_MaxThreatLevel = ThreatLevel.Severe;
                break;
            default:
                break;
            }
        }