From 016a648a3097b452f63b82af533e92c549ce0ca6 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Fri, 4 Sep 2009 20:19:34 -0400 Subject: * 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. --- .../CoreModules/World/Land/RegionCombinerModule.cs | 248 ++++++++++++++++----- 1 file changed, 193 insertions(+), 55 deletions(-) (limited to 'OpenSim/Region/CoreModules') 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; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -71,6 +72,18 @@ namespace OpenSim.Region.CoreModules.World.Land public void AddRegion(Scene scene) { + + + } + + public void RemoveRegion(Scene scene) + { + + + } + + public void RegionLoaded(Scene scene) + { if (!enabledYN) return; @@ -295,8 +308,8 @@ namespace OpenSim.Region.CoreModules.World.Land m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", conn.RegionScene.RegionInfo.RegionName, regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); - - + + scene.BordersLocked = true; conn.RegionScene.BordersLocked = true; @@ -325,9 +338,11 @@ namespace OpenSim.Region.CoreModules.World.Land // scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); - + conn.RegionScene.BordersLocked = false; scene.BordersLocked = false; + if (conn.ClientEventForwarder != null) + conn.ClientEventForwarder.AddSceneToEventForwarding(scene); connectedYN = true; break; } @@ -367,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.Land m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", conn.RegionScene.RegionInfo.RegionName, regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); - conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents); + conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); lock (conn.RegionScene.NorthBorders) @@ -386,7 +401,8 @@ namespace OpenSim.Region.CoreModules.World.Land scene.BordersLocked = false; conn.RegionScene.BordersLocked = false; - + if (conn.ClientEventForwarder != null) + conn.ClientEventForwarder.AddSceneToEventForwarding(scene); connectedYN = true; break; } @@ -424,52 +440,52 @@ namespace OpenSim.Region.CoreModules.World.Land m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", conn.RegionScene.RegionInfo.RegionName, regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); - + conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); lock (conn.RegionScene.NorthBorders) - if (conn.RegionScene.NorthBorders.Count == 1)// && 2) - { - //compound border - // already locked above - conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; + if (conn.RegionScene.NorthBorders.Count == 1)// && 2) + { + //compound border + // already locked above + conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; - lock (conn.RegionScene.EastBorders) - conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; - lock (conn.RegionScene.WestBorders) - conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; + lock (conn.RegionScene.EastBorders) + conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; + lock (conn.RegionScene.WestBorders) + conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; - - } + + } lock (scene.SouthBorders) scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south - + lock (conn.RegionScene.EastBorders) - if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) - { + if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) + { - conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; - lock (conn.RegionScene.NorthBorders) - conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; - lock (conn.RegionScene.SouthBorders) - conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; + conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; + lock (conn.RegionScene.NorthBorders) + conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; + lock (conn.RegionScene.SouthBorders) + conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; - - } + + } lock (scene.WestBorders) scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West -/* - else - { - conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; - conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; - conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; - scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south - } -*/ - + /* + else + { + conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; + conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; + conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; + scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south + } + */ + // Reset Terrain.. since terrain normally loads first. //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); @@ -478,6 +494,9 @@ namespace OpenSim.Region.CoreModules.World.Land scene.BordersLocked = false; conn.RegionScene.BordersLocked = false; + if (conn.ClientEventForwarder != null) + conn.ClientEventForwarder.AddSceneToEventForwarding(scene); + connectedYN = true; //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); @@ -495,7 +514,7 @@ namespace OpenSim.Region.CoreModules.World.Land rdata.RegionScene = scene; regionConnections.RegionLandChannel = scene.LandChannel; - RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata,scene.LandChannel,regionConnections.ConnectedRegions); + RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, regionConnections.ConnectedRegions); scene.LandChannel = lnd; lock (m_regions) { @@ -504,24 +523,14 @@ namespace OpenSim.Region.CoreModules.World.Land ForwardPermissionRequests(regionConnections, r.RegionScene); } } - - m_regions.Add(scene.RegionInfo.originRegionID,regionConnections); + + regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections); + + m_regions.Add(scene.RegionInfo.originRegionID, regionConnections); } - + } AdjustLargeRegionBounds(); - - } - - public void RemoveRegion(Scene scene) - { - - - } - - public void RegionLoaded(Scene scene) - { - } public void PostInitialise() @@ -733,6 +742,7 @@ namespace OpenSim.Region.CoreModules.World.Land public int YEnd; public List ConnectedRegions; public RegionCombinerPermissionModule PermissionModule; + public RegionCombinerClientEventForwarder ClientEventForwarder; public void UpdateExtents(Vector3 extents) { XEnd = (int)extents.X; @@ -790,7 +800,7 @@ namespace OpenSim.Region.CoreModules.World.Land else { int offsetX = (x / (int)Constants.RegionSize); - int offsetY = (x / (int)Constants.RegionSize); + int offsetY = (y / (int)Constants.RegionSize); offsetX *= (int)Constants.RegionSize; offsetY *= (int)Constants.RegionSize; @@ -823,7 +833,7 @@ namespace OpenSim.Region.CoreModules.World.Land else { int offsetX = (int)(x/(int) Constants.RegionSize); - int offsetY = (int)(x/(int) Constants.RegionSize); + int offsetY = (int)(y/(int) Constants.RegionSize); offsetX *= (int) Constants.RegionSize; offsetY *= (int) Constants.RegionSize; @@ -886,6 +896,7 @@ namespace OpenSim.Region.CoreModules.World.Land m_rootScene = RootScene; } + #region Permission Override public bool BypassPermissions() { return m_rootScene.Permissions.BypassPermissions(); @@ -1110,5 +1121,132 @@ namespace OpenSim.Region.CoreModules.World.Land { return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist); } + #endregion + } + + public class RegionCombinerClientEventForwarder + { + private Scene m_rootScene; + private Dictionary m_virtScene = new Dictionary(); + private Dictionary m_forwarders = new Dictionary(); + public RegionCombinerClientEventForwarder(RegionConnections rootScene) + { + m_rootScene = rootScene.RegionScene; + + + } + + public void AddSceneToEventForwarding( Scene virtualScene ) + { + lock (m_virtScene) + { + if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID)) + { + m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene; + } + else + { + m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene); + } + } + + lock (m_forwarders) + { + // TODO: Fix this to unregister if this happens + if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID)) + m_forwarders.Remove(virtualScene.RegionInfo.originRegionID); + + RegionCombinerModuleIndividualForwarder forwarder = + new RegionCombinerModuleIndividualForwarder(m_rootScene, virtualScene); + m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder); + + virtualScene.EventManager.OnNewClient += forwarder.ClientConnect; + virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed; + } + } + + public void RemoveSceneFromEventForwarding (Scene virtualScene) + { + lock (m_forwarders) + { + RegionCombinerModuleIndividualForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID]; + virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect; + virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed; + m_forwarders.Remove(virtualScene.RegionInfo.originRegionID); + } + lock (m_virtScene) + { + if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID)) + { + m_virtScene.Remove(virtualScene.RegionInfo.originRegionID); + } + } + } + } + + public class RegionCombinerModuleIndividualForwarder + { + private Scene m_rootScene; + private Scene m_virtScene; + public RegionCombinerModuleIndividualForwarder(Scene rootScene, Scene virtScene) + { + m_rootScene = rootScene; + m_virtScene = virtScene; + } + + public void ClientConnect(IClientAPI client) + { + + m_virtScene.UnSubscribeToClientPrimEvents(client); + m_virtScene.UnSubscribeToClientPrimRezEvents(client); + m_virtScene.UnSubscribeToClientInventoryEvents(client); + m_virtScene.UnSubscribeToClientAttachmentEvents(client); + m_virtScene.UnSubscribeToClientTeleportEvents(client); + m_virtScene.UnSubscribeToClientScriptEvents(client); + m_virtScene.UnSubscribeToClientGodEvents(client); + m_virtScene.UnSubscribeToClientNetworkEvents(client); + + m_rootScene.SubscribeToClientPrimEvents(client); + client.OnAddPrim += LocalAddNewPrim; + client.OnRezObject += LocalRezObject; + m_rootScene.SubscribeToClientInventoryEvents(client); + m_rootScene.SubscribeToClientAttachmentEvents(client); + m_rootScene.SubscribeToClientTeleportEvents(client); + m_rootScene.SubscribeToClientScriptEvents(client); + m_rootScene.SubscribeToClientGodEvents(client); + m_rootScene.SubscribeToClientNetworkEvents(client); + } + public void ClientClosed(UUID clientid, Scene scene) + { + + } + + + private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, UUID fromtaskid) + { + int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; + int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; + rayend.X += differenceX * (int)Constants.RegionSize; + rayend.Y += differenceY * (int)Constants.RegionSize; + raystart.X += differenceX * (int)Constants.RegionSize; + raystart.Y += differenceY * (int)Constants.RegionSize; + + m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast, + rayendisintersection, rezselected, removeitem, fromtaskid); + + } + + private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, byte rayendisintersection) + { + int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; + int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; + rayend.X += differenceX * (int)Constants.RegionSize; + rayend.Y += differenceY * (int)Constants.RegionSize; + raystart.X += differenceX * (int)Constants.RegionSize; + raystart.Y += differenceY * (int)Constants.RegionSize; + m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid, + rayendisintersection); + + } } } -- cgit v1.1 From c48ec978179ade68cf816e3134e11ddde71f8bfc Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2009 22:30:30 -0700 Subject: Fixed some long-standing issues with appearance in HG1. --- .../Hypergrid/HGStandaloneLoginModule.cs | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index a5894c6..613dbe9 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs @@ -34,6 +34,7 @@ using System.Text.RegularExpressions; using log4net; using Nini.Config; using OpenMetaverse; +using Nwc.XmlRpc; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Services; @@ -115,6 +116,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); httpServer.AddXmlRPCHandler("check_auth_session", m_loginService.XmlRPCCheckAuthSession, false); + httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance); + httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance); } } @@ -256,5 +259,64 @@ namespace OpenSim.Region.CoreModules.Hypergrid scene = null; return false; } + + public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + AvatarAppearance appearance; + Hashtable responseData; + if (requestData.Contains("owner")) + { + appearance = m_firstScene.CommsManager.AvatarService.GetUserAppearance(new UUID((string)requestData["owner"])); + if (appearance == null) + { + responseData = new Hashtable(); + responseData["error_type"] = "no appearance"; + responseData["error_desc"] = "There was no appearance found for this avatar"; + } + else + { + responseData = appearance.ToHashTable(); + } + } + else + { + responseData = new Hashtable(); + responseData["error_type"] = "unknown_avatar"; + responseData["error_desc"] = "The avatar appearance requested is not in the database"; + } + + response.Value = responseData; + return response; + } + + public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData; + if (requestData.Contains("owner")) + { + AvatarAppearance appearance = new AvatarAppearance(requestData); + + // TODO: Sometime in the future we may have a database layer that is capable of updating appearance when + // the TextureEntry is null. When that happens, this check can be removed + if (appearance.Texture != null) + m_firstScene.CommsManager.AvatarService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); + + responseData = new Hashtable(); + responseData["returnString"] = "TRUE"; + } + else + { + responseData = new Hashtable(); + responseData["error_type"] = "unknown_avatar"; + responseData["error_desc"] = "The avatar appearance requested is not in the database"; + } + response.Value = responseData; + return response; + } } + } -- cgit v1.1 From 855fb58c9650086122b76c586c4a4a408343143f Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 5 Sep 2009 02:58:35 -0400 Subject: * Moves ScenePresence SendCourseLocations to a delegate and provide a method to replace the delegate * RegionCombinerModule replaces this delegate and distributes the CoarseLocationUpdates through the client connection in the region where the user would be if it was a separate region. * Fixes Mini Map display on combined regions. --- .../CoreModules/World/Land/RegionCombinerModule.cs | 171 ++++++++++++++++++++- 1 file changed, 165 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs index 91d736b..9da869c 100644 --- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs @@ -514,7 +514,8 @@ namespace OpenSim.Region.CoreModules.World.Land rdata.RegionScene = scene; regionConnections.RegionLandChannel = scene.LandChannel; - RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, regionConnections.ConnectedRegions); + RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, + regionConnections.ConnectedRegions); scene.LandChannel = lnd; lock (m_regions) { @@ -525,19 +526,164 @@ namespace OpenSim.Region.CoreModules.World.Land } regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections); - + scene.EventManager.OnNewPresence += SetCourseLocationDelegate; m_regions.Add(scene.RegionInfo.originRegionID, regionConnections); + } } AdjustLargeRegionBounds(); } + private void SetCourseLocationDelegate(ScenePresence presence) + { + presence.SetSendCourseLocationMethod(SendCourseLocationUpdates); + } + + private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence) + { + RegionConnections connectiondata = null; + lock (m_regions) + { + if (m_regions.ContainsKey(sceneId)) + connectiondata = m_regions[sceneId]; + else + return; + } + + List avatars = connectiondata.RegionScene.GetAvatars(); + List CoarseLocations = new List(); + List AvatarUUIDs = new List(); + for (int i = 0; i < avatars.Count; i++) + { + if (avatars[i].UUID != presence.UUID) + { + if (avatars[i].ParentID != 0) + { + // sitting avatar + SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID); + if (sop != null) + { + CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition); + AvatarUUIDs.Add(avatars[i].UUID); + } + else + { + // we can't find the parent.. ! arg! + CoarseLocations.Add(avatars[i].AbsolutePosition); + AvatarUUIDs.Add(avatars[i].UUID); + } + } + else + { + CoarseLocations.Add(avatars[i].AbsolutePosition); + AvatarUUIDs.Add(avatars[i].UUID); + } + } + } + DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); + } + + private void DistributeCourseLocationUpdates(List locations, List uuids, + RegionConnections connectiondata, ScenePresence rootPresence) + { + RegionData[] rdata = connectiondata.ConnectedRegions.ToArray(); + List clients = new List(); + Dictionary updates = new Dictionary(); + + + // Root Region entry + RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct(); + rootupdatedata.Locations = new List(); + rootupdatedata.Uuids = new List(); + rootupdatedata.Offset = Vector2.Zero; + + rootupdatedata.UserAPI = rootPresence.ControllingClient; + + if (rootupdatedata.UserAPI != null) + updates.Add(Vector2.Zero, rootupdatedata); + + //Each Region needs an entry or we will end up with dead minimap dots + foreach (RegionData regiondata in rdata) + { + Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y); + RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct(); + updatedata.Locations = new List(); + updatedata.Uuids = new List(); + updatedata.Offset = offset; + + if (offset == Vector2.Zero) + updatedata.UserAPI = rootPresence.ControllingClient; + else + updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata); + + if (updatedata.UserAPI != null) + updates.Add(offset, updatedata); + } + + // go over the locations and assign them to an IClientAPI + for (int i = 0; i < locations.Count;i++ ) + //{locations[i]/(int) Constants.RegionSize; + { + Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize, + (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z); + Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize, + pPosition.Y*(int) Constants.RegionSize); + + if (!updates.ContainsKey(offset)) + { + // This shouldn't happen + RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct(); + updatedata.Locations = new List(); + updatedata.Uuids = new List(); + updatedata.Offset = offset; + + if (offset == Vector2.Zero) + updatedata.UserAPI = rootPresence.ControllingClient; + else + updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata); + + updates.Add(offset,updatedata); + + } + + updates[offset].Locations.Add(locations[i]); + updates[offset].Uuids.Add(uuids[i]); + + } + + // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is + foreach (Vector2 offset in updates.Keys) + { + if (updates[offset].UserAPI != null) + { + updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations); + } + } + + } + + private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata) + { + IClientAPI returnclient = null; + foreach (RegionData r in rdata) + { + if (r.Offset.X == offset.X && r.Offset.Y == offset.Y) + { + return r.RegionScene.SceneGraph.GetControllingClient(uUID); + } + } + + return returnclient; + } + public void PostInitialise() { } + + public void UnCombineRegion(RegionData rdata) { lock (m_regions) @@ -758,6 +904,13 @@ namespace OpenSim.Region.CoreModules.World.Land public Vector3 Offset; } + struct RegionCourseLocationStruct + { + public List Locations; + public List Uuids; + public IClientAPI UserAPI; + public Vector2 Offset; + } public class RegionCombinerLargeLandChannel : ILandChannel { @@ -769,7 +922,8 @@ namespace OpenSim.Region.CoreModules.World.Land #region ILandChannel Members - public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,List regionConnections) + public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel, + List regionConnections) { RegData = regData; RootRegionLandChannel = rootRegionLandChannel; @@ -1128,7 +1282,8 @@ namespace OpenSim.Region.CoreModules.World.Land { private Scene m_rootScene; private Dictionary m_virtScene = new Dictionary(); - private Dictionary m_forwarders = new Dictionary(); + private Dictionary m_forwarders = new Dictionary(); public RegionCombinerClientEventForwarder(RegionConnections rootScene) { m_rootScene = rootScene.RegionScene; @@ -1222,7 +1377,9 @@ namespace OpenSim.Region.CoreModules.World.Land } - private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, UUID fromtaskid) + private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, + UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, + UUID fromtaskid) { int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; @@ -1236,7 +1393,9 @@ namespace OpenSim.Region.CoreModules.World.Land } - private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, byte rayendisintersection) + private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, + PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, + byte rayendisintersection) { int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; -- cgit v1.1 From 2a8f66b221e93fb2d693c1c273c2dee85439f835 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 6 Sep 2009 04:28:42 +0100 Subject: Revising the user account data interfaces. No user functionality yet --- .../ServiceConnectorsOut/User/LocalUserServiceConnector.cs | 6 +++--- .../ServiceConnectorsOut/User/RemoteUserServiceConnector.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs index fcd0304..cca5bb4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private IUserAccountDataService m_UserService; + private IUserAccountService m_UserService; private bool m_Enabled = false; @@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User Object[] args = new Object[] { source }; m_UserService = - ServerUtils.LoadPlugin(serviceDll, + ServerUtils.LoadPlugin(serviceDll, args); if (m_UserService == null) @@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User if (!m_Enabled) return; - scene.RegisterModuleInterface(m_UserService); + scene.RegisterModuleInterface(m_UserService); } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs index a2b854b..cef9129 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs @@ -37,7 +37,7 @@ using OpenSim.Services.Connectors; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User { public class RemoteUserServicesConnector : UserServicesConnector, - ISharedRegionModule, IUserAccountDataService + ISharedRegionModule, IUserAccountService { private static readonly ILog m_log = LogManager.GetLogger( @@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User if (!m_Enabled) return; - scene.RegisterModuleInterface(this); + scene.RegisterModuleInterface(this); } public void RemoveRegion(Scene scene) -- cgit v1.1