aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-09-04 20:19:34 -0400
committerTeravus Ovares (Dan Olivares)2009-09-04 20:19:34 -0400
commit016a648a3097b452f63b82af533e92c549ce0ca6 (patch)
treec51ffa71a1c523ce98e3e73414b8312495a585d0 /OpenSim/Region
parent* Last commit was a bit of a fail, it registered the root region for it's own... (diff)
downloadopensim-SC_OLD-016a648a3097b452f63b82af533e92c549ce0ca6.zip
opensim-SC_OLD-016a648a3097b452f63b82af533e92c549ce0ca6.tar.gz
opensim-SC_OLD-016a648a3097b452f63b82af533e92c549ce0ca6.tar.bz2
opensim-SC_OLD-016a648a3097b452f63b82af533e92c549ce0ca6.tar.xz
* Fixes various quirks rezzing in virtual regions.
* Breaks up the Client event registrations in Scene into methods of similar event types. The generic event registration registers all of the event types. *Created symmetrical Un-Registration methods. * Made the Registration and Unregistration methods public * Hooks The events required for creating new prim and rezzing new prim into the proper scene.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs248
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs268
2 files changed, 434 insertions, 82 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 5c5f164..91d736b 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -32,6 +32,7 @@ using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Client;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
37 38
@@ -71,6 +72,18 @@ namespace OpenSim.Region.CoreModules.World.Land
71 public void AddRegion(Scene scene) 72 public void AddRegion(Scene scene)
72 { 73 {
73 74
75
76
77 }
78
79 public void RemoveRegion(Scene scene)
80 {
81
82
83 }
84
85 public void RegionLoaded(Scene scene)
86 {
74 if (!enabledYN) 87 if (!enabledYN)
75 return; 88 return;
76 89
@@ -295,8 +308,8 @@ namespace OpenSim.Region.CoreModules.World.Land
295 m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", 308 m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
296 conn.RegionScene.RegionInfo.RegionName, 309 conn.RegionScene.RegionInfo.RegionName,
297 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); 310 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
298 311
299 312
300 scene.BordersLocked = true; 313 scene.BordersLocked = true;
301 conn.RegionScene.BordersLocked = true; 314 conn.RegionScene.BordersLocked = true;
302 315
@@ -325,9 +338,11 @@ namespace OpenSim.Region.CoreModules.World.Land
325 // 338 //
326 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); 339 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
327 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 340 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
328 341
329 conn.RegionScene.BordersLocked = false; 342 conn.RegionScene.BordersLocked = false;
330 scene.BordersLocked = false; 343 scene.BordersLocked = false;
344 if (conn.ClientEventForwarder != null)
345 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
331 connectedYN = true; 346 connectedYN = true;
332 break; 347 break;
333 } 348 }
@@ -367,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.Land
367 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", 382 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
368 conn.RegionScene.RegionInfo.RegionName, 383 conn.RegionScene.RegionInfo.RegionName,
369 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); 384 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
370 conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents); 385 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
371 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); 386 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
372 387
373 lock (conn.RegionScene.NorthBorders) 388 lock (conn.RegionScene.NorthBorders)
@@ -386,7 +401,8 @@ namespace OpenSim.Region.CoreModules.World.Land
386 401
387 scene.BordersLocked = false; 402 scene.BordersLocked = false;
388 conn.RegionScene.BordersLocked = false; 403 conn.RegionScene.BordersLocked = false;
389 404 if (conn.ClientEventForwarder != null)
405 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
390 connectedYN = true; 406 connectedYN = true;
391 break; 407 break;
392 } 408 }
@@ -424,52 +440,52 @@ namespace OpenSim.Region.CoreModules.World.Land
424 m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", 440 m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
425 conn.RegionScene.RegionInfo.RegionName, 441 conn.RegionScene.RegionInfo.RegionName,
426 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); 442 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
427 443
428 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); 444 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
429 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); 445 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
430 lock (conn.RegionScene.NorthBorders) 446 lock (conn.RegionScene.NorthBorders)
431 if (conn.RegionScene.NorthBorders.Count == 1)// && 2) 447 if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
432 { 448 {
433 //compound border 449 //compound border
434 // already locked above 450 // already locked above
435 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; 451 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
436 452
437 lock (conn.RegionScene.EastBorders) 453 lock (conn.RegionScene.EastBorders)
438 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; 454 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
439 lock (conn.RegionScene.WestBorders) 455 lock (conn.RegionScene.WestBorders)
440 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; 456 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
441 457
442
443 458
444 } 459
460 }
445 lock (scene.SouthBorders) 461 lock (scene.SouthBorders)
446 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south 462 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
447 463
448 lock (conn.RegionScene.EastBorders) 464 lock (conn.RegionScene.EastBorders)
449 if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) 465 if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
450 { 466 {
451 467
452 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; 468 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
453 lock (conn.RegionScene.NorthBorders) 469 lock (conn.RegionScene.NorthBorders)
454 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; 470 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
455 lock (conn.RegionScene.SouthBorders) 471 lock (conn.RegionScene.SouthBorders)
456 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; 472 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
457 473
458 474
459 } 475 }
460 476
461 lock (scene.WestBorders) 477 lock (scene.WestBorders)
462 scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West 478 scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
463/* 479 /*
464 else 480 else
465 { 481 {
466 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; 482 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
467 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; 483 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
468 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; 484 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
469 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south 485 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
470 } 486 }
471*/ 487 */
472 488
473 489
474 // Reset Terrain.. since terrain normally loads first. 490 // Reset Terrain.. since terrain normally loads first.
475 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 491 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
@@ -478,6 +494,9 @@ namespace OpenSim.Region.CoreModules.World.Land
478 scene.BordersLocked = false; 494 scene.BordersLocked = false;
479 conn.RegionScene.BordersLocked = false; 495 conn.RegionScene.BordersLocked = false;
480 496
497 if (conn.ClientEventForwarder != null)
498 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
499
481 connectedYN = true; 500 connectedYN = true;
482 501
483 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); 502 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
@@ -495,7 +514,7 @@ namespace OpenSim.Region.CoreModules.World.Land
495 rdata.RegionScene = scene; 514 rdata.RegionScene = scene;
496 regionConnections.RegionLandChannel = scene.LandChannel; 515 regionConnections.RegionLandChannel = scene.LandChannel;
497 516
498 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata,scene.LandChannel,regionConnections.ConnectedRegions); 517 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, regionConnections.ConnectedRegions);
499 scene.LandChannel = lnd; 518 scene.LandChannel = lnd;
500 lock (m_regions) 519 lock (m_regions)
501 { 520 {
@@ -504,24 +523,14 @@ namespace OpenSim.Region.CoreModules.World.Land
504 ForwardPermissionRequests(regionConnections, r.RegionScene); 523 ForwardPermissionRequests(regionConnections, r.RegionScene);
505 } 524 }
506 } 525 }
507 526
508 m_regions.Add(scene.RegionInfo.originRegionID,regionConnections); 527 regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
528
529 m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
509 } 530 }
510 531
511 } 532 }
512 AdjustLargeRegionBounds(); 533 AdjustLargeRegionBounds();
513
514 }
515
516 public void RemoveRegion(Scene scene)
517 {
518
519
520 }
521
522 public void RegionLoaded(Scene scene)
523 {
524
525 } 534 }
526 535
527 public void PostInitialise() 536 public void PostInitialise()
@@ -733,6 +742,7 @@ namespace OpenSim.Region.CoreModules.World.Land
733 public int YEnd; 742 public int YEnd;
734 public List<RegionData> ConnectedRegions; 743 public List<RegionData> ConnectedRegions;
735 public RegionCombinerPermissionModule PermissionModule; 744 public RegionCombinerPermissionModule PermissionModule;
745 public RegionCombinerClientEventForwarder ClientEventForwarder;
736 public void UpdateExtents(Vector3 extents) 746 public void UpdateExtents(Vector3 extents)
737 { 747 {
738 XEnd = (int)extents.X; 748 XEnd = (int)extents.X;
@@ -790,7 +800,7 @@ namespace OpenSim.Region.CoreModules.World.Land
790 else 800 else
791 { 801 {
792 int offsetX = (x / (int)Constants.RegionSize); 802 int offsetX = (x / (int)Constants.RegionSize);
793 int offsetY = (x / (int)Constants.RegionSize); 803 int offsetY = (y / (int)Constants.RegionSize);
794 offsetX *= (int)Constants.RegionSize; 804 offsetX *= (int)Constants.RegionSize;
795 offsetY *= (int)Constants.RegionSize; 805 offsetY *= (int)Constants.RegionSize;
796 806
@@ -823,7 +833,7 @@ namespace OpenSim.Region.CoreModules.World.Land
823 else 833 else
824 { 834 {
825 int offsetX = (int)(x/(int) Constants.RegionSize); 835 int offsetX = (int)(x/(int) Constants.RegionSize);
826 int offsetY = (int)(x/(int) Constants.RegionSize); 836 int offsetY = (int)(y/(int) Constants.RegionSize);
827 offsetX *= (int) Constants.RegionSize; 837 offsetX *= (int) Constants.RegionSize;
828 offsetY *= (int) Constants.RegionSize; 838 offsetY *= (int) Constants.RegionSize;
829 839
@@ -886,6 +896,7 @@ namespace OpenSim.Region.CoreModules.World.Land
886 m_rootScene = RootScene; 896 m_rootScene = RootScene;
887 } 897 }
888 898
899 #region Permission Override
889 public bool BypassPermissions() 900 public bool BypassPermissions()
890 { 901 {
891 return m_rootScene.Permissions.BypassPermissions(); 902 return m_rootScene.Permissions.BypassPermissions();
@@ -1110,5 +1121,132 @@ namespace OpenSim.Region.CoreModules.World.Land
1110 { 1121 {
1111 return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist); 1122 return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist);
1112 } 1123 }
1124 #endregion
1125 }
1126
1127 public class RegionCombinerClientEventForwarder
1128 {
1129 private Scene m_rootScene;
1130 private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>();
1131 private Dictionary<UUID,RegionCombinerModuleIndividualForwarder> m_forwarders = new Dictionary<UUID, RegionCombinerModuleIndividualForwarder>();
1132 public RegionCombinerClientEventForwarder(RegionConnections rootScene)
1133 {
1134 m_rootScene = rootScene.RegionScene;
1135
1136
1137 }
1138
1139 public void AddSceneToEventForwarding( Scene virtualScene )
1140 {
1141 lock (m_virtScene)
1142 {
1143 if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
1144 {
1145 m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene;
1146 }
1147 else
1148 {
1149 m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene);
1150 }
1151 }
1152
1153 lock (m_forwarders)
1154 {
1155 // TODO: Fix this to unregister if this happens
1156 if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID))
1157 m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
1158
1159 RegionCombinerModuleIndividualForwarder forwarder =
1160 new RegionCombinerModuleIndividualForwarder(m_rootScene, virtualScene);
1161 m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder);
1162
1163 virtualScene.EventManager.OnNewClient += forwarder.ClientConnect;
1164 virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed;
1165 }
1166 }
1167
1168 public void RemoveSceneFromEventForwarding (Scene virtualScene)
1169 {
1170 lock (m_forwarders)
1171 {
1172 RegionCombinerModuleIndividualForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID];
1173 virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect;
1174 virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed;
1175 m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
1176 }
1177 lock (m_virtScene)
1178 {
1179 if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
1180 {
1181 m_virtScene.Remove(virtualScene.RegionInfo.originRegionID);
1182 }
1183 }
1184 }
1185 }
1186
1187 public class RegionCombinerModuleIndividualForwarder
1188 {
1189 private Scene m_rootScene;
1190 private Scene m_virtScene;
1191 public RegionCombinerModuleIndividualForwarder(Scene rootScene, Scene virtScene)
1192 {
1193 m_rootScene = rootScene;
1194 m_virtScene = virtScene;
1195 }
1196
1197 public void ClientConnect(IClientAPI client)
1198 {
1199
1200 m_virtScene.UnSubscribeToClientPrimEvents(client);
1201 m_virtScene.UnSubscribeToClientPrimRezEvents(client);
1202 m_virtScene.UnSubscribeToClientInventoryEvents(client);
1203 m_virtScene.UnSubscribeToClientAttachmentEvents(client);
1204 m_virtScene.UnSubscribeToClientTeleportEvents(client);
1205 m_virtScene.UnSubscribeToClientScriptEvents(client);
1206 m_virtScene.UnSubscribeToClientGodEvents(client);
1207 m_virtScene.UnSubscribeToClientNetworkEvents(client);
1208
1209 m_rootScene.SubscribeToClientPrimEvents(client);
1210 client.OnAddPrim += LocalAddNewPrim;
1211 client.OnRezObject += LocalRezObject;
1212 m_rootScene.SubscribeToClientInventoryEvents(client);
1213 m_rootScene.SubscribeToClientAttachmentEvents(client);
1214 m_rootScene.SubscribeToClientTeleportEvents(client);
1215 m_rootScene.SubscribeToClientScriptEvents(client);
1216 m_rootScene.SubscribeToClientGodEvents(client);
1217 m_rootScene.SubscribeToClientNetworkEvents(client);
1218 }
1219 public void ClientClosed(UUID clientid, Scene scene)
1220 {
1221
1222 }
1223
1224
1225 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, UUID fromtaskid)
1226 {
1227 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
1228 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
1229 rayend.X += differenceX * (int)Constants.RegionSize;
1230 rayend.Y += differenceY * (int)Constants.RegionSize;
1231 raystart.X += differenceX * (int)Constants.RegionSize;
1232 raystart.Y += differenceY * (int)Constants.RegionSize;
1233
1234 m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
1235 rayendisintersection, rezselected, removeitem, fromtaskid);
1236
1237 }
1238
1239 private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, byte rayendisintersection)
1240 {
1241 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
1242 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
1243 rayend.X += differenceX * (int)Constants.RegionSize;
1244 rayend.Y += differenceY * (int)Constants.RegionSize;
1245 raystart.X += differenceX * (int)Constants.RegionSize;
1246 raystart.Y += differenceY * (int)Constants.RegionSize;
1247 m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
1248 rayendisintersection);
1249
1250 }
1113 } 1251 }
1114} 1252}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1d0da4c..c25ae10 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2365,14 +2365,40 @@ namespace OpenSim.Region.Framework.Scenes
2365 EventManager.TriggerOnNewClient(client); 2365 EventManager.TriggerOnNewClient(client);
2366 } 2366 }
2367 2367
2368
2369
2368 /// <summary> 2370 /// <summary>
2369 /// Register for events from the client 2371 /// Register for events from the client
2370 /// </summary> 2372 /// </summary>
2371 /// <param name="client">The IClientAPI of the connected client</param> 2373 /// <param name="client">The IClientAPI of the connected client</param>
2372 protected virtual void SubscribeToClientEvents(IClientAPI client) 2374 public virtual void SubscribeToClientEvents(IClientAPI client)
2375 {
2376 SubscribeToClientTerrainEvents(client);
2377 SubscribeToClientPrimEvents(client);
2378 SubscribeToClientPrimRezEvents(client);
2379 SubscribeToClientInventoryEvents(client);
2380 SubscribeToClientAttachmentEvents(client);
2381 SubscribeToClientTeleportEvents(client);
2382 SubscribeToClientScriptEvents(client);
2383 SubscribeToClientParcelEvents(client);
2384 SubscribeToClientGridEvents(client);
2385 SubscribeToClientGodEvents(client);
2386
2387 SubscribeToClientNetworkEvents(client);
2388
2389
2390 // EventManager.TriggerOnNewClient(client);
2391 }
2392
2393 public virtual void SubscribeToClientTerrainEvents(IClientAPI client)
2373 { 2394 {
2374 client.OnRegionHandShakeReply += SendLayerData; 2395 client.OnRegionHandShakeReply += SendLayerData;
2375 client.OnAddPrim += AddNewPrim; 2396 client.OnUnackedTerrain += TerrainUnAcked;
2397 }
2398
2399 public virtual void SubscribeToClientPrimEvents(IClientAPI client)
2400 {
2401
2376 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; 2402 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition;
2377 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; 2403 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
2378 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; 2404 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
@@ -2384,8 +2410,6 @@ namespace OpenSim.Region.Framework.Scenes
2384 client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; 2410 client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam;
2385 client.OnUpdatePrimShape += m_sceneGraph.UpdatePrimShape; 2411 client.OnUpdatePrimShape += m_sceneGraph.UpdatePrimShape;
2386 client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture; 2412 client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture;
2387 client.OnTeleportLocationRequest += RequestTeleportLocation;
2388 client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
2389 client.OnObjectRequest += RequestPrim; 2413 client.OnObjectRequest += RequestPrim;
2390 client.OnObjectSelect += SelectPrim; 2414 client.OnObjectSelect += SelectPrim;
2391 client.OnObjectDeselect += DeselectPrim; 2415 client.OnObjectDeselect += DeselectPrim;
@@ -2393,15 +2417,7 @@ namespace OpenSim.Region.Framework.Scenes
2393 client.OnSpinStart += m_sceneGraph.SpinStart; 2417 client.OnSpinStart += m_sceneGraph.SpinStart;
2394 client.OnSpinUpdate += m_sceneGraph.SpinObject; 2418 client.OnSpinUpdate += m_sceneGraph.SpinObject;
2395 client.OnDeRezObject += DeRezObject; 2419 client.OnDeRezObject += DeRezObject;
2396 client.OnRezObject += RezObject; 2420
2397 client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
2398 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
2399 client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
2400 client.OnObjectAttach += m_sceneGraph.AttachObject;
2401 client.OnObjectDetach += m_sceneGraph.DetachObject;
2402 client.OnObjectDrop += m_sceneGraph.DropObject;
2403 client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest;
2404 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2405 client.OnObjectName += m_sceneGraph.PrimName; 2421 client.OnObjectName += m_sceneGraph.PrimName;
2406 client.OnObjectClickAction += m_sceneGraph.PrimClickAction; 2422 client.OnObjectClickAction += m_sceneGraph.PrimClickAction;
2407 client.OnObjectMaterial += m_sceneGraph.PrimMaterial; 2423 client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
@@ -2412,7 +2428,24 @@ namespace OpenSim.Region.Framework.Scenes
2412 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; 2428 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
2413 client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; 2429 client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
2414 client.OnObjectPermissions += HandleObjectPermissionsUpdate; 2430 client.OnObjectPermissions += HandleObjectPermissionsUpdate;
2431 client.OnGrabObject += ProcessObjectGrab;
2432 client.OnDeGrabObject += ProcessObjectDeGrab;
2433 client.OnUndo += m_sceneGraph.HandleUndo;
2434 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2435 client.OnObjectDrop += m_sceneGraph.DropObject;
2436 client.OnObjectSaleInfo += ObjectSaleInfo;
2437 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
2438 client.OnObjectOwner += ObjectOwner;
2439 }
2440
2441 public virtual void SubscribeToClientPrimRezEvents(IClientAPI client)
2442 {
2443 client.OnAddPrim += AddNewPrim;
2444 client.OnRezObject += RezObject;
2445 }
2415 2446
2447 public virtual void SubscribeToClientInventoryEvents(IClientAPI client)
2448 {
2416 client.OnCreateNewInventoryItem += CreateNewInventoryItem; 2449 client.OnCreateNewInventoryItem += CreateNewInventoryItem;
2417 client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; 2450 client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder;
2418 client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; 2451 client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder;
@@ -2430,36 +2463,217 @@ namespace OpenSim.Region.Framework.Scenes
2430 client.OnRemoveTaskItem += RemoveTaskInventory; 2463 client.OnRemoveTaskItem += RemoveTaskInventory;
2431 client.OnUpdateTaskInventory += UpdateTaskInventory; 2464 client.OnUpdateTaskInventory += UpdateTaskInventory;
2432 client.OnMoveTaskItem += ClientMoveTaskInventoryItem; 2465 client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
2466 }
2433 2467
2434 client.OnGrabObject += ProcessObjectGrab; 2468 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
2435 client.OnDeGrabObject += ProcessObjectDeGrab; 2469 {
2436 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 2470 client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
2437 client.OnParcelBuy += ProcessParcelBuy; 2471 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
2438 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; 2472 client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
2439 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; 2473 client.OnObjectAttach += m_sceneGraph.AttachObject;
2474 client.OnObjectDetach += m_sceneGraph.DetachObject;
2475 }
2476
2477 public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
2478 {
2479 client.OnTeleportLocationRequest += RequestTeleportLocation;
2480 client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
2440 client.OnTeleportHomeRequest += TeleportClientHome; 2481 client.OnTeleportHomeRequest += TeleportClientHome;
2441 client.OnSetStartLocationRequest += SetHomeRezPoint; 2482 }
2442 client.OnUndo += m_sceneGraph.HandleUndo; 2483
2443 client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate; 2484 public virtual void SubscribeToClientScriptEvents(IClientAPI client)
2444 client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; 2485 {
2445 client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime;
2446 client.OnObjectSaleInfo += ObjectSaleInfo;
2447 client.OnScriptReset += ProcessScriptReset; 2486 client.OnScriptReset += ProcessScriptReset;
2448 client.OnGetScriptRunning += GetScriptRunning; 2487 client.OnGetScriptRunning += GetScriptRunning;
2449 client.OnSetScriptRunning += SetScriptRunning; 2488 client.OnSetScriptRunning += SetScriptRunning;
2489 }
2490
2491 public virtual void SubscribeToClientParcelEvents(IClientAPI client)
2492 {
2493 client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate;
2494 client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel;
2495 client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime;
2496 client.OnParcelBuy += ProcessParcelBuy;
2497 }
2498
2499 public virtual void SubscribeToClientGridEvents(IClientAPI client)
2500 {
2501 client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest;
2502 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
2503 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
2504 client.OnSetStartLocationRequest += SetHomeRezPoint;
2450 client.OnRegionHandleRequest += RegionHandleRequest; 2505 client.OnRegionHandleRequest += RegionHandleRequest;
2451 client.OnUnackedTerrain += TerrainUnAcked; 2506 }
2452 client.OnObjectOwner += ObjectOwner;
2453 2507
2508 public virtual void SubscribeToClientGodEvents(IClientAPI client)
2509 {
2454 IGodsModule godsModule = RequestModuleInterface<IGodsModule>(); 2510 IGodsModule godsModule = RequestModuleInterface<IGodsModule>();
2455 client.OnGodKickUser += godsModule.KickUser; 2511 client.OnGodKickUser += godsModule.KickUser;
2456 client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers; 2512 client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers;
2513 }
2457 2514
2515 public virtual void SubscribeToClientNetworkEvents(IClientAPI client)
2516 {
2458 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; 2517 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats;
2518 }
2519
2520 protected virtual void UnsubscribeToClientEvents(IClientAPI client)
2521 {
2522
2523 }
2524
2525 /// <summary>
2526 /// Register for events from the client
2527 /// </summary>
2528 /// <param name="client">The IClientAPI of the connected client</param>
2529 public virtual void UnSubscribeToClientEvents(IClientAPI client)
2530 {
2531 UnSubscribeToClientTerrainEvents(client);
2532 UnSubscribeToClientPrimEvents(client);
2533 UnSubscribeToClientPrimRezEvents(client);
2534 UnSubscribeToClientInventoryEvents(client);
2535 UnSubscribeToClientAttachmentEvents(client);
2536 UnSubscribeToClientTeleportEvents(client);
2537 UnSubscribeToClientScriptEvents(client);
2538 UnSubscribeToClientParcelEvents(client);
2539 UnSubscribeToClientGridEvents(client);
2540 UnSubscribeToClientGodEvents(client);
2541
2542 UnSubscribeToClientNetworkEvents(client);
2543
2459 2544
2460 // EventManager.TriggerOnNewClient(client); 2545 // EventManager.TriggerOnNewClient(client);
2461 } 2546 }
2462 2547
2548 public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client)
2549 {
2550 client.OnRegionHandShakeReply -= SendLayerData;
2551 client.OnUnackedTerrain -= TerrainUnAcked;
2552 }
2553
2554 public virtual void UnSubscribeToClientPrimEvents(IClientAPI client)
2555 {
2556 client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition;
2557 client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition;
2558 client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimRotation;
2559 client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimRotation;
2560 client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation;
2561 client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition;
2562 client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale;
2563 client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale;
2564 client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam;
2565 client.OnUpdatePrimShape -= m_sceneGraph.UpdatePrimShape;
2566 client.OnUpdatePrimTexture -= m_sceneGraph.UpdatePrimTexture;
2567 client.OnObjectRequest -= RequestPrim;
2568 client.OnObjectSelect -= SelectPrim;
2569 client.OnObjectDeselect -= DeselectPrim;
2570 client.OnGrabUpdate -= m_sceneGraph.MoveObject;
2571 client.OnSpinStart -= m_sceneGraph.SpinStart;
2572 client.OnSpinUpdate -= m_sceneGraph.SpinObject;
2573 client.OnDeRezObject -= DeRezObject;
2574 client.OnObjectName -= m_sceneGraph.PrimName;
2575 client.OnObjectClickAction -= m_sceneGraph.PrimClickAction;
2576 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
2577 client.OnLinkObjects -= m_sceneGraph.LinkObjects;
2578 client.OnDelinkObjects -= m_sceneGraph.DelinkObjects;
2579 client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject;
2580 client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay;
2581 client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags;
2582 client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily;
2583 client.OnObjectPermissions -= HandleObjectPermissionsUpdate;
2584 client.OnGrabObject -= ProcessObjectGrab;
2585 client.OnDeGrabObject -= ProcessObjectDeGrab;
2586 client.OnUndo -= m_sceneGraph.HandleUndo;
2587 client.OnObjectDescription -= m_sceneGraph.PrimDescription;
2588 client.OnObjectDrop -= m_sceneGraph.DropObject;
2589 client.OnObjectSaleInfo -= ObjectSaleInfo;
2590 client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable;
2591 client.OnObjectOwner -= ObjectOwner;
2592 }
2593
2594 public virtual void UnSubscribeToClientPrimRezEvents(IClientAPI client)
2595 {
2596 client.OnAddPrim -= AddNewPrim;
2597 client.OnRezObject -= RezObject;
2598 }
2599
2600
2601 public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client)
2602 {
2603 client.OnCreateNewInventoryItem -= CreateNewInventoryItem;
2604 client.OnCreateNewInventoryFolder -= HandleCreateInventoryFolder;
2605 client.OnUpdateInventoryFolder -= HandleUpdateInventoryFolder;
2606 client.OnMoveInventoryFolder -= HandleMoveInventoryFolder; // 2; //!!
2607 client.OnFetchInventoryDescendents -= HandleFetchInventoryDescendents;
2608 client.OnPurgeInventoryDescendents -= HandlePurgeInventoryDescendents; // 2; //!!
2609 client.OnFetchInventory -= HandleFetchInventory;
2610 client.OnUpdateInventoryItem -= UpdateInventoryItemAsset;
2611 client.OnCopyInventoryItem -= CopyInventoryItem;
2612 client.OnMoveInventoryItem -= MoveInventoryItem;
2613 client.OnRemoveInventoryItem -= RemoveInventoryItem;
2614 client.OnRemoveInventoryFolder -= RemoveInventoryFolder;
2615 client.OnRezScript -= RezScript;
2616 client.OnRequestTaskInventory -= RequestTaskInventory;
2617 client.OnRemoveTaskItem -= RemoveTaskInventory;
2618 client.OnUpdateTaskInventory -= UpdateTaskInventory;
2619 client.OnMoveTaskItem -= ClientMoveTaskInventoryItem;
2620 }
2621
2622 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
2623 {
2624 client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
2625 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
2626 client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv;
2627 client.OnObjectAttach -= m_sceneGraph.AttachObject;
2628 client.OnObjectDetach -= m_sceneGraph.DetachObject;
2629 }
2630
2631 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
2632 {
2633 client.OnTeleportLocationRequest -= RequestTeleportLocation;
2634 client.OnTeleportLandmarkRequest -= RequestTeleportLandmark;
2635 client.OnTeleportHomeRequest -= TeleportClientHome;
2636 }
2637
2638 public virtual void UnSubscribeToClientScriptEvents(IClientAPI client)
2639 {
2640 client.OnScriptReset -= ProcessScriptReset;
2641 client.OnGetScriptRunning -= GetScriptRunning;
2642 client.OnSetScriptRunning -= SetScriptRunning;
2643 }
2644
2645 public virtual void UnSubscribeToClientParcelEvents(IClientAPI client)
2646 {
2647 client.OnObjectGroupRequest -= m_sceneGraph.HandleObjectGroupUpdate;
2648 client.OnParcelReturnObjectsRequest -= LandChannel.ReturnObjectsInParcel;
2649 client.OnParcelSetOtherCleanTime -= LandChannel.SetParcelOtherCleanTime;
2650 client.OnParcelBuy -= ProcessParcelBuy;
2651 }
2652
2653 public virtual void UnSubscribeToClientGridEvents(IClientAPI client)
2654 {
2655 client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest;
2656 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
2657 client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
2658 client.OnSetStartLocationRequest -= SetHomeRezPoint;
2659 client.OnRegionHandleRequest -= RegionHandleRequest;
2660 }
2661
2662 public virtual void UnSubscribeToClientGodEvents(IClientAPI client)
2663 {
2664 IGodsModule godsModule = RequestModuleInterface<IGodsModule>();
2665 client.OnGodKickUser -= godsModule.KickUser;
2666 client.OnRequestGodlikePowers -= godsModule.RequestGodlikePowers;
2667 }
2668
2669 public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client)
2670 {
2671 client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats;
2672 }
2673
2674
2675
2676
2463 /// <summary> 2677 /// <summary>
2464 /// Teleport an avatar to their home region 2678 /// Teleport an avatar to their home region
2465 /// </summary> 2679 /// </summary>