aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.Region/Scenes/Scene.cs')
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.cs77
1 files changed, 41 insertions, 36 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index ffcc0c8..74b4945 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -46,12 +46,12 @@ using OpenSim.Caches;
46 46
47namespace OpenSim.Region.Scenes 47namespace OpenSim.Region.Scenes
48{ 48{
49 public delegate bool FilterAvatarList(Avatar avatar); 49 public delegate bool FilterAvatarList(ScenePresence avatar);
50 50
51 public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI 51 public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI
52 { 52 {
53 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); 53 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
54 protected Dictionary<libsecondlife.LLUUID, Avatar> Avatars; 54 protected Dictionary<libsecondlife.LLUUID, ScenePresence> Avatars;
55 protected Dictionary<libsecondlife.LLUUID, Primitive> Prims; 55 protected Dictionary<libsecondlife.LLUUID, Primitive> Prims;
56 private PhysicsScene phyScene; 56 private PhysicsScene phyScene;
57 private float timeStep = 0.1f; 57 private float timeStep = 0.1f;
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Scenes
66 protected AuthenticateSessionsBase authenticateHandler; 66 protected AuthenticateSessionsBase authenticateHandler;
67 protected RegionCommsListener regionCommsHost; 67 protected RegionCommsListener regionCommsHost;
68 protected CommunicationsManager commsManager; 68 protected CommunicationsManager commsManager;
69 69
70 70
71 public ParcelManager parcelManager; 71 public ParcelManager parcelManager;
72 public EstateManager estateManager; 72 public EstateManager estateManager;
@@ -119,14 +119,14 @@ namespace OpenSim.Region.Scenes
119 119
120 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); 120 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance");
121 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 121 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
122 Avatars = new Dictionary<LLUUID, Avatar>(); 122 Avatars = new Dictionary<LLUUID, ScenePresence>();
123 Prims = new Dictionary<LLUUID, Primitive>(); 123 Prims = new Dictionary<LLUUID, Primitive>();
124 124
125 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); 125 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap");
126 TerrainManager = new TerrainManager(new SecondLife()); 126 TerrainManager = new TerrainManager(new SecondLife());
127 Terrain = new TerrainEngine(); 127 Terrain = new TerrainEngine();
128 128
129 Avatar.LoadAnims(); 129 ScenePresence.LoadAnims();
130 } 130 }
131 catch (Exception e) 131 catch (Exception e)
132 { 132 {
@@ -209,7 +209,7 @@ namespace OpenSim.Region.Scenes
209 OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); 209 OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString());
210 } 210 }
211 updateLock.ReleaseMutex(); 211 updateLock.ReleaseMutex();
212 212
213 } 213 }
214 214
215 /// <summary> 215 /// <summary>
@@ -408,6 +408,7 @@ namespace OpenSim.Region.Scenes
408 /// <summary> 408 /// <summary>
409 /// Loads the World heightmap 409 /// Loads the World heightmap
410 /// </summary> 410 /// </summary>
411 ///
411 public override void LoadWorldMap() 412 public override void LoadWorldMap()
412 { 413 {
413 try 414 try
@@ -415,16 +416,16 @@ namespace OpenSim.Region.Scenes
415 float[] map = this.localStorage.LoadWorld(); 416 float[] map = this.localStorage.LoadWorld();
416 if (map == null) 417 if (map == null)
417 { 418 {
418 // Console.WriteLine("creating new terrain"); 419 // Console.WriteLine("creating new terrain");
419 // this.Terrain.hills(); 420 // this.Terrain.hills();
420 421
421 // this.localStorage.SaveMap(this.Terrain.getHeights1D()); 422 // this.localStorage.SaveMap(this.Terrain.getHeights1D());
422 if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) 423 if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile))
423 { 424 {
424 Console.WriteLine("No default terrain, procedurally generating..."); 425 Console.WriteLine("No default terrain, procedurally generating...");
425 this.Terrain.hills(); 426 this.Terrain.hills();
426 427
427 // this.localStorage.SaveMap(this.Terrain.getHeights1D()); 428 // this.localStorage.SaveMap(this.Terrain.getHeights1D());
428 } 429 }
429 else 430 else
430 { 431 {
@@ -438,7 +439,7 @@ namespace OpenSim.Region.Scenes
438 Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); 439 Console.WriteLine("Unable to load default terrain, procedurally generating instead...");
439 Terrain.hills(); 440 Terrain.hills();
440 } 441 }
441 // this.localStorage.SaveMap(this.Terrain.getHeights1D()); 442 // this.localStorage.SaveMap(this.Terrain.getHeights1D());
442 } 443 }
443 } 444 }
444 else 445 else
@@ -447,7 +448,7 @@ namespace OpenSim.Region.Scenes
447 } 448 }
448 449
449 CreateTerrainTexture(); 450 CreateTerrainTexture();
450 451
451 } 452 }
452 catch (Exception e) 453 catch (Exception e)
453 { 454 {
@@ -455,7 +456,6 @@ namespace OpenSim.Region.Scenes
455 } 456 }
456 } 457 }
457 458
458
459 /// <summary> 459 /// <summary>
460 /// 460 ///
461 /// </summary> 461 /// </summary>
@@ -520,15 +520,19 @@ namespace OpenSim.Region.Scenes
520 { 520 {
521 try 521 try
522 { 522 {
523
523 // MainLog.Instance.Notice("World.cs: AddNewPrim() - Creating new prim"); 524 // MainLog.Instance.Notice("World.cs: AddNewPrim() - Creating new prim");
525
524 Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); 526 Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount);
525 527
526 this.Entities.Add(prim.uuid, prim); 528 this.Entities.Add(prim.uuid, prim);
527 this._primCount++; 529 this._primCount++;
528 } 530 }
529 catch (Exception e) 531 catch (Exception e)
530 { 532 {
533
531 // MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); 534 // MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString());
535
532 } 536 }
533 } 537 }
534 538
@@ -542,16 +546,16 @@ namespace OpenSim.Region.Scenes
542 /// <param name="remoteClient"></param 546 /// <param name="remoteClient"></param
543 /// <param name="agentID"></param> 547 /// <param name="agentID"></param>
544 /// <param name="child"></param> 548 /// <param name="child"></param>
545 public override void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child) 549 public override void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child)
546 { 550 {
547 remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData); 551 remoteClient.OnRegionHandShakeReply += this.SendLayerData;
548 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); 552 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
549 remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); 553 remoteClient.OnChatFromViewer += this.SimChat;
550 remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours); 554 remoteClient.OnRequestWearables += this.InformClientOfNeighbours;
551 remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim); 555 remoteClient.OnAddPrim += this.AddNewPrim;
552 remoteClient.OnUpdatePrimPosition += new UpdatePrimVector(this.UpdatePrimPosition); 556 remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition;
553 remoteClient.OnRequestMapBlocks += new RequestMapBlocks(this.RequestMapBlocks); 557 remoteClient.OnRequestMapBlocks += this.RequestMapBlocks;
554 remoteClient.OnTeleportLocationRequest += new TeleportLocationRequest(this.RequestTeleportLocation); 558 remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation;
555 559
556 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); 560 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
557 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); 561 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
@@ -560,11 +564,12 @@ namespace OpenSim.Region.Scenes
560 remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); 564 remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage);
561 */ 565 */
562 566
563 Avatar newAvatar = null; 567 ScenePresence newAvatar = null;
564 try 568 try
565 { 569 {
570
566 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 571 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
567 newAvatar = new Avatar(remoteClient, this, this.m_regInfo); 572 newAvatar = new ScenePresence(remoteClient, this, this.m_regInfo);
568 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); 573 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world");
569 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); 574 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake ");
570 575
@@ -607,13 +612,13 @@ namespace OpenSim.Region.Scenes
607 return; 612 return;
608 } 613 }
609 614
610 615
611 616
612 /// <summary> 617 /// <summary>
613 /// 618 ///
614 /// </summary> 619 /// </summary>
615 /// <param name="agentID"></param> 620 /// <param name="agentID"></param>
616 public override void RemoveAvatar(LLUUID agentID) 621 public override void RemoveClient(LLUUID agentID)
617 { 622 {
618 return; 623 return;
619 } 624 }
@@ -627,11 +632,11 @@ namespace OpenSim.Region.Scenes
627 /// Request a List of all Avatars in this World 632 /// Request a List of all Avatars in this World
628 /// </summary> 633 /// </summary>
629 /// <returns></returns> 634 /// <returns></returns>
630 public List<Avatar> RequestAvatarList() 635 public List<ScenePresence> RequestAvatarList()
631 { 636 {
632 List<Avatar> result = new List<Avatar>(); 637 List<ScenePresence> result = new List<ScenePresence>();
633 638
634 foreach (Avatar avatar in Avatars.Values) 639 foreach (ScenePresence avatar in Avatars.Values)
635 { 640 {
636 result.Add(avatar); 641 result.Add(avatar);
637 } 642 }
@@ -643,11 +648,11 @@ namespace OpenSim.Region.Scenes
643 /// Request a filtered list of Avatars in this World 648 /// Request a filtered list of Avatars in this World
644 /// </summary> 649 /// </summary>
645 /// <returns></returns> 650 /// <returns></returns>
646 public List<Avatar> RequestAvatarList(FilterAvatarList filter) 651 public List<ScenePresence> RequestAvatarList(FilterAvatarList filter)
647 { 652 {
648 List<Avatar> result = new List<Avatar>(); 653 List<ScenePresence> result = new List<ScenePresence>();
649 654
650 foreach (Avatar avatar in Avatars.Values) 655 foreach (ScenePresence avatar in Avatars.Values)
651 { 656 {
652 if (filter(avatar)) 657 if (filter(avatar))
653 { 658 {
@@ -663,7 +668,7 @@ namespace OpenSim.Region.Scenes
663 /// </summary> 668 /// </summary>
664 /// <param name="avatarID"></param> 669 /// <param name="avatarID"></param>
665 /// <returns></returns> 670 /// <returns></returns>
666 public Avatar RequestAvatar(LLUUID avatarID) 671 public ScenePresence RequestAvatar(LLUUID avatarID)
667 { 672 {
668 if (this.Avatars.ContainsKey(avatarID)) 673 if (this.Avatars.ContainsKey(avatarID))
669 { 674 {
@@ -712,7 +717,7 @@ namespace OpenSim.Region.Scenes
712 /// <param name="agent"></param> 717 /// <param name="agent"></param>
713 public void NewUserConnection(ulong regionHandle, AgentCircuitData agent) 718 public void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
714 { 719 {
715 // Console.WriteLine("World.cs - add new user connection"); 720 // Console.WriteLine("World.cs - add new user connection");
716 //should just check that its meant for this region 721 //should just check that its meant for this region
717 if (regionHandle == this.m_regInfo.RegionHandle) 722 if (regionHandle == this.m_regInfo.RegionHandle)
718 { 723 {
@@ -777,7 +782,7 @@ namespace OpenSim.Region.Scenes
777 { 782 {
778 List<MapBlockData> mapBlocks; 783 List<MapBlockData> mapBlocks;
779 mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); 784 mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
780 785
781 remoteClient.SendMapBlock(mapBlocks); 786 remoteClient.SendMapBlock(mapBlocks);
782 } 787 }
783 788