aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2011-04-29 17:09:48 -0700
committerDiva Canto2011-04-29 17:09:48 -0700
commit4d5d6222f7edd7cd9c659571f280076c863a0fb1 (patch)
tree55f3e47e03dabec9dcd067b1e55a054319aad127
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-4d5d6222f7edd7cd9c659571f280076c863a0fb1.zip
opensim-SC_OLD-4d5d6222f7edd7cd9c659571f280076c863a0fb1.tar.gz
opensim-SC_OLD-4d5d6222f7edd7cd9c659571f280076c863a0fb1.tar.bz2
opensim-SC_OLD-4d5d6222f7edd7cd9c659571f280076c863a0fb1.tar.xz
Delaying starting the scripts on TPs and crossings until the agent is root.
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs41
2 files changed, 40 insertions, 23 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 696c6ee..2cbe4dc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1229,7 +1229,6 @@ namespace OpenSim.Region.Framework.Scenes
1229 1229
1230 // Increment the frame counter 1230 // Increment the frame counter
1231 ++Frame; 1231 ++Frame;
1232
1233 try 1232 try
1234 { 1233 {
1235 // Check if any objects have reached their targets 1234 // Check if any objects have reached their targets
@@ -2336,9 +2335,13 @@ namespace OpenSim.Region.Framework.Scenes
2336 return false; 2335 return false;
2337 } 2336 }
2338 2337
2339 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); 2338 // For attachments, we need to wait until the agent is root
2340 2339 // before we restart the scripts, or else some functions won't work.
2341 newObject.ResumeScripts(); 2340 if (!newObject.IsAttachment)
2341 {
2342 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
2343 newObject.ResumeScripts();
2344 }
2342 2345
2343 // Do this as late as possible so that listeners have full access to the incoming object 2346 // Do this as late as possible so that listeners have full access to the incoming object
2344 EventManager.TriggerOnIncomingSceneObject(newObject); 2347 EventManager.TriggerOnIncomingSceneObject(newObject);
@@ -2455,17 +2458,8 @@ namespace OpenSim.Region.Framework.Scenes
2455 ScenePresence sp = GetScenePresence(sog.OwnerID); 2458 ScenePresence sp = GetScenePresence(sog.OwnerID);
2456 2459
2457 if (sp != null) 2460 if (sp != null)
2458 { 2461 return sp.GetStateSource();
2459 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(sp.UUID);
2460 2462
2461 if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
2462 {
2463 // This will get your attention
2464 //m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
2465
2466 return 5; // StateSource.Teleporting
2467 }
2468 }
2469 return 2; // StateSource.PrimCrossing 2463 return 2; // StateSource.PrimCrossing
2470 } 2464 }
2471 2465
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9b9d9da..1aac09d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -840,6 +840,9 @@ namespace OpenSim.Region.Framework.Scenes
840 840
841 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); 841 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
842 842
843 bool wasChild = m_isChildAgent;
844 m_isChildAgent = false;
845
843 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 846 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
844 if (gm != null) 847 if (gm != null)
845 m_grouptitle = gm.GetGroupTitle(m_uuid); 848 m_grouptitle = gm.GetGroupTitle(m_uuid);
@@ -929,14 +932,21 @@ namespace OpenSim.Region.Framework.Scenes
929 // Animator.SendAnimPack(); 932 // Animator.SendAnimPack();
930 933
931 m_scene.SwapRootAgentCount(false); 934 m_scene.SwapRootAgentCount(false);
932 935
933 //CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); 936 // The initial login scene presence is already root when it gets here
934 //if (userInfo != null) 937 // and it has already rezzed the attachments and started their scripts.
935 // userInfo.FetchInventory(); 938 // We do the following only for non-login agents, because their scripts
936 //else 939 // haven't started yet.
937 // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); 940 if (wasChild)
938 941 {
939 m_isChildAgent = false; 942 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
943 // Resume scripts
944 Attachments.ForEach(delegate(SceneObjectGroup sog)
945 {
946 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
947 sog.ResumeScripts();
948 });
949 }
940 950
941 // send the animations of the other presences to me 951 // send the animations of the other presences to me
942 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 952 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
@@ -948,6 +958,20 @@ namespace OpenSim.Region.Framework.Scenes
948 m_scene.EventManager.TriggerOnMakeRootAgent(this); 958 m_scene.EventManager.TriggerOnMakeRootAgent(this);
949 } 959 }
950 960
961 public int GetStateSource()
962 {
963 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID);
964
965 if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
966 {
967 // This will get your attention
968 //m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
969
970 return 5; // StateSource.Teleporting
971 }
972 return 2; // StateSource.PrimCrossing
973 }
974
951 /// <summary> 975 /// <summary>
952 /// This turns a root agent into a child agent 976 /// This turns a root agent into a child agent
953 /// when an agent departs this region for a neighbor, this gets called. 977 /// when an agent departs this region for a neighbor, this gets called.
@@ -1139,7 +1163,6 @@ namespace OpenSim.Region.Framework.Scenes
1139 AbsolutePosition = pos; 1163 AbsolutePosition = pos;
1140 } 1164 }
1141 1165
1142 m_isChildAgent = false;
1143 bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1166 bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1144 MakeRootAgent(AbsolutePosition, m_flying); 1167 MakeRootAgent(AbsolutePosition, m_flying);
1145 1168