From 2827deffe822378b6cb35dac6c90a21c3fbc0de7 Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 26 Nov 2010 22:46:48 +0100 Subject: Trigger changed event with CHANGED_TELEPORT when teleporting to another region. --- OpenSim/Region/Framework/Scenes/Scene.cs | 15 ++++++--------- .../Region/ScriptEngine/Interfaces/IScriptInstance.cs | 3 ++- .../ScriptEngine/Shared/Instance/ScriptInstance.cs | 17 ++++++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 129b52d..b1216c5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2324,16 +2324,14 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); return false; } - - newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2); + + newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); newObject.ResumeScripts(); // Do this as late as possible so that listeners have full access to the incoming object EventManager.TriggerOnIncomingSceneObject(newObject); - TriggerChangedTeleport(newObject); - return true; } @@ -2441,7 +2439,7 @@ namespace OpenSim.Region.Framework.Scenes return true; } - private void TriggerChangedTeleport(SceneObjectGroup sog) + private int GetStateSource(SceneObjectGroup sog) { ScenePresence sp = GetScenePresence(sog.OwnerID); @@ -2452,13 +2450,12 @@ namespace OpenSim.Region.Framework.Scenes if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) { // This will get your attention - //m_log.Error("[XXX] Triggering "); + //m_log.Error("[XXX] Triggering CHANGED_TELEPORT"); - // Trigger CHANGED_TELEPORT - sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT); + return 5; // StateSource.Teleporting } - } + return 2; // StateSource.PrimCrossing } #endregion diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 0c99d8c..8b7871b 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs @@ -42,7 +42,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces NewRez = 1, PrimCrossing = 2, ScriptedRez = 3, - AttachedRez = 4 + AttachedRez = 4, + Teleporting = 5 } public interface IScriptWorkItem diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 660e9a3..8e712b6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -390,19 +390,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance } else if (m_stateSource == StateSource.RegionStart) { -// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); + //m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); PostEvent(new EventParams("changed", - new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, - new DetectParams[0])); + new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new DetectParams[0])); } - else if (m_stateSource == StateSource.PrimCrossing) + else if (m_stateSource == StateSource.PrimCrossing || m_stateSource == StateSource.Teleporting) { // CHANGED_REGION PostEvent(new EventParams("changed", - new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, - new DetectParams[0])); + new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, new DetectParams[0])); + + // CHANGED_TELEPORT + if (m_stateSource == StateSource.Teleporting) + PostEvent(new EventParams("changed", + new Object[] { new LSL_Types.LSLInteger((int)Changed.TELEPORT) }, new DetectParams[0])); } - } + } else { Start(); -- cgit v1.1