aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/IRegionCommsListener.cs3
-rw-r--r--OpenSim/Framework/RegionCommsListener.cs9
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs99
-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
8 files changed, 125 insertions, 63 deletions
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs
index 1a24469..24c6499 100644
--- a/OpenSim/Framework/IRegionCommsListener.cs
+++ b/OpenSim/Framework/IRegionCommsListener.cs
@@ -38,6 +38,8 @@ namespace OpenSim.Framework
38 38
39 public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID); 39 public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID);
40 40
41 public delegate void CloseAgentConnection(ulong regionHandle, LLUUID agentID);
42
41 public interface IRegionCommsListener 43 public interface IRegionCommsListener
42 { 44 {
43 event ExpectUserDelegate OnExpectUser; 45 event ExpectUserDelegate OnExpectUser;
@@ -45,5 +47,6 @@ namespace OpenSim.Framework
45 event AgentCrossing OnAvatarCrossingIntoRegion; 47 event AgentCrossing OnAvatarCrossingIntoRegion;
46 event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; 48 event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
47 event UpdateNeighbours OnNeighboursUpdate; 49 event UpdateNeighbours OnNeighboursUpdate;
50 event CloseAgentConnection OnCloseAgentConnection;
48 } 51 }
49} \ No newline at end of file 52} \ No newline at end of file
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index ee0d503..84d1b02 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -38,6 +38,7 @@ namespace OpenSim.Framework
38 public event AgentCrossing OnAvatarCrossingIntoRegion; 38 public event AgentCrossing OnAvatarCrossingIntoRegion;
39 public event UpdateNeighbours OnNeighboursUpdate; 39 public event UpdateNeighbours OnNeighboursUpdate;
40 public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; 40 public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
41 public event CloseAgentConnection OnCloseAgentConnection;
41 42
42 /// <summary> 43 /// <summary>
43 /// 44 ///
@@ -76,6 +77,14 @@ namespace OpenSim.Framework
76 return false; 77 return false;
77 } 78 }
78 79
80 public virtual void TriggerCloseAgentConnection(ulong regionHandle, LLUUID agentID)
81 {
82 if (OnCloseAgentConnection != null)
83 {
84 OnCloseAgentConnection(regionHandle, agentID);
85 }
86 }
87
79 /// <summary> 88 /// <summary>
80 /// 89 ///
81 /// </summary> 90 /// </summary>
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 852dc8e..1e76813 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -182,7 +182,7 @@ namespace OpenSim.Region.Communications.Local
182 { 182 {
183 if (m_regionListeners.ContainsKey(regionHandle)) 183 if (m_regionListeners.ContainsKey(regionHandle))
184 { 184 {
185 // m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); 185 m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID);
186 } 186 }
187 } 187 }
188 188
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index 9d4187a..52491ed 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -181,60 +181,63 @@ namespace OpenSim.Region.Environment.Modules
181 { 181 {
182 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 182 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
183 { 183 {
184 int dis = -100000; 184 if (!presence.IsChildAgent)
185
186 LLVector3 avatarRegionPos = presence.AbsolutePosition +
187 new LLVector3(
188 scene.RegionInfo.RegionLocX*256,
189 scene.RegionInfo.RegionLocY*256,
190 0);
191 dis =
192 Math.Abs((int) avatarRegionPos.GetDistanceTo(fromRegionPos));
193
194 switch (e.Type)
195 { 185 {
196 case ChatTypeEnum.Whisper: 186 int dis = -100000;
197 if (dis < m_whisperdistance) 187
198 { 188 LLVector3 avatarRegionPos = presence.AbsolutePosition +
199 //should change so the message is sent through the avatar rather than direct to the ClientView 189 new LLVector3(
200 presence.ControllingClient.SendChatMessage(message, 190 scene.RegionInfo.RegionLocX * 256,
201 type, 191 scene.RegionInfo.RegionLocY * 256,
202 fromPos, 192 0);
203 fromName, 193 dis =
204 fromAgentID); 194 Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
205 } 195
206 break; 196 switch (e.Type)
207 case ChatTypeEnum.Say: 197 {
208 if (dis < m_saydistance) 198 case ChatTypeEnum.Whisper:
209 { 199 if (dis < m_whisperdistance)
210 //Console.WriteLine("sending chat"); 200 {
211 presence.ControllingClient.SendChatMessage(message, 201 //should change so the message is sent through the avatar rather than direct to the ClientView
212 type, 202 presence.ControllingClient.SendChatMessage(message,
213 fromPos, 203 type,
214 fromName, 204 fromPos,
215 fromAgentID); 205 fromName,
216 } 206 fromAgentID);
217 break; 207 }
218 case ChatTypeEnum.Shout: 208 break;
219 if (dis < m_shoutdistance) 209 case ChatTypeEnum.Say:
220 { 210 if (dis < m_saydistance)
211 {
212 //Console.WriteLine("sending chat");
213 presence.ControllingClient.SendChatMessage(message,
214 type,
215 fromPos,
216 fromName,
217 fromAgentID);
218 }
219 break;
220 case ChatTypeEnum.Shout:
221 if (dis < m_shoutdistance)
222 {
223 presence.ControllingClient.SendChatMessage(message,
224 type,
225 fromPos,
226 fromName,
227 fromAgentID);
228 }
229 break;
230
231 case ChatTypeEnum.Broadcast:
221 presence.ControllingClient.SendChatMessage(message, 232 presence.ControllingClient.SendChatMessage(message,
222 type, 233 type,
223 fromPos, 234 fromPos,
224 fromName, 235 fromName,
225 fromAgentID); 236 fromAgentID);
226 } 237 break;
227 break; 238 default:
228 239 break;
229 case ChatTypeEnum.Broadcast: 240 }
230 presence.ControllingClient.SendChatMessage(message,
231 type,
232 fromPos,
233 fromName,
234 fromAgentID);
235 break;
236 default:
237 break;
238 } 241 }
239 }); 242 });
240 } 243 }
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;