Revert "Revert "Trigger changed event with CHANGED_TELEPORT when teleporting to another region.""

This reverts commit 6c01ebb875.
avinationmerge
Melanie 2010-12-03 18:32:03 +01:00
parent b940925173
commit 8741676bc3
3 changed files with 18 additions and 17 deletions

View File

@ -2392,15 +2392,13 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2); newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
newObject.ResumeScripts(); newObject.ResumeScripts();
// Do this as late as possible so that listeners have full access to the incoming object // Do this as late as possible so that listeners have full access to the incoming object
EventManager.TriggerOnIncomingSceneObject(newObject); EventManager.TriggerOnIncomingSceneObject(newObject);
TriggerChangedTeleport(newObject);
return true; return true;
} }
@ -2527,7 +2525,7 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
private void TriggerChangedTeleport(SceneObjectGroup sog) private int GetStateSource(SceneObjectGroup sog)
{ {
ScenePresence sp = GetScenePresence(sog.OwnerID); ScenePresence sp = GetScenePresence(sog.OwnerID);
@ -2538,13 +2536,12 @@ namespace OpenSim.Region.Framework.Scenes
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
{ {
// This will get your attention // This will get your attention
//m_log.Error("[XXX] Triggering "); //m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
// Trigger CHANGED_TELEPORT return 5; // StateSource.Teleporting
sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT);
} }
} }
return 2; // StateSource.PrimCrossing
} }
#endregion #endregion

View File

@ -42,7 +42,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
NewRez = 1, NewRez = 1,
PrimCrossing = 2, PrimCrossing = 2,
ScriptedRez = 3, ScriptedRez = 3,
AttachedRez = 4 AttachedRez = 4,
Teleporting = 5
} }
public interface IScriptWorkItem public interface IScriptWorkItem

View File

@ -391,17 +391,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
else if (m_stateSource == StateSource.RegionStart) 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", PostEvent(new EventParams("changed",
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new DetectParams[0]));
new DetectParams[0]));
} }
else if (m_stateSource == StateSource.PrimCrossing) else if (m_stateSource == StateSource.PrimCrossing || m_stateSource == StateSource.Teleporting)
{ {
// CHANGED_REGION // CHANGED_REGION
PostEvent(new EventParams("changed", PostEvent(new EventParams("changed",
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, new DetectParams[0]));
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 else