aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authordiva2008-12-31 00:18:24 +0000
committerdiva2008-12-31 00:18:24 +0000
commit5de40aaf46bc956fb6c25b36fb01b5a1cde2d30d (patch)
treebe412389f4a2ce944dfaabdabf4b79ba47b61c2d /OpenSim/Region/Environment/Scenes
parentRemoving unnecessary null checks on structs in AgentsData pack/unpack. (diff)
downloadopensim-SC_OLD-5de40aaf46bc956fb6c25b36fb01b5a1cde2d30d.zip
opensim-SC_OLD-5de40aaf46bc956fb6c25b36fb01b5a1cde2d30d.tar.gz
opensim-SC_OLD-5de40aaf46bc956fb6c25b36fb01b5a1cde2d30d.tar.bz2
opensim-SC_OLD-5de40aaf46bc956fb6c25b36fb01b5a1cde2d30d.tar.xz
Added a SendChildAgentDataUpdate call on Teleports, so that the agent at the destination will have all the necessary information.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs53
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs40
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs59
3 files changed, 110 insertions, 42 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
index 363a93f..bcd378f 100644
--- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -180,40 +180,40 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
180 // once we reach here... 180 // once we reach here...
181 //avatar.Scene.RemoveCapsHandler(avatar.UUID); 181 //avatar.Scene.RemoveCapsHandler(avatar.UUID);
182 182
183 // Let's close some agents
184 if (isHyperLink) // close them all except this one
185 {
186 List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles);
187 regions.Remove(avatar.Scene.RegionInfo.RegionHandle);
188 SendCloseChildAgentConnections(avatar.UUID, regions);
189 }
190 else // close just a few
191 avatar.CloseChildAgents(newRegionX, newRegionY);
192
193 string capsPath = String.Empty; 183 string capsPath = String.Empty;
194 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); 184 AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo();
195 agent.BaseFolder = UUID.Zero; 185 agentCircuit.BaseFolder = UUID.Zero;
196 agent.InventoryFolder = UUID.Zero; 186 agentCircuit.InventoryFolder = UUID.Zero;
197 agent.startpos = position; 187 agentCircuit.startpos = position;
198 agent.child = true; 188 agentCircuit.child = true;
199 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) 189 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
200 { 190 {
201 // brand new agent, let's create a new caps seed 191 // brand new agent, let's create a new caps seed
202 agent.CapsPath = Util.GetRandomCapsPath(); 192 agentCircuit.CapsPath = Util.GetRandomCapsPath();
203 } 193 }
204 194
205 if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent)) 195 if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
206 { 196 {
207 avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); 197 avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
208 return; 198 return;
209 } 199 }
210 200
201 // Let's close some agents
202 if (isHyperLink) // close them all except this one
203 {
204 List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles);
205 regions.Remove(avatar.Scene.RegionInfo.RegionHandle);
206 SendCloseChildAgentConnections(avatar.UUID, regions);
207 }
208 else // close just a few
209 avatar.CloseChildAgents(newRegionX, newRegionY);
210
211 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) 211 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink)
212 { 212 {
213 // TODO Should construct this behind a method 213 // TODO Should construct this behind a method
214 capsPath = 214 capsPath =
215 "http://" + reg.ExternalHostName + ":" + reg.HttpPort 215 "http://" + reg.ExternalHostName + ":" + reg.HttpPort
216 + "/CAPS/" + agent.CapsPath + "0000/"; 216 + "/CAPS/" + agentCircuit.CapsPath + "0000/";
217 217
218 if (eq != null) 218 if (eq != null)
219 { 219 {
@@ -237,9 +237,9 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
237 else 237 else
238 { 238 {
239 // child agent already there 239 // child agent already there
240 agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); 240 agentCircuit.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle);
241 capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort 241 capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
242 + "/CAPS/" + agent.CapsPath + "0000/"; 242 + "/CAPS/" + agentCircuit.CapsPath + "0000/";
243 } 243 }
244 244
245 //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, 245 //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
@@ -256,10 +256,17 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
256 // return; 256 // return;
257 //} 257 //}
258 258
259 // Let's send a full update of the agent. This is a synchronous call.
260 AgentData agent = new AgentData();
261 avatar.CopyTo(agent);
262 agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
263
264 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent);
265
259 avatar.MakeChildAgent(); 266 avatar.MakeChildAgent();
260 267
261 m_log.DebugFormat( 268 m_log.DebugFormat(
262 "[CAPS]: Sending new CAPS seed url {0} to client {1}", agent.CapsPath, avatar.UUID); 269 "[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID);
263 270
264 271
265 /// 272 ///
@@ -291,7 +298,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
291 // we send the attachments and close things here. 298 // we send the attachments and close things here.
292 // It would be nice if the client would tell us when that whole thing is done, so we wouldn't have 299 // It would be nice if the client would tell us when that whole thing is done, so we wouldn't have
293 // to use this Thread.Sleep voodoo 300 // to use this Thread.Sleep voodoo
294 Thread.Sleep(3000); 301 Thread.Sleep(4000);
295 302
296 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 303 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
297 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); 304 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
@@ -303,7 +310,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
303 /// 310 ///
304 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) 311 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink)
305 { 312 {
306 Thread.Sleep(5000); 313 Thread.Sleep(8000);
307 avatar.Close(); 314 avatar.Close();
308 CloseConnection(avatar.UUID); 315 CloseConnection(avatar.UUID);
309 } 316 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 7385725..2bf81d8 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -791,33 +791,34 @@ namespace OpenSim.Region.Environment.Scenes
791 //avatar.Scene.RemoveCapsHandler(avatar.UUID); 791 //avatar.Scene.RemoveCapsHandler(avatar.UUID);
792 792
793 793
794 // Let's close some agents
795 avatar.CloseChildAgents(newRegionX, newRegionY);
796
797 string capsPath = String.Empty; 794 string capsPath = String.Empty;
798 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); 795 AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo();
799 agent.BaseFolder = UUID.Zero; 796 agentCircuit.BaseFolder = UUID.Zero;
800 agent.InventoryFolder = UUID.Zero; 797 agentCircuit.InventoryFolder = UUID.Zero;
801 agent.startpos = position; 798 agentCircuit.startpos = position;
802 agent.child = true; 799 agentCircuit.child = true;
803 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) 800 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
804 { 801 {
805 // brand new agent, let's create a new caps seed 802 // brand new agent, let's create a new caps seed
806 agent.CapsPath = Util.GetRandomCapsPath(); 803 agentCircuit.CapsPath = Util.GetRandomCapsPath();
807 } 804 }
808 805
809 if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent)) 806 // Let's create an agent there if one doesn't exist yet.
807 if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
810 { 808 {
811 avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); 809 avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
812 return; 810 return;
813 } 811 }
814 812
813 // OK, it got this agent. Let's close some child agents
814 avatar.CloseChildAgents(newRegionX, newRegionY);
815
815 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) 816 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
816 { 817 {
817 // TODO Should construct this behind a method 818 // TODO Should construct this behind a method
818 capsPath = 819 capsPath =
819 "http://" + reg.ExternalHostName + ":" + reg.HttpPort 820 "http://" + reg.ExternalHostName + ":" + reg.HttpPort
820 + "/CAPS/" + agent.CapsPath + "0000/"; 821 + "/CAPS/" + agentCircuit.CapsPath + "0000/";
821 822
822 if (eq != null) 823 if (eq != null)
823 { 824 {
@@ -839,9 +840,9 @@ namespace OpenSim.Region.Environment.Scenes
839 } 840 }
840 else 841 else
841 { 842 {
842 agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); 843 agentCircuit.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle);
843 capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort 844 capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
844 + "/CAPS/" + agent.CapsPath + "0000/"; 845 + "/CAPS/" + agentCircuit.CapsPath + "0000/";
845 } 846 }
846 847
847 // Expect avatar crossing is a heavy-duty function at the destination. 848 // Expect avatar crossing is a heavy-duty function at the destination.
@@ -859,6 +860,13 @@ namespace OpenSim.Region.Environment.Scenes
859 // return; 860 // return;
860 //} 861 //}
861 862
863 // Let's send a full update of the agent. This is a synchronous call.
864 AgentData agent = new AgentData();
865 avatar.CopyTo(agent);
866 agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
867
868 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent);
869
862 avatar.MakeChildAgent(); 870 avatar.MakeChildAgent();
863 871
864 m_log.DebugFormat( 872 m_log.DebugFormat(
@@ -885,7 +893,9 @@ namespace OpenSim.Region.Environment.Scenes
885 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which 893 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
886 // trigers a whole shebang of things there, including MakeRoot. So let's wait plenty before 894 // trigers a whole shebang of things there, including MakeRoot. So let's wait plenty before
887 // we send the attachments and close things here. 895 // we send the attachments and close things here.
888 Thread.Sleep(3000); 896 // We need to change this part of the protocol. The receiving region should tell this region
897 // when it's ok to continue.
898 Thread.Sleep(4000);
889 899
890 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 900 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
891 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); 901 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
@@ -894,7 +904,7 @@ namespace OpenSim.Region.Environment.Scenes
894 904
895 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) 905 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
896 { 906 {
897 Thread.Sleep(5000); 907 Thread.Sleep(8000);
898 avatar.Close(); 908 avatar.Close();
899 CloseConnection(avatar.UUID); 909 CloseConnection(avatar.UUID);
900 } 910 }
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 41971fc..23dc9be 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -2571,6 +2571,7 @@ namespace OpenSim.Region.Environment.Scenes
2571 ControllingClient.SendAdminResponse(token, (uint)m_godlevel); 2571 ControllingClient.SendAdminResponse(token, (uint)m_godlevel);
2572 } 2572 }
2573 2573
2574 #region Child Agent Updates
2574 /// <summary> 2575 /// <summary>
2575 /// This updates important decision making data about a child agent 2576 /// This updates important decision making data about a child agent
2576 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region 2577 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
@@ -2581,22 +2582,34 @@ namespace OpenSim.Region.Environment.Scenes
2581 if (!IsChildAgent) 2582 if (!IsChildAgent)
2582 return; 2583 return;
2583 2584
2585 //Console.WriteLine(" >>> ChildAgentDataUpdate <<<");
2584 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; 2586 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
2585 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; 2587 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
2586 2588
2587 m_DrawDistance = cAgentData.Far; 2589 m_DrawDistance = cAgentData.Far;
2588 m_pos = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z); 2590 if (cAgentData.Position != new Vector3(-1, -1, -1)) // UGH!!
2591 m_pos = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z);
2589 2592
2590 // It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region 2593 // It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region
2591 m_CameraCenter = cAgentData.Center; 2594 if (cAgentData.Center!= new Vector3(-1, -1, -1)) // UGH!
2595 m_CameraCenter = cAgentData.Center;
2592 // new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); 2596 // new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
2593 2597
2594 2598
2595 m_godlevel = cAgentData.GodLevel; 2599 m_godlevel = cAgentData.GodLevel;
2596 m_avHeight = cAgentData.Size.Z; 2600 if (cAgentData.Center != new Vector3(-1, -1, -1))
2601 m_avHeight = cAgentData.Size.Z;
2597 //SetHeight(cAgentData.AVHeight); 2602 //SetHeight(cAgentData.AVHeight);
2598 2603
2599 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 2604 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
2605 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
2606
2607 // ugh!!!
2608 m_AgentControlFlags = cAgentData.ControlFlags;
2609 if (m_physicsActor != null)
2610 {
2611 m_physicsActor.Flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
2612 }
2600 2613
2601 // Sends out the objects in the user's draw distance if m_sendTasksToChild is true. 2614 // Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
2602 if (m_scene.m_seeIntoRegionFromNeighbor) 2615 if (m_scene.m_seeIntoRegionFromNeighbor)
@@ -2607,6 +2620,44 @@ namespace OpenSim.Region.Environment.Scenes
2607 //m_velocity = cAgentData.Velocity; 2620 //m_velocity = cAgentData.Velocity;
2608 } 2621 }
2609 2622
2623 public void CopyTo(AgentData cAgent)
2624 {
2625 cAgent.AgentID = UUID;
2626 cAgent.RegionHandle = m_scene.RegionInfo.RegionHandle;
2627 cAgent.AlwaysRun = m_setAlwaysRun;
2628 cAgent.Size = new Vector3(0, 0, m_avHeight);
2629 cAgent.Center = m_CameraCenter;
2630 cAgent.Far = m_DrawDistance;
2631 cAgent.GodLevel = (byte)m_godlevel;
2632 cAgent.Position = AbsolutePosition;
2633 cAgent.Velocity = Velocity;
2634 // Throttles
2635 float multiplier = 1;
2636 int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
2637 if (innacurateNeighbors != 0)
2638 {
2639 multiplier = 1f / (float)innacurateNeighbors;
2640 }
2641 if (multiplier <= 0f)
2642 {
2643 multiplier = 0.25f;
2644 }
2645 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
2646 cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
2647
2648 if ((m_physicsActor != null) && (m_physicsActor.Flying))
2649 {
2650 m_AgentControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
2651 }
2652 cAgent.ControlFlags = m_AgentControlFlags;
2653
2654 // Groups???
2655 // Visual Params???
2656 // Animations???
2657 }
2658
2659 #endregion Child Agent Updates
2660
2610 /// <summary> 2661 /// <summary>
2611 /// Handles part of the PID controller function for moving an avatar. 2662 /// Handles part of the PID controller function for moving an avatar.
2612 /// </summary> 2663 /// </summary>