Delaying starting the scripts on TPs and crossings until the agent is root.
parent
412503b216
commit
4d5d6222f7
|
@ -1229,7 +1229,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// Increment the frame counter
|
||||
++Frame;
|
||||
|
||||
try
|
||||
{
|
||||
// Check if any objects have reached their targets
|
||||
|
@ -2336,9 +2335,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return false;
|
||||
}
|
||||
|
||||
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
|
||||
|
||||
newObject.ResumeScripts();
|
||||
// For attachments, we need to wait until the agent is root
|
||||
// before we restart the scripts, or else some functions won't work.
|
||||
if (!newObject.IsAttachment)
|
||||
{
|
||||
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);
|
||||
|
@ -2455,17 +2458,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
ScenePresence sp = GetScenePresence(sog.OwnerID);
|
||||
|
||||
if (sp != null)
|
||||
{
|
||||
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(sp.UUID);
|
||||
return sp.GetStateSource();
|
||||
|
||||
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
|
||||
{
|
||||
// This will get your attention
|
||||
//m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
|
||||
|
||||
return 5; // StateSource.Teleporting
|
||||
}
|
||||
}
|
||||
return 2; // StateSource.PrimCrossing
|
||||
}
|
||||
|
||||
|
|
|
@ -840,6 +840,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
//m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
|
||||
|
||||
bool wasChild = m_isChildAgent;
|
||||
m_isChildAgent = false;
|
||||
|
||||
IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
|
||||
if (gm != null)
|
||||
m_grouptitle = gm.GetGroupTitle(m_uuid);
|
||||
|
@ -930,13 +933,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_scene.SwapRootAgentCount(false);
|
||||
|
||||
//CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
|
||||
//if (userInfo != null)
|
||||
// userInfo.FetchInventory();
|
||||
//else
|
||||
// m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
|
||||
|
||||
m_isChildAgent = false;
|
||||
// The initial login scene presence is already root when it gets here
|
||||
// and it has already rezzed the attachments and started their scripts.
|
||||
// We do the following only for non-login agents, because their scripts
|
||||
// haven't started yet.
|
||||
if (wasChild)
|
||||
{
|
||||
m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
|
||||
// Resume scripts
|
||||
Attachments.ForEach(delegate(SceneObjectGroup sog)
|
||||
{
|
||||
sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
|
||||
sog.ResumeScripts();
|
||||
});
|
||||
}
|
||||
|
||||
// send the animations of the other presences to me
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
|
@ -948,6 +958,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_scene.EventManager.TriggerOnMakeRootAgent(this);
|
||||
}
|
||||
|
||||
public int GetStateSource()
|
||||
{
|
||||
AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID);
|
||||
|
||||
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
|
||||
{
|
||||
// This will get your attention
|
||||
//m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
|
||||
|
||||
return 5; // StateSource.Teleporting
|
||||
}
|
||||
return 2; // StateSource.PrimCrossing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This turns a root agent into a child agent
|
||||
/// when an agent departs this region for a neighbor, this gets called.
|
||||
|
@ -1139,7 +1163,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
AbsolutePosition = pos;
|
||||
}
|
||||
|
||||
m_isChildAgent = false;
|
||||
bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||
MakeRootAgent(AbsolutePosition, m_flying);
|
||||
|
||||
|
|
Loading…
Reference in New Issue