diff options
Diffstat (limited to 'OpenSim/OpenSim.Region/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/OpenSim.Region/Scenes/Scene.cs | 148 |
1 files changed, 97 insertions, 51 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs index c0eebd4..eb942c2 100644 --- a/OpenSim/OpenSim.Region/Scenes/Scene.cs +++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs | |||
@@ -42,7 +42,7 @@ using OpenSim.Framework; | |||
42 | using OpenSim.Region.Scripting; | 42 | using OpenSim.Region.Scripting; |
43 | using OpenSim.Terrain; | 43 | using OpenSim.Terrain; |
44 | using OpenGrid.Framework.Communications; | 44 | using OpenGrid.Framework.Communications; |
45 | 45 | using OpenSim.Caches; | |
46 | 46 | ||
47 | namespace OpenSim.Region.Scenes | 47 | namespace OpenSim.Region.Scenes |
48 | { | 48 | { |
@@ -64,8 +64,9 @@ namespace OpenSim.Region.Scenes | |||
64 | private Mutex updateLock; | 64 | private Mutex updateLock; |
65 | public string m_datastore; | 65 | public string m_datastore; |
66 | protected AuthenticateSessionsBase authenticateHandler; | 66 | protected AuthenticateSessionsBase authenticateHandler; |
67 | protected RegionCommsHostBase regionCommsHost; | 67 | protected RegionCommsListener regionCommsHost; |
68 | protected CommunicationsManager commsManager; | 68 | protected CommunicationsManager commsManager; |
69 | |||
69 | 70 | ||
70 | public ParcelManager parcelManager; | 71 | public ParcelManager parcelManager; |
71 | public EstateManager estateManager; | 72 | public EstateManager estateManager; |
@@ -95,13 +96,14 @@ namespace OpenSim.Region.Scenes | |||
95 | /// <param name="clientThreads">Dictionary to contain client threads</param> | 96 | /// <param name="clientThreads">Dictionary to contain client threads</param> |
96 | /// <param name="regionHandle">Region Handle for this region</param> | 97 | /// <param name="regionHandle">Region Handle for this region</param> |
97 | /// <param name="regionName">Region Name for this region</param> | 98 | /// <param name="regionName">Region Name for this region</param> |
98 | public Scene(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan) | 99 | public Scene(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach) |
99 | { | 100 | { |
100 | try | 101 | try |
101 | { | 102 | { |
102 | updateLock = new Mutex(false); | 103 | updateLock = new Mutex(false); |
103 | this.authenticateHandler = authen; | 104 | this.authenticateHandler = authen; |
104 | this.commsManager = commsMan; | 105 | this.commsManager = commsMan; |
106 | this.assetCache = assetCach; | ||
105 | m_clientThreads = clientThreads; | 107 | m_clientThreads = clientThreads; |
106 | m_regInfo = regInfo; | 108 | m_regInfo = regInfo; |
107 | m_regionHandle = m_regInfo.RegionHandle; | 109 | m_regionHandle = m_regInfo.RegionHandle; |
@@ -507,8 +509,10 @@ namespace OpenSim.Region.Scenes | |||
507 | remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours); | 509 | remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours); |
508 | remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim); | 510 | remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim); |
509 | remoteClient.OnUpdatePrimPosition += new UpdatePrimVector(this.UpdatePrimPosition); | 511 | remoteClient.OnUpdatePrimPosition += new UpdatePrimVector(this.UpdatePrimPosition); |
510 | 512 | remoteClient.OnRequestMapBlocks += new RequestMapBlocks(this.RequestMapBlocks); | |
511 | /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); | 513 | remoteClient.OnTeleportLocationRequest += new TeleportLocationRequest(this.RequestTeleportLocation); |
514 | |||
515 | /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); | ||
512 | remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); | 516 | remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); |
513 | remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); | 517 | remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); |
514 | remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); | 518 | remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); |
@@ -562,51 +566,7 @@ namespace OpenSim.Region.Scenes | |||
562 | return; | 566 | return; |
563 | } | 567 | } |
564 | 568 | ||
565 | /// <summary> | 569 | |
566 | /// | ||
567 | /// </summary> | ||
568 | protected void InformClientOfNeighbours(IClientAPI remoteClient) | ||
569 | { | ||
570 | // Console.WriteLine("informing client of neighbouring regions"); | ||
571 | List<RegionInfo> neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); | ||
572 | |||
573 | //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); | ||
574 | if (neighbours != null) | ||
575 | { | ||
576 | for (int i = 0; i < neighbours.Count; i++) | ||
577 | { | ||
578 | // Console.WriteLine("sending neighbours data"); | ||
579 | AgentCircuitData agent = remoteClient.RequestClientInfo(); | ||
580 | agent.BaseFolder = LLUUID.Zero; | ||
581 | agent.InventoryFolder = LLUUID.Zero; | ||
582 | agent.startpos = new LLVector3(128, 128, 70); | ||
583 | agent.child = true; | ||
584 | this.commsManager.InterSims.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent); | ||
585 | remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort); | ||
586 | } | ||
587 | } | ||
588 | } | ||
589 | |||
590 | /// <summary> | ||
591 | /// | ||
592 | /// </summary> | ||
593 | /// <param name="regionHandle"></param> | ||
594 | /// <returns></returns> | ||
595 | public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) | ||
596 | { | ||
597 | return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); | ||
598 | } | ||
599 | |||
600 | /// <summary> | ||
601 | /// | ||
602 | /// </summary> | ||
603 | /// <param name="regionhandle"></param> | ||
604 | /// <param name="agentID"></param> | ||
605 | /// <param name="position"></param> | ||
606 | public void InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) | ||
607 | { | ||
608 | this.commsManager.InterSims.ExpectAvatarCrossing(regionhandle, agentID, position); | ||
609 | } | ||
610 | 570 | ||
611 | /// <summary> | 571 | /// <summary> |
612 | /// | 572 | /// |
@@ -725,9 +685,95 @@ namespace OpenSim.Region.Scenes | |||
725 | { | 685 | { |
726 | if (this.Avatars.ContainsKey(agentID)) | 686 | if (this.Avatars.ContainsKey(agentID)) |
727 | { | 687 | { |
728 | this.Avatars[agentID].Pos = position; | 688 | this.Avatars[agentID].UpGradeAvatar(position); |
689 | } | ||
690 | } | ||
691 | } | ||
692 | |||
693 | /// <summary> | ||
694 | /// | ||
695 | /// </summary> | ||
696 | protected void InformClientOfNeighbours(IClientAPI remoteClient) | ||
697 | { | ||
698 | // Console.WriteLine("informing client of neighbouring regions"); | ||
699 | List<RegionInfo> neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); | ||
700 | |||
701 | //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); | ||
702 | if (neighbours != null) | ||
703 | { | ||
704 | for (int i = 0; i < neighbours.Count; i++) | ||
705 | { | ||
706 | // Console.WriteLine("sending neighbours data"); | ||
707 | AgentCircuitData agent = remoteClient.RequestClientInfo(); | ||
708 | agent.BaseFolder = LLUUID.Zero; | ||
709 | agent.InventoryFolder = LLUUID.Zero; | ||
710 | agent.startpos = new LLVector3(128, 128, 70); | ||
711 | agent.child = true; | ||
712 | this.commsManager.InterRegion.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent); | ||
713 | remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort); | ||
714 | } | ||
715 | } | ||
716 | } | ||
717 | |||
718 | /// <summary> | ||
719 | /// | ||
720 | /// </summary> | ||
721 | /// <param name="regionHandle"></param> | ||
722 | /// <returns></returns> | ||
723 | public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) | ||
724 | { | ||
725 | return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); | ||
726 | } | ||
727 | |||
728 | /// <summary> | ||
729 | /// | ||
730 | /// </summary> | ||
731 | /// <param name="minX"></param> | ||
732 | /// <param name="minY"></param> | ||
733 | /// <param name="maxX"></param> | ||
734 | /// <param name="maxY"></param> | ||
735 | public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) | ||
736 | { | ||
737 | List<MapBlockData> mapBlocks; | ||
738 | mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | ||
739 | |||
740 | remoteClient.SendMapBlock(mapBlocks); | ||
741 | } | ||
742 | |||
743 | /// <summary> | ||
744 | /// | ||
745 | /// </summary> | ||
746 | /// <param name="remoteClient"></param> | ||
747 | /// <param name="RegionHandle"></param> | ||
748 | /// <param name="position"></param> | ||
749 | /// <param name="lookAt"></param> | ||
750 | /// <param name="flags"></param> | ||
751 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) | ||
752 | { | ||
753 | if (regionHandle == this.m_regionHandle) | ||
754 | { | ||
755 | if (this.Avatars.ContainsKey(remoteClient.AgentId)) | ||
756 | { | ||
757 | remoteClient.SendTeleportLocationStart(); | ||
758 | remoteClient.SendLocalTeleport(position, lookAt, flags); | ||
759 | this.Avatars[remoteClient.AgentId].Teleport(position); | ||
729 | } | 760 | } |
730 | } | 761 | } |
762 | else | ||
763 | { | ||
764 | remoteClient.SendTeleportCancel(); | ||
765 | } | ||
766 | } | ||
767 | |||
768 | /// <summary> | ||
769 | /// | ||
770 | /// </summary> | ||
771 | /// <param name="regionhandle"></param> | ||
772 | /// <param name="agentID"></param> | ||
773 | /// <param name="position"></param> | ||
774 | public void InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) | ||
775 | { | ||
776 | this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); | ||
731 | } | 777 | } |
732 | 778 | ||
733 | #endregion | 779 | #endregion |