diff options
author | Teravus Ovares | 2007-12-10 00:46:56 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-10 00:46:56 +0000 |
commit | e595f82489ae91c2a913f2ac8445b3d5dbe160d0 (patch) | |
tree | 3c4c3ca6c42fefb3904f8eb211bfb38bac52ef0d /OpenSim/Region/Environment | |
parent | Added a call to m_host.SendFullUpdateToAllClients(). (diff) | |
download | opensim-SC-e595f82489ae91c2a913f2ac8445b3d5dbe160d0.zip opensim-SC-e595f82489ae91c2a913f2ac8445b3d5dbe160d0.tar.gz opensim-SC-e595f82489ae91c2a913f2ac8445b3d5dbe160d0.tar.bz2 opensim-SC-e595f82489ae91c2a913f2ac8445b3d5dbe160d0.tar.xz |
* Hooked up the GridComm event ChildDataUpdate to the scene.
* Added List<RegionInfo> m_neighbours to Scene
* Hooked up the OnRegionUp event to m_neighbours list
* Modified RegionInfo to have a bool commFailTF value so that we can skip neighbors that fail. (when the region comes up, this gets reset to false and the region will try again.
* Added SetChildAgentThrottle(byte[]) to IClientAPI
* Several other insignificant changes related to passing child pertanant agent data from sim to sim.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 47 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 14 |
3 files changed, 103 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 6bdb8a3..b6ca566 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -60,6 +60,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
60 | protected Timer m_restartWaitTimer = new Timer(); | 60 | protected Timer m_restartWaitTimer = new Timer(); |
61 | 61 | ||
62 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 62 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
63 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | ||
63 | 64 | ||
64 | public InnerScene m_innerScene; | 65 | public InnerScene m_innerScene; |
65 | 66 | ||
@@ -266,13 +267,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
266 | 267 | ||
267 | public override bool OtherRegionUp(RegionInfo otherRegion) | 268 | public override bool OtherRegionUp(RegionInfo otherRegion) |
268 | { | 269 | { |
269 | // Another region is up. We have to tell all our ScenePresences about it | 270 | // Another region is up. |
271 | // We have to tell all our ScenePresences about it.. | ||
272 | //and add it to the neighbor list. | ||
270 | 273 | ||
271 | 274 | ||
272 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) | 275 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) |
273 | { | 276 | { |
274 | if ((Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1) && (Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1)) | 277 | if ((Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1) && (Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1)) |
275 | { | 278 | { |
279 | for (int i = 0; i < m_neighbours.Count; i++) | ||
280 | { | ||
281 | // The purpose of this loop is to re-update the known neighbors | ||
282 | // when another region comes up on top of another one. | ||
283 | // The latest region in that location ends up in the | ||
284 | // 'known neighbors list' | ||
285 | // Additionally, the commFailTF property gets reset to false. | ||
286 | if (m_neighbours[i].RegionHandle == otherRegion.RegionHandle) | ||
287 | { | ||
288 | m_neighbours[i] = otherRegion; | ||
289 | } | ||
290 | } | ||
291 | |||
292 | // If the value isn't in the neighbours, add it. | ||
293 | // If the RegionInfo isn't exact but is for the same XY World location, | ||
294 | // then the above loop will fix that. | ||
295 | |||
296 | if (!(m_neighbours.Contains(otherRegion))) | ||
297 | { | ||
298 | m_neighbours.Add(otherRegion); | ||
299 | } | ||
300 | |||
276 | if (!(m_regionRestartNotifyList.Contains(otherRegion))) | 301 | if (!(m_regionRestartNotifyList.Contains(otherRegion))) |
277 | { | 302 | { |
278 | m_regionRestartNotifyList.Add(otherRegion); | 303 | m_regionRestartNotifyList.Add(otherRegion); |
@@ -1112,6 +1137,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1112 | m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; | 1137 | m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; |
1113 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; | 1138 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; |
1114 | m_sceneGridService.OnRegionUp += OtherRegionUp; | 1139 | m_sceneGridService.OnRegionUp += OtherRegionUp; |
1140 | m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | ||
1115 | 1141 | ||
1116 | m_sceneGridService.KillObject = SendKillObject; | 1142 | m_sceneGridService.KillObject = SendKillObject; |
1117 | } | 1143 | } |
@@ -1121,6 +1147,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1121 | /// </summary> | 1147 | /// </summary> |
1122 | public void UnRegisterReginWithComms() | 1148 | public void UnRegisterReginWithComms() |
1123 | { | 1149 | { |
1150 | m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | ||
1124 | m_sceneGridService.OnRegionUp -= OtherRegionUp; | 1151 | m_sceneGridService.OnRegionUp -= OtherRegionUp; |
1125 | m_sceneGridService.OnExpectUser -= NewUserConnection; | 1152 | m_sceneGridService.OnExpectUser -= NewUserConnection; |
1126 | m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; | 1153 | m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; |
@@ -1182,6 +1209,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
1182 | } | 1209 | } |
1183 | } | 1210 | } |
1184 | 1211 | ||
1212 | public virtual bool IncomingChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
1213 | { | ||
1214 | ScenePresence childAgentUpdate = GetScenePresence(new LLUUID(cAgentData.AgentID)); | ||
1215 | if (!(childAgentUpdate.Equals(null))) | ||
1216 | { | ||
1217 | // I can't imagine *yet* why we would get an update if the agent is a root agent.. | ||
1218 | // however to avoid a race condition crossing borders.. | ||
1219 | if (childAgentUpdate.IsChildAgent) | ||
1220 | { | ||
1221 | //Send Data to ScenePresence | ||
1222 | childAgentUpdate.ChildAgentDataUpdate(cAgentData); | ||
1223 | // Not Implemented: | ||
1224 | //TODO: Do we need to pass the message on to one of our neighbors? | ||
1225 | |||
1226 | } | ||
1227 | } | ||
1228 | return true; | ||
1229 | } | ||
1185 | /// <summary> | 1230 | /// <summary> |
1186 | /// | 1231 | /// |
1187 | /// </summary> | 1232 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 04228de..4d2379b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -23,6 +23,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
23 | public event CloseAgentConnection OnCloseAgentConnection; | 23 | public event CloseAgentConnection OnCloseAgentConnection; |
24 | public event PrimCrossing OnPrimCrossingIntoRegion; | 24 | public event PrimCrossing OnPrimCrossingIntoRegion; |
25 | public event RegionUp OnRegionUp; | 25 | public event RegionUp OnRegionUp; |
26 | public event ChildAgentUpdate OnChildAgentUpdate; | ||
26 | 27 | ||
27 | public KillObjectDelegate KillObject; | 28 | public KillObjectDelegate KillObject; |
28 | public string _debugRegionName = ""; | 29 | public string _debugRegionName = ""; |
@@ -59,6 +60,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
59 | regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing; | 60 | regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing; |
60 | regionCommsHost.OnCloseAgentConnection += CloseConnection; | 61 | regionCommsHost.OnCloseAgentConnection += CloseConnection; |
61 | regionCommsHost.OnRegionUp += newRegionUp; | 62 | regionCommsHost.OnRegionUp += newRegionUp; |
63 | regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; | ||
64 | |||
62 | } | 65 | } |
63 | else | 66 | else |
64 | { | 67 | { |
@@ -70,6 +73,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
70 | { | 73 | { |
71 | if (regionCommsHost != null) | 74 | if (regionCommsHost != null) |
72 | { | 75 | { |
76 | regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; | ||
73 | regionCommsHost.OnRegionUp -= newRegionUp; | 77 | regionCommsHost.OnRegionUp -= newRegionUp; |
74 | regionCommsHost.OnExpectUser -= NewUserConnection; | 78 | regionCommsHost.OnExpectUser -= NewUserConnection; |
75 | regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; | 79 | regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; |
@@ -105,6 +109,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
105 | } | 109 | } |
106 | return true; | 110 | return true; |
107 | } | 111 | } |
112 | protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
113 | { | ||
114 | if (OnChildAgentUpdate != null) | ||
115 | OnChildAgentUpdate(regionHandle, cAgentData); | ||
116 | |||
117 | |||
118 | return true; | ||
119 | } | ||
108 | 120 | ||
109 | protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) | 121 | protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
110 | { | 122 | { |
@@ -262,6 +274,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
262 | 274 | ||
263 | //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); | 275 | //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); |
264 | } | 276 | } |
277 | public delegate void SendChildAgentDataUpdateDelegate(ulong regionHandle, ChildAgentDataUpdate cAgentData); | ||
278 | |||
279 | private void SendChildAgentDataUpdateAsync(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
280 | { | ||
281 | MainLog.Instance.Notice("INTERGRID", "Informing a neighbor about my agent."); | ||
282 | bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle,cAgentData); | ||
283 | |||
284 | if (regionAccepted) | ||
285 | { | ||
286 | MainLog.Instance.Notice("INTERGRID", "Completed sending a neighbor an update about my agent"); | ||
287 | } | ||
288 | else | ||
289 | { | ||
290 | MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent"); | ||
291 | } | ||
292 | } | ||
293 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) | ||
294 | { | ||
295 | SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate)iar.AsyncState; | ||
296 | icon.EndInvoke(iar); | ||
297 | } | ||
298 | public void SendChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
299 | { | ||
300 | // This assumes that we know what our neighbors are. | ||
301 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | ||
302 | d.BeginInvoke(regionHandle, cAgentData, | ||
303 | SendChildAgentDataUpdateCompleted, | ||
304 | d); | ||
305 | |||
306 | } | ||
307 | |||
265 | 308 | ||
266 | /// <summary> | 309 | /// <summary> |
267 | /// | 310 | /// |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index f8571a9..ebd08b4 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
53 | private uint m_requestedSitTargetID = 0; | 53 | private uint m_requestedSitTargetID = 0; |
54 | private LLVector3 m_requestedSitOffset = new LLVector3(); | 54 | private LLVector3 m_requestedSitOffset = new LLVector3(); |
55 | private float m_sitAvatarHeight = 2.0f; | 55 | private float m_sitAvatarHeight = 2.0f; |
56 | private float m_godlevel = 0; | ||
56 | 57 | ||
57 | private bool m_isTyping = false; | 58 | private bool m_isTyping = false; |
58 | private bool m_setAlwaysRun = false; | 59 | private bool m_setAlwaysRun = false; |
@@ -1255,7 +1256,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1255 | respondPacket.AgentData = adb; | 1256 | respondPacket.AgentData = adb; |
1256 | ControllingClient.OutPacket(respondPacket, ThrottleOutPacketType.Task); | 1257 | ControllingClient.OutPacket(respondPacket, ThrottleOutPacketType.Task); |
1257 | } | 1258 | } |
1259 | public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData) | ||
1260 | { | ||
1261 | // | ||
1262 | m_DrawDistance = cAgentData.drawdistance; | ||
1263 | m_pos = new LLVector3(cAgentData.Position.x, cAgentData.Position.y, cAgentData.Position.z); | ||
1264 | m_CameraCenter = new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); | ||
1265 | m_godlevel = cAgentData.godlevel; | ||
1266 | ControllingClient.SetChildAgentThrottle(cAgentData.throttles); | ||
1267 | //cAgentData.AVHeight; | ||
1268 | //cAgentData.regionHandle; | ||
1269 | //m_velocity = cAgentData.Velocity; | ||
1270 | |||
1258 | 1271 | ||
1272 | } | ||
1259 | /// <summary> | 1273 | /// <summary> |
1260 | /// | 1274 | /// |
1261 | /// </summary> | 1275 | /// </summary> |