aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs37
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs2
4 files changed, 61 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 8262478..d436bb3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -816,6 +816,7 @@ namespace OpenSim.Region.Environment.Scenes
816 m_sceneGridService.RegisterRegion(m_regInfo); 816 m_sceneGridService.RegisterRegion(m_regInfo);
817 m_sceneGridService.OnExpectUser += NewUserConnection; 817 m_sceneGridService.OnExpectUser += NewUserConnection;
818 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; 818 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
819 m_sceneGridService.OnCloseAgentConnection += CloseConnection;
819 } 820 }
820 821
821 /// <summary> 822 /// <summary>
@@ -864,13 +865,26 @@ namespace OpenSim.Region.Environment.Scenes
864 } 865 }
865 } 866 }
866 867
868 public void CloseConnection(ulong regionHandle, LLUUID agentID)
869 {
870 if (regionHandle == m_regionHandle)
871 {
872 ScenePresence presence = m_innerScene.GetScenePresence(agentID);
873 if(presence != null)
874 {
875 libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket();
876 presence.ControllingClient.OutPacket(disable);
877 }
878 }
879 }
880
867 881
868 /// <summary> 882 /// <summary>
869 /// 883 ///
870 /// </summary> 884 /// </summary>
871 public void InformClientOfNeighbours(ScenePresence presence) 885 public void InformClientOfNeighbours(ScenePresence presence)
872 { 886 {
873 m_sceneGridService.InformClientOfNeighbours(presence); 887 m_sceneGridService.EnableNeighbourChildAgents(presence);
874 } 888 }
875 889
876 /// <summary> 890 /// <summary>
@@ -908,7 +922,7 @@ namespace OpenSim.Region.Environment.Scenes
908 { 922 {
909 if (m_scenePresences.ContainsKey(remoteClient.AgentId)) 923 if (m_scenePresences.ContainsKey(remoteClient.AgentId))
910 { 924 {
911 m_sceneGridService.RequestTeleportLocation(m_scenePresences[remoteClient.AgentId], regionHandle, position, lookAt, flags); 925 m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle, position, lookAt, flags);
912 } 926 }
913 } 927 }
914 928
@@ -920,7 +934,7 @@ namespace OpenSim.Region.Environment.Scenes
920 /// <param name="position"></param> 934 /// <param name="position"></param>
921 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying) 935 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying)
922 { 936 {
923 return m_sceneGridService.InformNeighbourOfCrossing(regionhandle, agentID, position, isFlying); 937 return m_sceneGridService.CrossToNeighbouringRegion(regionhandle, agentID, position, isFlying);
924 } 938 }
925 939
926 #endregion 940 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 27b0cba..9bd55e1 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -19,7 +19,7 @@ namespace OpenSim.Region.Environment.Scenes
19 19
20 public event AgentCrossing OnAvatarCrossingIntoRegion; 20 public event AgentCrossing OnAvatarCrossingIntoRegion;
21 public event ExpectUserDelegate OnExpectUser; 21 public event ExpectUserDelegate OnExpectUser;
22 22 public event CloseAgentConnection OnCloseAgentConnection;
23 23
24 public SceneCommunicationService(CommunicationsManager commsMan) 24 public SceneCommunicationService(CommunicationsManager commsMan)
25 { 25 {
@@ -34,6 +34,7 @@ namespace OpenSim.Region.Environment.Scenes
34 { 34 {
35 regionCommsHost.OnExpectUser += NewUserConnection; 35 regionCommsHost.OnExpectUser += NewUserConnection;
36 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; 36 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
37 regionCommsHost.OnCloseAgentConnection += CloseConnection;
37 } 38 }
38 } 39 }
39 40
@@ -41,6 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
41 { 42 {
42 regionCommsHost.OnExpectUser -= NewUserConnection; 43 regionCommsHost.OnExpectUser -= NewUserConnection;
43 regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; 44 regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
45 regionCommsHost.OnCloseAgentConnection -= CloseConnection;
44 //regionCommsHost.RemoveRegion(m_regionInfo); //TODO add to method to commsManager 46 //regionCommsHost.RemoveRegion(m_regionInfo); //TODO add to method to commsManager
45 regionCommsHost = null; 47 regionCommsHost = null;
46 } 48 }
@@ -51,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
51 /// </summary> 53 /// </summary>
52 /// <param name="regionHandle"></param> 54 /// <param name="regionHandle"></param>
53 /// <param name="agent"></param> 55 /// <param name="agent"></param>
54 public void NewUserConnection(ulong regionHandle, AgentCircuitData agent) 56 protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
55 { 57 {
56 if (OnExpectUser != null) 58 if (OnExpectUser != null)
57 { 59 {
@@ -59,13 +61,21 @@ namespace OpenSim.Region.Environment.Scenes
59 } 61 }
60 } 62 }
61 63
62 public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 64 protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
63 { 65 {
64 if (OnAvatarCrossingIntoRegion != null) 66 if (OnAvatarCrossingIntoRegion != null)
65 { 67 {
66 OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); 68 OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying);
67 } 69 }
68 } 70 }
71
72 protected void CloseConnection(ulong regionHandle, LLUUID agentID)
73 {
74 if (OnCloseAgentConnection != null)
75 {
76 OnCloseAgentConnection(regionHandle, agentID);
77 }
78 }
69 #endregion 79 #endregion
70 80
71 #region Inform Client of Neighbours 81 #region Inform Client of Neighbours
@@ -105,7 +115,7 @@ namespace OpenSim.Region.Environment.Scenes
105 /// <summary> 115 /// <summary>
106 /// 116 ///
107 /// </summary> 117 /// </summary>
108 public void InformClientOfNeighbours(ScenePresence avatar) 118 public void EnableNeighbourChildAgents(ScenePresence avatar)
109 { 119 {
110 List<SimpleRegionInfo> neighbours = 120 List<SimpleRegionInfo> neighbours =
111 m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 121 m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
@@ -160,7 +170,7 @@ namespace OpenSim.Region.Environment.Scenes
160 /// <param name="position"></param> 170 /// <param name="position"></param>
161 /// <param name="lookAt"></param> 171 /// <param name="lookAt"></param>
162 /// <param name="flags"></param> 172 /// <param name="flags"></param>
163 public virtual void RequestTeleportLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position, 173 public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position,
164 LLVector3 lookAt, uint flags) 174 LLVector3 lookAt, uint flags)
165 { 175 {
166 if (regionHandle == m_regionInfo.RegionHandle) 176 if (regionHandle == m_regionInfo.RegionHandle)
@@ -189,6 +199,14 @@ namespace OpenSim.Region.Environment.Scenes
189 string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId); 199 string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId);
190 avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath); 200 avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath);
191 avatar.MakeChildAgent(); 201 avatar.MakeChildAgent();
202 uint newRegionX = (uint)(regionHandle >> 40);
203 uint newRegionY = (((uint)(regionHandle)) >> 8);
204 uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
205 uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
206 if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3)
207 {
208 CloseChildAgentConnections(avatar);
209 }
192 } 210 }
193 } 211 }
194 } 212 }
@@ -199,14 +217,19 @@ namespace OpenSim.Region.Environment.Scenes
199 /// <param name="regionhandle"></param> 217 /// <param name="regionhandle"></param>
200 /// <param name="agentID"></param> 218 /// <param name="agentID"></param>
201 /// <param name="position"></param> 219 /// <param name="position"></param>
202 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying) 220 public bool CrossToNeighbouringRegion(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying)
203 { 221 {
204 return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying); 222 return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
205 } 223 }
206 224
207 public void CloseChildAgentConnections(ScenePresence presence) 225 public void CloseChildAgentConnections(ScenePresence presence)
208 { 226 {
209 227 foreach (ulong regionHandle in presence.KnownChildRegions)
228 {
229
230 m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId);
231 presence.RemoveNeighbourRegion(regionHandle);
232 }
210 } 233 }
211 } 234 }
212} 235}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 628921c..49e3c39 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -232,6 +232,10 @@ namespace OpenSim.Region.Environment.Scenes
232 set { m_parentID = value; } 232 set { m_parentID = value; }
233 } 233 }
234 234
235 public List<ulong> KnownChildRegions
236 {
237 get { return m_KnownChildRegions; }
238 }
235 #endregion 239 #endregion
236 240
237 #region Constructor(s) 241 #region Constructor(s)
@@ -411,6 +415,13 @@ namespace OpenSim.Region.Environment.Scenes
411 } 415 }
412 } 416 }
413 417
418 public void RemoveNeighbourRegion(ulong regionHandle)
419 {
420 if (!m_KnownChildRegions.Contains(regionHandle))
421 {
422 m_KnownChildRegions.Remove(regionHandle);
423 }
424 }
414 #endregion 425 #endregion
415 426
416 #region Event Handlers 427 #region Event Handlers
@@ -1090,9 +1101,8 @@ namespace OpenSim.Region.Environment.Scenes
1090 public void SetWearable(int wearableId, AvatarWearable wearable) 1101 public void SetWearable(int wearableId, AvatarWearable wearable)
1091 { 1102 {
1092 m_wearables[wearableId] = wearable; 1103 m_wearables[wearableId] = wearable;
1093 m_controllingClient.SendWearables(m_wearables, m_wearablesSerial++); 1104 m_controllingClient.SendWearables(m_wearables, ++m_wearablesSerial);
1094 SendOurAppearance( m_controllingClient ); 1105 //m_controllingClient.SendWearables(m_wearables, m_wearablesSerial++);
1095
1096 } 1106 }
1097 } 1107 }
1098} \ No newline at end of file 1108} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
index 1176e13..e0ddec5 100644
--- a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
@@ -10,7 +10,7 @@ using OpenSim.Region.Physics.Manager;
10 10
11namespace OpenSim.Region.Environment.Scenes 11namespace OpenSim.Region.Environment.Scenes
12{ 12{
13 public class SceneXmlLoader //Most likely can move to a module 13 public class SceneXmlLoader // can move to a module?
14 { 14 {
15 protected InnerScene m_innerScene; 15 protected InnerScene m_innerScene;
16 protected RegionInfo m_regInfo; 16 protected RegionInfo m_regInfo;