예제 #1
0
        /// <summary>
        /// This resets the script back to its default state.
        /// </summary>
        internal void Reset()
        {
            if (Script == null)
            {
                return;
            }
            //Release controls over people.
            ReleaseControls();
            //Remove other items from the queue.

//            m_ScriptEngine.MaintenanceThread.RemoveFromEventSchQueue(this);
            m_ScriptEngine.MaintenanceThread.RemoveFromEventSchQueue(this, false); // let current InExec finish or lsl reset fails
//            VersionID++;
            //Reset the state to default
            State = DefaultState;
            //Reset all variables back to their original values.
            Script.ResetVars();
            //Tell the SOP about the change.
            if (!Running) //No events!
            {
                Part.SetScriptEvents(ItemID, 0);
            }
            else
            {
                Part.SetScriptEvents(ItemID, Script.GetStateEventFlags(State));
            }

            //Remove MinEventDelay
            EventDelayTicks = 0;
            //Remove events that may be fired again after the user stops touching the prim, etc
            // These will be removed after the next ***_start event
            ResetEvents();
            RemoveLandCollisionEvents = true;
            RemoveCollisionEvents     = true;
            RemoveTouchEvents         = true;

            //Unset the events that may still be firing after the change.
            m_ScriptEngine.RemoveScript(Part.UUID, ItemID);

            //Fire state_entry
            m_ScriptEngine.MaintenanceThread.SetEventSchSetIgnoreNew(this, false); // accept new events
            m_ScriptEngine.AddToScriptQueue(this, "state_entry", new DetectParams[0], VersionID, EventPriority.FirstStart, new object[] { });

            m_ScriptEngine.StateSave.SaveStateTo(this);
            m_log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Reset Script " + ItemID);
        }
예제 #2
0
        public void changed(ISceneChildEntity part, uint change)
        {
            ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

            if (datas == null || datas.Length == 0)
            {
                datas = ScriptEngine.ScriptProtection.GetScripts(part.ParentEntity.RootChild.UUID);
                if (datas == null || datas.Length == 0)
                {
                    return;
                }
            }
            string functionName = "changed";

            object[] param = new Object[] { new LSL_Types.LSLInteger(change) };

            foreach (ScriptData ID in datas)
            {
                if (CheckIfEventShouldFire(ID, functionName, param))
                {
                    m_scriptEngine.AddToScriptQueue(ID, functionName, new DetectParams[0], ID.VersionID, param);
                }
            }
        }