diff options
author | UbitUmarov | 2016-07-28 08:25:04 +0100 |
---|---|---|
committer | UbitUmarov | 2016-07-28 08:25:04 +0100 |
commit | 3cf8a58f9d288b3e444971489564b744ac1b625c (patch) | |
tree | 7f11a5358d6d32327b0195028d2fa672b3b2218d /OpenSim/Region | |
parent | Merge branch 'master' into httptests (diff) | |
parent | revert adding a new IM parameter ( commit bf604c85c66dd3bed06e3103cdf210ede0... (diff) | |
download | opensim-SC-3cf8a58f9d288b3e444971489564b744ac1b625c.zip opensim-SC-3cf8a58f9d288b3e444971489564b744ac1b625c.tar.gz opensim-SC-3cf8a58f9d288b3e444971489564b744ac1b625c.tar.bz2 opensim-SC-3cf8a58f9d288b3e444971489564b744ac1b625c.tar.xz |
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region')
20 files changed, 67 insertions, 2499 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0bb5dc6..26fc85e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -961,11 +961,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
961 | = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); | 961 | = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); |
962 | 962 | ||
963 | msg.AgentData.AgentID = new UUID(im.fromAgentID); | 963 | msg.AgentData.AgentID = new UUID(im.fromAgentID); |
964 | msg.AgentData.SessionID = new UUID(im.imSessionID); | 964 | msg.AgentData.SessionID = UUID.Zero; |
965 | msg.MessageBlock.FromAgentName = Util.StringToBytes256(im.fromAgentName); | 965 | msg.MessageBlock.FromAgentName = Util.StringToBytes256(im.fromAgentName); |
966 | msg.MessageBlock.Dialog = im.dialog; | 966 | msg.MessageBlock.Dialog = im.dialog; |
967 | msg.MessageBlock.FromGroup = im.fromGroup; | 967 | msg.MessageBlock.FromGroup = im.fromGroup; |
968 | msg.MessageBlock.ID = new UUID(im.ID); | 968 | // this is odd |
969 | if (im.imSessionID == UUID.Zero.Guid) | ||
970 | msg.MessageBlock.ID = new UUID(im.fromAgentID) ^ new UUID(im.toAgentID); | ||
971 | else | ||
972 | msg.MessageBlock.ID = new UUID(im.imSessionID); | ||
969 | msg.MessageBlock.Offline = im.offline; | 973 | msg.MessageBlock.Offline = im.offline; |
970 | msg.MessageBlock.ParentEstateID = im.ParentEstateID; | 974 | msg.MessageBlock.ParentEstateID = im.ParentEstateID; |
971 | msg.MessageBlock.Position = im.Position; | 975 | msg.MessageBlock.Position = im.Position; |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 1366103..6b120fb 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -216,7 +216,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
216 | UUID fromAgentID = UUID.Zero; | 216 | UUID fromAgentID = UUID.Zero; |
217 | UUID toAgentID = UUID.Zero; | 217 | UUID toAgentID = UUID.Zero; |
218 | UUID imSessionID = UUID.Zero; | 218 | UUID imSessionID = UUID.Zero; |
219 | UUID imID = UUID.Zero; | ||
220 | uint timestamp = 0; | 219 | uint timestamp = 0; |
221 | string fromAgentName = ""; | 220 | string fromAgentName = ""; |
222 | string message = ""; | 221 | string message = ""; |
@@ -263,7 +262,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
263 | UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); | 262 | UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); |
264 | UUID.TryParse((string)requestData["im_session_id"], out imSessionID); | 263 | UUID.TryParse((string)requestData["im_session_id"], out imSessionID); |
265 | UUID.TryParse((string)requestData["region_id"], out RegionID); | 264 | UUID.TryParse((string)requestData["region_id"], out RegionID); |
266 | UUID.TryParse((string)requestData["id"], out imID); | ||
267 | 265 | ||
268 | try | 266 | try |
269 | { | 267 | { |
@@ -391,8 +389,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
391 | gim.ParentEstateID = ParentEstateID; | 389 | gim.ParentEstateID = ParentEstateID; |
392 | gim.Position = Position; | 390 | gim.Position = Position; |
393 | gim.binaryBucket = binaryBucket; | 391 | gim.binaryBucket = binaryBucket; |
394 | gim.ID = imID.Guid; | ||
395 | |||
396 | 392 | ||
397 | // Trigger the Instant message in the scene. | 393 | // Trigger the Instant message in the scene. |
398 | foreach (Scene scene in m_Scenes) | 394 | foreach (Scene scene in m_Scenes) |
@@ -702,8 +698,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
702 | gim["from_agent_session"] = UUID.Zero.ToString(); | 698 | gim["from_agent_session"] = UUID.Zero.ToString(); |
703 | gim["to_agent_id"] = msg.toAgentID.ToString(); | 699 | gim["to_agent_id"] = msg.toAgentID.ToString(); |
704 | gim["im_session_id"] = msg.imSessionID.ToString(); | 700 | gim["im_session_id"] = msg.imSessionID.ToString(); |
705 | if(msg.ID != Guid.Empty) | ||
706 | gim["id"] = msg.ID.ToString(); | ||
707 | gim["timestamp"] = msg.timestamp.ToString(); | 701 | gim["timestamp"] = msg.timestamp.ToString(); |
708 | gim["from_agent_name"] = msg.fromAgentName; | 702 | gim["from_agent_name"] = msg.fromAgentName; |
709 | gim["message"] = msg.message; | 703 | gim["message"] = msg.message; |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index fbb99b0..efc714f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -173,7 +173,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
173 | private BannedRegionCache m_bannedRegionCache = new BannedRegionCache(); | 173 | private BannedRegionCache m_bannedRegionCache = new BannedRegionCache(); |
174 | 174 | ||
175 | private IEventQueue m_eqModule; | 175 | private IEventQueue m_eqModule; |
176 | private IRegionCombinerModule m_regionCombinerModule; | ||
177 | 176 | ||
178 | #region ISharedRegionModule | 177 | #region ISharedRegionModule |
179 | 178 | ||
@@ -339,7 +338,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
339 | return; | 338 | return; |
340 | 339 | ||
341 | m_eqModule = Scene.RequestModuleInterface<IEventQueue>(); | 340 | m_eqModule = Scene.RequestModuleInterface<IEventQueue>(); |
342 | m_regionCombinerModule = Scene.RequestModuleInterface<IRegionCombinerModule>(); | ||
343 | } | 341 | } |
344 | 342 | ||
345 | #endregion | 343 | #endregion |
@@ -1341,18 +1339,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1341 | protected virtual bool NeedsNewAgent(float viewdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, | 1339 | protected virtual bool NeedsNewAgent(float viewdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, |
1342 | int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) | 1340 | int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) |
1343 | { | 1341 | { |
1344 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) | ||
1345 | { | ||
1346 | Vector2 swCorner, neCorner; | ||
1347 | GetMegaregionViewRange(out swCorner, out neCorner); | ||
1348 | |||
1349 | m_log.DebugFormat( | ||
1350 | "[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1} to {2} with new agent check for {3},{4}", | ||
1351 | Scene.Name, swCorner, neCorner, newRegionX, newRegionY); | ||
1352 | |||
1353 | return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y); | ||
1354 | } | ||
1355 | |||
1356 | return Util.IsOutsideView(viewdist, oldRegionX, newRegionX, oldRegionY, newRegionY, | 1342 | return Util.IsOutsideView(viewdist, oldRegionX, newRegionX, oldRegionY, newRegionY, |
1357 | oldsizeX, oldsizeY, newsizeX, newsizeY); | 1343 | oldsizeX, oldsizeY, newsizeX, newsizeY); |
1358 | } | 1344 | } |
@@ -2205,7 +2191,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2205 | #endregion // NotFoundLocationCache class | 2191 | #endregion // NotFoundLocationCache class |
2206 | private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); | 2192 | private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); |
2207 | 2193 | ||
2208 | // needed for current OSG or old grid code | 2194 | // needed for old grid code |
2209 | 2195 | ||
2210 | protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) | 2196 | protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) |
2211 | { | 2197 | { |
@@ -2376,29 +2362,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2376 | } | 2362 | } |
2377 | 2363 | ||
2378 | /// <summary> | 2364 | /// <summary> |
2379 | /// Gets the range considered in view of this megaregion (assuming this is a megaregion). | ||
2380 | /// </summary> | ||
2381 | /// <remarks>Expressed in 256m units</remarks> | ||
2382 | /// <param name='swCorner'></param> | ||
2383 | /// <param name='neCorner'></param> | ||
2384 | private void GetMegaregionViewRange(out Vector2 swCorner, out Vector2 neCorner) | ||
2385 | { | ||
2386 | Vector2 extent = Vector2.Zero; | ||
2387 | |||
2388 | if (m_regionCombinerModule != null) | ||
2389 | { | ||
2390 | Vector2 megaRegionSize = m_regionCombinerModule.GetSizeOfMegaregion(Scene.RegionInfo.RegionID); | ||
2391 | extent.X = (float)Util.WorldToRegionLoc((uint)megaRegionSize.X); | ||
2392 | extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y); | ||
2393 | } | ||
2394 | |||
2395 | swCorner.X = Scene.RegionInfo.RegionLocX - 1; | ||
2396 | swCorner.Y = Scene.RegionInfo.RegionLocY - 1; | ||
2397 | neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; | ||
2398 | neCorner.Y = Scene.RegionInfo.RegionLocY + extent.Y; | ||
2399 | } | ||
2400 | |||
2401 | /// <summary> | ||
2402 | /// Return the list of online regions that are considered to be neighbours to the given scene. | 2365 | /// Return the list of online regions that are considered to be neighbours to the given scene. |
2403 | /// </summary> | 2366 | /// </summary> |
2404 | /// <param name="avatar"></param> | 2367 | /// <param name="avatar"></param> |
@@ -2411,46 +2374,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2411 | RegionInfo m_regionInfo = pScene.RegionInfo; | 2374 | RegionInfo m_regionInfo = pScene.RegionInfo; |
2412 | List<GridRegion> neighbours; | 2375 | List<GridRegion> neighbours; |
2413 | 2376 | ||
2414 | // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't | 2377 | uint dd = (uint)avatar.RegionViewDistance; |
2415 | // clear what should be done with a "far view" given that megaregions already extended the | ||
2416 | // view to include everything in the megaregion | ||
2417 | if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) | ||
2418 | { | ||
2419 | uint dd = (uint)avatar.RegionViewDistance; | ||
2420 | |||
2421 | // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors | ||
2422 | uint ddX = Math.Max(dd, Constants.RegionSize); | ||
2423 | uint ddY = Math.Max(dd, Constants.RegionSize); | ||
2424 | 2378 | ||
2425 | ddX--; | 2379 | // until avatar movement updates client connections, we need to seend at least this current region imediate neighbors |
2426 | ddY--; | 2380 | uint ddX = Math.Max(dd, Constants.RegionSize); |
2381 | uint ddY = Math.Max(dd, Constants.RegionSize); | ||
2427 | 2382 | ||
2428 | // reference to region edges. Should be avatar position | 2383 | ddX--; |
2429 | uint startX = Util.RegionToWorldLoc(pRegionLocX); | 2384 | ddY--; |
2430 | uint endX = startX + m_regionInfo.RegionSizeX; | ||
2431 | uint startY = Util.RegionToWorldLoc(pRegionLocY); | ||
2432 | uint endY = startY + m_regionInfo.RegionSizeY; | ||
2433 | 2385 | ||
2434 | startX -= ddX; | 2386 | // reference to region edges. Should be avatar position |
2435 | startY -= ddY; | 2387 | uint startX = Util.RegionToWorldLoc(pRegionLocX); |
2436 | endX += ddX; | 2388 | uint endX = startX + m_regionInfo.RegionSizeX; |
2437 | endY += ddY; | 2389 | uint startY = Util.RegionToWorldLoc(pRegionLocY); |
2390 | uint endY = startY + m_regionInfo.RegionSizeY; | ||
2438 | 2391 | ||
2439 | neighbours | 2392 | startX -= ddX; |
2440 | = avatar.Scene.GridService.GetRegionRange( | 2393 | startY -= ddY; |
2441 | m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); | 2394 | endX += ddX; |
2442 | } | 2395 | endY += ddY; |
2443 | else | ||
2444 | { | ||
2445 | Vector2 swCorner, neCorner; | ||
2446 | GetMegaregionViewRange(out swCorner, out neCorner); | ||
2447 | 2396 | ||
2448 | neighbours | 2397 | neighbours |
2449 | = pScene.GridService.GetRegionRange( | 2398 | = avatar.Scene.GridService.GetRegionRange( |
2450 | m_regionInfo.ScopeID, | 2399 | m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); |
2451 | (int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X), | ||
2452 | (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y)); | ||
2453 | } | ||
2454 | 2400 | ||
2455 | // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). | 2401 | // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). |
2456 | neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID ); | 2402 | neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID ); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index cb2c7f1..6c8f37b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs | |||
@@ -522,22 +522,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
522 | 522 | ||
523 | protected static void WriteRegionInfo(Scene scene, XmlTextWriter xtw) | 523 | protected static void WriteRegionInfo(Scene scene, XmlTextWriter xtw) |
524 | { | 524 | { |
525 | bool isMegaregion; | ||
526 | Vector2 size; | 525 | Vector2 size; |
527 | 526 | ||
528 | IRegionCombinerModule rcMod = scene.RequestModuleInterface<IRegionCombinerModule>(); | 527 | size = new Vector2((float)scene.RegionInfo.RegionSizeX, (float)scene.RegionInfo.RegionSizeY); |
529 | |||
530 | if (rcMod != null) | ||
531 | isMegaregion = rcMod.IsRootForMegaregion(scene.RegionInfo.RegionID); | ||
532 | else | ||
533 | isMegaregion = false; | ||
534 | |||
535 | if (isMegaregion) | ||
536 | size = rcMod.GetSizeOfMegaregion(scene.RegionInfo.RegionID); | ||
537 | else | ||
538 | size = new Vector2((float)scene.RegionInfo.RegionSizeX, (float)scene.RegionInfo.RegionSizeY); | ||
539 | 528 | ||
540 | xtw.WriteElementString("is_megaregion", isMegaregion.ToString()); | ||
541 | xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); | 529 | xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); |
542 | } | 530 | } |
543 | 531 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index ca94f42..150d4ec 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -53,7 +53,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
53 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 54 | ||
55 | public Scene Scene { get; private set; } | 55 | public Scene Scene { get; private set; } |
56 | public IRegionCombinerModule RegionCombinerModule { get; private set; } | ||
57 | 56 | ||
58 | /// <value> | 57 | /// <value> |
59 | /// The file used to load and save an opensimulator archive if no filename has been specified | 58 | /// The file used to load and save an opensimulator archive if no filename has been specified |
@@ -85,7 +84,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
85 | 84 | ||
86 | public void RegionLoaded(Scene scene) | 85 | public void RegionLoaded(Scene scene) |
87 | { | 86 | { |
88 | RegionCombinerModule = scene.RequestModuleInterface<IRegionCombinerModule>(); | ||
89 | } | 87 | } |
90 | 88 | ||
91 | public void RemoveRegion(Scene scene) | 89 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs deleted file mode 100644 index c6f531e..0000000 --- a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Linq; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | using System.IO; | ||
34 | using OpenMetaverse; | ||
35 | |||
36 | namespace OpenSim.Region.Framework.Interfaces | ||
37 | { | ||
38 | public interface IRegionCombinerModule | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Does the given id belong to the root region of a megaregion? | ||
42 | /// </summary> | ||
43 | bool IsRootForMegaregion(UUID regionId); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Gets the size of megaregion. | ||
47 | /// </summary> | ||
48 | /// <remarks> | ||
49 | /// Returns size in meters. | ||
50 | /// Do not rely on this method remaining the same - this area is actively under development. | ||
51 | /// </remarks> | ||
52 | /// <param name="sceneId"> | ||
53 | /// The id of the root region for a megaregion. | ||
54 | /// This may change in the future to allow any region id that makes up a megaregion. | ||
55 | /// Currently, will throw an exception if this does not match a root region. | ||
56 | /// </param> | ||
57 | Vector2 GetSizeOfMegaregion(UUID regionId); | ||
58 | |||
59 | /// <summary> | ||
60 | /// Tests to see of position (relative to the region) is within the megaregion | ||
61 | /// </summary> | ||
62 | bool PositionIsInMegaregion(UUID currentRegion, int xx, int yy); | ||
63 | } | ||
64 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs deleted file mode 100644 index 08c0c31..0000000 --- a/OpenSim/Region/Framework/Scenes/Border.cs +++ /dev/null | |||
@@ -1,148 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.Framework.Scenes | ||
34 | { | ||
35 | public class Border | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Line perpendicular to the Direction Cardinal. Z value is the | ||
39 | /// </summary> | ||
40 | public Vector3 BorderLine = Vector3.Zero; | ||
41 | |||
42 | /// <summary> | ||
43 | /// Direction cardinal of the border, think, 'which side of the region this is'. EX South border: Cardinal.S | ||
44 | /// </summary> | ||
45 | public Cardinals CrossDirection = Cardinals.N; | ||
46 | public uint TriggerRegionX = 0; | ||
47 | public uint TriggerRegionY = 0; | ||
48 | |||
49 | public Border() | ||
50 | { | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Creates a Border. The line is perpendicular to the direction cardinal. | ||
55 | /// IE: if the direction cardinal is South, the line is West->East | ||
56 | /// </summary> | ||
57 | /// <param name="lineStart">The starting point for the line of the border. | ||
58 | /// The position of an object must be greater then this for this border to trigger. | ||
59 | /// Perpendicular to the direction cardinal</param> | ||
60 | /// <param name="lineEnd">The ending point for the line of the border. | ||
61 | /// The position of an object must be less then this for this border to trigger. | ||
62 | /// Perpendicular to the direction cardinal</param> | ||
63 | /// <param name="triggerCoordinate">The position that triggers border the border | ||
64 | /// cross parallel to the direction cardinal. On the North cardinal, this | ||
65 | /// normally 256. On the South cardinal, it's normally 0. Any position past this | ||
66 | /// point on the cartesian coordinate will trigger the border cross as long as it | ||
67 | /// falls within the line start and the line end.</param> | ||
68 | /// <param name="triggerRegionX">When this border triggers, teleport to this regionX | ||
69 | /// in the grid</param> | ||
70 | /// <param name="triggerRegionY">When this border triggers, teleport to this regionY | ||
71 | /// in the grid</param> | ||
72 | /// <param name="direction">Cardinal for border direction. Think, 'which side of the | ||
73 | /// region is this'</param> | ||
74 | public Border(float lineStart, float lineEnd, float triggerCoordinate, uint triggerRegionX, | ||
75 | uint triggerRegionY, Cardinals direction) | ||
76 | { | ||
77 | BorderLine = new Vector3(lineStart,lineEnd,triggerCoordinate); | ||
78 | CrossDirection = direction; | ||
79 | TriggerRegionX = triggerRegionX; | ||
80 | TriggerRegionY = triggerRegionY; | ||
81 | } | ||
82 | |||
83 | /// <summary> | ||
84 | /// Tests to see if the given position would cross this border. | ||
85 | /// </summary> | ||
86 | /// <returns></returns> | ||
87 | public bool TestCross(Vector3 position) | ||
88 | { | ||
89 | bool result = false; | ||
90 | switch (CrossDirection) | ||
91 | { | ||
92 | case Cardinals.N: // x+0, y+1 | ||
93 | if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y > BorderLine.Z) | ||
94 | { | ||
95 | return true; | ||
96 | } | ||
97 | break; | ||
98 | case Cardinals.NE: // x+1, y+1 | ||
99 | break; | ||
100 | case Cardinals.E: // x+1, y+0 | ||
101 | if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X > BorderLine.Z) | ||
102 | { | ||
103 | return true; | ||
104 | } | ||
105 | break; | ||
106 | case Cardinals.SE: // x+1, y-1 | ||
107 | break; | ||
108 | case Cardinals.S: // x+0, y-1 | ||
109 | if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z) | ||
110 | { | ||
111 | return true; | ||
112 | } | ||
113 | break; | ||
114 | case Cardinals.SW: // x-1, y-1 | ||
115 | break; | ||
116 | case Cardinals.W: // x-1, y+0 | ||
117 | if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z) | ||
118 | { | ||
119 | return true; | ||
120 | } | ||
121 | break; | ||
122 | case Cardinals.NW: // x-1, y+1 | ||
123 | break; | ||
124 | } | ||
125 | |||
126 | return result; | ||
127 | } | ||
128 | |||
129 | public float Extent | ||
130 | { | ||
131 | get | ||
132 | { | ||
133 | switch (CrossDirection) | ||
134 | { | ||
135 | case Cardinals.N: | ||
136 | break; | ||
137 | case Cardinals.S: | ||
138 | break; | ||
139 | case Cardinals.W: | ||
140 | break; | ||
141 | case Cardinals.E: | ||
142 | break; | ||
143 | } | ||
144 | return 0; | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fac5547..00e699e 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -430,7 +430,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
430 | /// </summary> | 430 | /// </summary> |
431 | private int m_lastFrameTick; | 431 | private int m_lastFrameTick; |
432 | 432 | ||
433 | public bool CombineRegions = false; | ||
434 | /// <summary> | 433 | /// <summary> |
435 | /// Tick at which the last maintenance run occurred. | 434 | /// Tick at which the last maintenance run occurred. |
436 | /// </summary> | 435 | /// </summary> |
@@ -1060,7 +1059,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1060 | 1059 | ||
1061 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 1060 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
1062 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | 1061 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); |
1063 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
1064 | 1062 | ||
1065 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; | 1063 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
1066 | 1064 | ||
@@ -2925,18 +2923,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2925 | if (xx < 0 || yy < 0) | 2923 | if (xx < 0 || yy < 0) |
2926 | return false; | 2924 | return false; |
2927 | 2925 | ||
2928 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); | 2926 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) |
2929 | if (regionCombinerModule == null) | 2927 | ret = true; |
2930 | { | ||
2931 | // Regular region. Just check for region size | ||
2932 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) | ||
2933 | ret = true; | ||
2934 | } | ||
2935 | else | ||
2936 | { | ||
2937 | // We're in a mega-region so see if we are still in that larger region | ||
2938 | ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy); | ||
2939 | } | ||
2940 | return ret; | 2928 | return ret; |
2941 | } | 2929 | } |
2942 | 2930 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f59518b..b65d168 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -298,45 +298,42 @@ namespace OpenSim.Region.Framework.Scenes | |||
298 | protected internal bool AddRestoredSceneObject( | 298 | protected internal bool AddRestoredSceneObject( |
299 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 299 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
300 | { | 300 | { |
301 | if (!m_parentScene.CombineRegions) | 301 | // temporary checks to remove after varsize suport |
302 | { | 302 | float regionSizeX = m_parentScene.RegionInfo.RegionSizeX; |
303 | // temporary checks to remove after varsize suport | 303 | if (regionSizeX == 0) |
304 | float regionSizeX = m_parentScene.RegionInfo.RegionSizeX; | 304 | regionSizeX = Constants.RegionSize; |
305 | if (regionSizeX == 0) | 305 | float regionSizeY = m_parentScene.RegionInfo.RegionSizeY; |
306 | regionSizeX = Constants.RegionSize; | 306 | if (regionSizeY == 0) |
307 | float regionSizeY = m_parentScene.RegionInfo.RegionSizeY; | 307 | regionSizeY = Constants.RegionSize; |
308 | if (regionSizeY == 0) | 308 | |
309 | regionSizeY = Constants.RegionSize; | 309 | // KF: Check for out-of-region, move inside and make static. |
310 | 310 | Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, | |
311 | // KF: Check for out-of-region, move inside and make static. | 311 | sceneObject.RootPart.GroupPosition.Y, |
312 | Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, | 312 | sceneObject.RootPart.GroupPosition.Z); |
313 | sceneObject.RootPart.GroupPosition.Y, | 313 | bool clampZ = m_parentScene.ClampNegativeZ; |
314 | sceneObject.RootPart.GroupPosition.Z); | 314 | |
315 | bool clampZ = m_parentScene.ClampNegativeZ; | 315 | if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || (npos.Z < 0.0 && clampZ) || |
316 | 316 | npos.X > regionSizeX || | |
317 | if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || (npos.Z < 0.0 && clampZ) || | 317 | npos.Y > regionSizeY)) |
318 | npos.X > regionSizeX || | 318 | { |
319 | npos.Y > regionSizeY)) | 319 | if (npos.X < 0.0) npos.X = 1.0f; |
320 | if (npos.Y < 0.0) npos.Y = 1.0f; | ||
321 | if (npos.Z < 0.0 && clampZ) npos.Z = 0.0f; | ||
322 | if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f; | ||
323 | if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f; | ||
324 | |||
325 | SceneObjectPart rootpart = sceneObject.RootPart; | ||
326 | rootpart.GroupPosition = npos; | ||
327 | |||
328 | foreach (SceneObjectPart part in sceneObject.Parts) | ||
320 | { | 329 | { |
321 | if (npos.X < 0.0) npos.X = 1.0f; | 330 | if (part == rootpart) |
322 | if (npos.Y < 0.0) npos.Y = 1.0f; | 331 | continue; |
323 | if (npos.Z < 0.0 && clampZ) npos.Z = 0.0f; | 332 | part.GroupPosition = npos; |
324 | if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f; | ||
325 | if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f; | ||
326 | |||
327 | SceneObjectPart rootpart = sceneObject.RootPart; | ||
328 | rootpart.GroupPosition = npos; | ||
329 | |||
330 | foreach (SceneObjectPart part in sceneObject.Parts) | ||
331 | { | ||
332 | if (part == rootpart) | ||
333 | continue; | ||
334 | part.GroupPosition = npos; | ||
335 | } | ||
336 | rootpart.Velocity = Vector3.Zero; | ||
337 | rootpart.AngularVelocity = Vector3.Zero; | ||
338 | rootpart.Acceleration = Vector3.Zero; | ||
339 | } | 333 | } |
334 | rootpart.Velocity = Vector3.Zero; | ||
335 | rootpart.AngularVelocity = Vector3.Zero; | ||
336 | rootpart.Acceleration = Vector3.Zero; | ||
340 | } | 337 | } |
341 | 338 | ||
342 | bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 339 | bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3167282..7c1a7631 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2910,11 +2910,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2910 | 2910 | ||
2911 | // Allow move to another sub-region within a megaregion | 2911 | // Allow move to another sub-region within a megaregion |
2912 | Vector2 regionSize; | 2912 | Vector2 regionSize; |
2913 | IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>(); | 2913 | regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY); |
2914 | if (regionCombinerModule != null) | ||
2915 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); | ||
2916 | else | ||
2917 | regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY); | ||
2918 | 2914 | ||
2919 | if (pos.X < 0 || pos.X >= regionSize.X | 2915 | if (pos.X < 0 || pos.X >= regionSize.X |
2920 | || pos.Y < 0 || pos.Y >= regionSize.Y | 2916 | || pos.Y < 0 || pos.Y >= regionSize.Y |
@@ -2923,21 +2919,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2923 | 2919 | ||
2924 | float terrainHeight; | 2920 | float terrainHeight; |
2925 | Scene targetScene = m_scene; | 2921 | Scene targetScene = m_scene; |
2926 | // Get terrain height for sub-region in a megaregion if necessary | 2922 | terrainHeight = m_scene.GetGroundHeight(pos.X, pos.Y); |
2927 | if (regionCombinerModule != null) | ||
2928 | { | ||
2929 | int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); | ||
2930 | int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); | ||
2931 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); | ||
2932 | // If X and Y is NaN, target_region will be null | ||
2933 | if (target_region == null) | ||
2934 | return; | ||
2935 | UUID target_regionID = target_region.RegionID; | ||
2936 | SceneManager.Instance.TryGetScene(target_region.RegionID, out targetScene); | ||
2937 | terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; | ||
2938 | } | ||
2939 | else | ||
2940 | terrainHeight = m_scene.GetGroundHeight(pos.X, pos.Y); | ||
2941 | 2923 | ||
2942 | // dont try to land underground | 2924 | // dont try to land underground |
2943 | terrainHeight += Appearance.AvatarHeight * 0.5f + 0.2f; | 2925 | terrainHeight += Appearance.AvatarHeight * 0.5f + 0.2f; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs deleted file mode 100644 index e209221..0000000 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ /dev/null | |||
@@ -1,340 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Text; | ||
32 | using NUnit.Framework; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | using OpenSim.Tests.Common; | ||
36 | |||
37 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
38 | { | ||
39 | [TestFixture] | ||
40 | public class BorderTests : OpenSimTestCase | ||
41 | { | ||
42 | [Test] | ||
43 | public void TestCross() | ||
44 | { | ||
45 | TestHelpers.InMethod(); | ||
46 | |||
47 | List<Border> testborders = new List<Border>(); | ||
48 | |||
49 | Border NorthBorder = new Border(); | ||
50 | NorthBorder.BorderLine = new Vector3(0, 256, 256); //<--- | ||
51 | NorthBorder.CrossDirection = Cardinals.N; | ||
52 | testborders.Add(NorthBorder); | ||
53 | |||
54 | Border SouthBorder = new Border(); | ||
55 | SouthBorder.BorderLine = new Vector3(0, 256, 0); //---> | ||
56 | SouthBorder.CrossDirection = Cardinals.S; | ||
57 | testborders.Add(SouthBorder); | ||
58 | |||
59 | Border EastBorder = new Border(); | ||
60 | EastBorder.BorderLine = new Vector3(0, 256, 256); //<--- | ||
61 | EastBorder.CrossDirection = Cardinals.E; | ||
62 | testborders.Add(EastBorder); | ||
63 | |||
64 | Border WestBorder = new Border(); | ||
65 | WestBorder.BorderLine = new Vector3(0, 256, 0); //---> | ||
66 | WestBorder.CrossDirection = Cardinals.W; | ||
67 | testborders.Add(WestBorder); | ||
68 | |||
69 | Vector3 position = new Vector3(200,200,21); | ||
70 | |||
71 | foreach (Border b in testborders) | ||
72 | Assert.That(!b.TestCross(position)); | ||
73 | |||
74 | position = new Vector3(200,280,21); | ||
75 | Assert.That(NorthBorder.TestCross(position)); | ||
76 | |||
77 | // Test automatic border crossing | ||
78 | // by setting the border crossing aabb to be the whole region | ||
79 | position = new Vector3(25,25,21); // safely within one 256m region | ||
80 | |||
81 | // The Z value of the BorderLine is reversed, making all positions within the region | ||
82 | // trigger bordercross | ||
83 | |||
84 | SouthBorder.BorderLine = new Vector3(0,256,256); // automatic border cross in the region | ||
85 | Assert.That(SouthBorder.TestCross(position)); | ||
86 | |||
87 | NorthBorder.BorderLine = new Vector3(0, 256, 0); // automatic border cross in the region | ||
88 | Assert.That(NorthBorder.TestCross(position)); | ||
89 | |||
90 | EastBorder.BorderLine = new Vector3(0, 256, 0); // automatic border cross in the region | ||
91 | Assert.That(EastBorder.TestCross(position)); | ||
92 | |||
93 | WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region | ||
94 | Assert.That(WestBorder.TestCross(position)); | ||
95 | } | ||
96 | |||
97 | [Test] | ||
98 | public void TestCrossSquare512() | ||
99 | { | ||
100 | TestHelpers.InMethod(); | ||
101 | |||
102 | List<Border> testborders = new List<Border>(); | ||
103 | |||
104 | Border NorthBorder = new Border(); | ||
105 | NorthBorder.BorderLine = new Vector3(0, 512, 512); | ||
106 | NorthBorder.CrossDirection = Cardinals.N; | ||
107 | testborders.Add(NorthBorder); | ||
108 | |||
109 | Border SouthBorder = new Border(); | ||
110 | SouthBorder.BorderLine = new Vector3(0, 512, 0); | ||
111 | SouthBorder.CrossDirection = Cardinals.S; | ||
112 | testborders.Add(SouthBorder); | ||
113 | |||
114 | Border EastBorder = new Border(); | ||
115 | EastBorder.BorderLine = new Vector3(0, 512, 512); | ||
116 | EastBorder.CrossDirection = Cardinals.E; | ||
117 | testborders.Add(EastBorder); | ||
118 | |||
119 | Border WestBorder = new Border(); | ||
120 | WestBorder.BorderLine = new Vector3(0, 512, 0); | ||
121 | WestBorder.CrossDirection = Cardinals.W; | ||
122 | testborders.Add(WestBorder); | ||
123 | |||
124 | Vector3 position = new Vector3(450,220,21); | ||
125 | |||
126 | foreach (Border b in testborders) | ||
127 | { | ||
128 | Assert.That(!b.TestCross(position)); | ||
129 | |||
130 | } | ||
131 | |||
132 | //Trigger east border | ||
133 | position = new Vector3(513,220,21); | ||
134 | foreach (Border b in testborders) | ||
135 | { | ||
136 | if (b.CrossDirection == Cardinals.E) | ||
137 | Assert.That(b.TestCross(position)); | ||
138 | else | ||
139 | Assert.That(!b.TestCross(position)); | ||
140 | |||
141 | } | ||
142 | |||
143 | //Trigger west border | ||
144 | position = new Vector3(-1, 220, 21); | ||
145 | foreach (Border b in testborders) | ||
146 | { | ||
147 | if (b.CrossDirection == Cardinals.W) | ||
148 | Assert.That(b.TestCross(position)); | ||
149 | else | ||
150 | Assert.That(!b.TestCross(position)); | ||
151 | |||
152 | } | ||
153 | |||
154 | //Trigger north border | ||
155 | position = new Vector3(220, 513, 21); | ||
156 | foreach (Border b in testborders) | ||
157 | { | ||
158 | if (b.CrossDirection == Cardinals.N) | ||
159 | Assert.That(b.TestCross(position)); | ||
160 | else | ||
161 | Assert.That(!b.TestCross(position)); | ||
162 | |||
163 | } | ||
164 | |||
165 | //Trigger south border | ||
166 | position = new Vector3(220, -1, 21); | ||
167 | foreach (Border b in testborders) | ||
168 | { | ||
169 | if (b.CrossDirection == Cardinals.S) | ||
170 | Assert.That(b.TestCross(position)); | ||
171 | else | ||
172 | Assert.That(!b.TestCross(position)); | ||
173 | |||
174 | } | ||
175 | } | ||
176 | |||
177 | [Test] | ||
178 | public void TestCrossRectangle512x256() | ||
179 | { | ||
180 | TestHelpers.InMethod(); | ||
181 | |||
182 | List<Border> testborders = new List<Border>(); | ||
183 | |||
184 | Border NorthBorder = new Border(); | ||
185 | NorthBorder.BorderLine = new Vector3(0, 512, 256); | ||
186 | NorthBorder.CrossDirection = Cardinals.N; | ||
187 | testborders.Add(NorthBorder); | ||
188 | |||
189 | Border SouthBorder = new Border(); | ||
190 | SouthBorder.BorderLine = new Vector3(0, 512, 0); | ||
191 | SouthBorder.CrossDirection = Cardinals.S; | ||
192 | testborders.Add(SouthBorder); | ||
193 | |||
194 | Border EastBorder = new Border(); | ||
195 | EastBorder.BorderLine = new Vector3(0, 256, 512); | ||
196 | EastBorder.CrossDirection = Cardinals.E; | ||
197 | testborders.Add(EastBorder); | ||
198 | |||
199 | Border WestBorder = new Border(); | ||
200 | WestBorder.BorderLine = new Vector3(0, 256, 0); | ||
201 | WestBorder.CrossDirection = Cardinals.W; | ||
202 | testborders.Add(WestBorder); | ||
203 | |||
204 | Vector3 position = new Vector3(450, 220, 21); | ||
205 | |||
206 | foreach (Border b in testborders) | ||
207 | { | ||
208 | Assert.That(!b.TestCross(position)); | ||
209 | |||
210 | } | ||
211 | |||
212 | //Trigger east border | ||
213 | position = new Vector3(513, 220, 21); | ||
214 | foreach (Border b in testborders) | ||
215 | { | ||
216 | if (b.CrossDirection == Cardinals.E) | ||
217 | Assert.That(b.TestCross(position)); | ||
218 | else | ||
219 | Assert.That(!b.TestCross(position)); | ||
220 | |||
221 | } | ||
222 | |||
223 | //Trigger west border | ||
224 | position = new Vector3(-1, 220, 21); | ||
225 | foreach (Border b in testborders) | ||
226 | { | ||
227 | if (b.CrossDirection == Cardinals.W) | ||
228 | Assert.That(b.TestCross(position)); | ||
229 | else | ||
230 | Assert.That(!b.TestCross(position)); | ||
231 | |||
232 | } | ||
233 | |||
234 | //Trigger north border | ||
235 | position = new Vector3(220, 257, 21); | ||
236 | foreach (Border b in testborders) | ||
237 | { | ||
238 | if (b.CrossDirection == Cardinals.N) | ||
239 | Assert.That(b.TestCross(position)); | ||
240 | else | ||
241 | Assert.That(!b.TestCross(position)); | ||
242 | |||
243 | } | ||
244 | |||
245 | //Trigger south border | ||
246 | position = new Vector3(220, -1, 21); | ||
247 | foreach (Border b in testborders) | ||
248 | { | ||
249 | if (b.CrossDirection == Cardinals.S) | ||
250 | Assert.That(b.TestCross(position)); | ||
251 | else | ||
252 | Assert.That(!b.TestCross(position)); | ||
253 | |||
254 | } | ||
255 | } | ||
256 | |||
257 | [Test] | ||
258 | public void TestCrossOdd512x512w256hole() | ||
259 | { | ||
260 | TestHelpers.InMethod(); | ||
261 | |||
262 | List<Border> testborders = new List<Border>(); | ||
263 | // 512____ | ||
264 | // | | | ||
265 | // 256__| |___ | ||
266 | // | | | ||
267 | // |______| | ||
268 | // 0 | 512 | ||
269 | // 256 | ||
270 | |||
271 | // Compound North border since the hole is at the top | ||
272 | Border NorthBorder1 = new Border(); | ||
273 | NorthBorder1.BorderLine = new Vector3(0, 256, 512); | ||
274 | NorthBorder1.CrossDirection = Cardinals.N; | ||
275 | testborders.Add(NorthBorder1); | ||
276 | |||
277 | Border NorthBorder2 = new Border(); | ||
278 | NorthBorder2.BorderLine = new Vector3(256, 512, 256); | ||
279 | NorthBorder2.CrossDirection = Cardinals.N; | ||
280 | testborders.Add(NorthBorder2); | ||
281 | |||
282 | Border SouthBorder = new Border(); | ||
283 | SouthBorder.BorderLine = new Vector3(0, 512, 0); | ||
284 | SouthBorder.CrossDirection = Cardinals.S; | ||
285 | testborders.Add(SouthBorder); | ||
286 | |||
287 | //Compound East border | ||
288 | Border EastBorder1 = new Border(); | ||
289 | EastBorder1.BorderLine = new Vector3(0, 256, 512); | ||
290 | EastBorder1.CrossDirection = Cardinals.E; | ||
291 | testborders.Add(EastBorder1); | ||
292 | |||
293 | Border EastBorder2 = new Border(); | ||
294 | EastBorder2.BorderLine = new Vector3(257, 512, 256); | ||
295 | EastBorder2.CrossDirection = Cardinals.E; | ||
296 | testborders.Add(EastBorder2); | ||
297 | |||
298 | |||
299 | |||
300 | Border WestBorder = new Border(); | ||
301 | WestBorder.BorderLine = new Vector3(0, 512, 0); | ||
302 | WestBorder.CrossDirection = Cardinals.W; | ||
303 | testborders.Add(WestBorder); | ||
304 | |||
305 | Vector3 position = new Vector3(450, 220, 21); | ||
306 | |||
307 | foreach (Border b in testborders) | ||
308 | { | ||
309 | Assert.That(!b.TestCross(position)); | ||
310 | |||
311 | } | ||
312 | |||
313 | position = new Vector3(220, 450, 21); | ||
314 | |||
315 | foreach (Border b in testborders) | ||
316 | { | ||
317 | Assert.That(!b.TestCross(position)); | ||
318 | |||
319 | } | ||
320 | |||
321 | bool result = false; | ||
322 | int bordersTriggered = 0; | ||
323 | |||
324 | position = new Vector3(450, 450, 21); | ||
325 | |||
326 | foreach (Border b in testborders) | ||
327 | { | ||
328 | if (b.TestCross(position)) | ||
329 | { | ||
330 | bordersTriggered++; | ||
331 | result = true; | ||
332 | } | ||
333 | } | ||
334 | |||
335 | Assert.That(result); | ||
336 | Assert.That(bordersTriggered == 2); | ||
337 | |||
338 | } | ||
339 | } | ||
340 | } | ||
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs deleted file mode 100644 index 721d396..0000000 --- a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Region.Framework.Scenes; | ||
32 | |||
33 | namespace OpenSim.Region.RegionCombinerModule | ||
34 | { | ||
35 | public class RegionCombinerClientEventForwarder | ||
36 | { | ||
37 | private Scene m_rootScene; | ||
38 | private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>(); | ||
39 | private Dictionary<UUID,RegionCombinerIndividualEventForwarder> m_forwarders = new Dictionary<UUID, | ||
40 | RegionCombinerIndividualEventForwarder>(); | ||
41 | |||
42 | public RegionCombinerClientEventForwarder(RegionConnections rootScene) | ||
43 | { | ||
44 | m_rootScene = rootScene.RegionScene; | ||
45 | } | ||
46 | |||
47 | public void AddSceneToEventForwarding(Scene virtualScene) | ||
48 | { | ||
49 | lock (m_virtScene) | ||
50 | { | ||
51 | if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID)) | ||
52 | { | ||
53 | m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene; | ||
54 | } | ||
55 | else | ||
56 | { | ||
57 | m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | lock (m_forwarders) | ||
62 | { | ||
63 | // TODO: Fix this to unregister if this happens | ||
64 | if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID)) | ||
65 | m_forwarders.Remove(virtualScene.RegionInfo.originRegionID); | ||
66 | |||
67 | RegionCombinerIndividualEventForwarder forwarder = | ||
68 | new RegionCombinerIndividualEventForwarder(m_rootScene, virtualScene); | ||
69 | m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder); | ||
70 | |||
71 | virtualScene.EventManager.OnNewClient += forwarder.ClientConnect; | ||
72 | virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed; | ||
73 | } | ||
74 | } | ||
75 | |||
76 | public void RemoveSceneFromEventForwarding (Scene virtualScene) | ||
77 | { | ||
78 | lock (m_forwarders) | ||
79 | { | ||
80 | RegionCombinerIndividualEventForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID]; | ||
81 | virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect; | ||
82 | virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed; | ||
83 | m_forwarders.Remove(virtualScene.RegionInfo.originRegionID); | ||
84 | } | ||
85 | lock (m_virtScene) | ||
86 | { | ||
87 | if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID)) | ||
88 | { | ||
89 | m_virtScene.Remove(virtualScene.RegionInfo.originRegionID); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs deleted file mode 100644 index 83732e2..0000000 --- a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.CoreModules.Avatar.Attachments; | ||
32 | using OpenSim.Region.CoreModules.Avatar.Gods; | ||
33 | using OpenSim.Region.Framework.Interfaces; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | |||
36 | namespace OpenSim.Region.RegionCombinerModule | ||
37 | { | ||
38 | public class RegionCombinerIndividualEventForwarder | ||
39 | { | ||
40 | private Scene m_rootScene; | ||
41 | private Scene m_virtScene; | ||
42 | |||
43 | public RegionCombinerIndividualEventForwarder(Scene rootScene, Scene virtScene) | ||
44 | { | ||
45 | m_rootScene = rootScene; | ||
46 | m_virtScene = virtScene; | ||
47 | } | ||
48 | |||
49 | public void ClientConnect(IClientAPI client) | ||
50 | { | ||
51 | m_virtScene.UnSubscribeToClientPrimEvents(client); | ||
52 | m_virtScene.UnSubscribeToClientPrimRezEvents(client); | ||
53 | m_virtScene.UnSubscribeToClientInventoryEvents(client); | ||
54 | if(m_virtScene.AttachmentsModule != null) | ||
55 | ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client); | ||
56 | //m_virtScene.UnSubscribeToClientTeleportEvents(client); | ||
57 | m_virtScene.UnSubscribeToClientScriptEvents(client); | ||
58 | |||
59 | IGodsModule virtGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>(); | ||
60 | if (virtGodsModule != null) | ||
61 | ((GodsModule)virtGodsModule).UnsubscribeFromClientEvents(client); | ||
62 | |||
63 | m_virtScene.UnSubscribeToClientNetworkEvents(client); | ||
64 | |||
65 | m_rootScene.SubscribeToClientPrimEvents(client); | ||
66 | client.OnAddPrim += LocalAddNewPrim; | ||
67 | client.OnRezObject += LocalRezObject; | ||
68 | |||
69 | m_rootScene.SubscribeToClientInventoryEvents(client); | ||
70 | if (m_rootScene.AttachmentsModule != null) | ||
71 | ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client); | ||
72 | //m_rootScene.SubscribeToClientTeleportEvents(client); | ||
73 | m_rootScene.SubscribeToClientScriptEvents(client); | ||
74 | |||
75 | IGodsModule rootGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>(); | ||
76 | if (rootGodsModule != null) | ||
77 | ((GodsModule)rootGodsModule).UnsubscribeFromClientEvents(client); | ||
78 | |||
79 | m_rootScene.SubscribeToClientNetworkEvents(client); | ||
80 | } | ||
81 | |||
82 | public void ClientClosed(UUID clientid, Scene scene) | ||
83 | { | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Fixes position based on the region the Rez event came in on | ||
88 | /// </summary> | ||
89 | /// <param name="remoteclient"></param> | ||
90 | /// <param name="itemid"></param> | ||
91 | /// <param name="rayend"></param> | ||
92 | /// <param name="raystart"></param> | ||
93 | /// <param name="raytargetid"></param> | ||
94 | /// <param name="bypassraycast"></param> | ||
95 | /// <param name="rayendisintersection"></param> | ||
96 | /// <param name="rezselected"></param> | ||
97 | /// <param name="removeitem"></param> | ||
98 | /// <param name="fromtaskid"></param> | ||
99 | private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, | ||
100 | UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, | ||
101 | UUID fromtaskid) | ||
102 | { | ||
103 | int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; | ||
104 | int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; | ||
105 | rayend.X += differenceX * (int)Constants.RegionSize; | ||
106 | rayend.Y += differenceY * (int)Constants.RegionSize; | ||
107 | raystart.X += differenceX * (int)Constants.RegionSize; | ||
108 | raystart.Y += differenceY * (int)Constants.RegionSize; | ||
109 | |||
110 | m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast, | ||
111 | rayendisintersection, rezselected, removeitem, fromtaskid); | ||
112 | } | ||
113 | /// <summary> | ||
114 | /// Fixes position based on the region the AddPrimShape event came in on | ||
115 | /// </summary> | ||
116 | /// <param name="ownerid"></param> | ||
117 | /// <param name="groupid"></param> | ||
118 | /// <param name="rayend"></param> | ||
119 | /// <param name="rot"></param> | ||
120 | /// <param name="shape"></param> | ||
121 | /// <param name="bypassraycast"></param> | ||
122 | /// <param name="raystart"></param> | ||
123 | /// <param name="raytargetid"></param> | ||
124 | /// <param name="rayendisintersection"></param> | ||
125 | private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, | ||
126 | PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, | ||
127 | byte rayendisintersection) | ||
128 | { | ||
129 | int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; | ||
130 | int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; | ||
131 | rayend.X += differenceX * (int)Constants.RegionSize; | ||
132 | rayend.Y += differenceY * (int)Constants.RegionSize; | ||
133 | raystart.X += differenceX * (int)Constants.RegionSize; | ||
134 | raystart.Y += differenceY * (int)Constants.RegionSize; | ||
135 | m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid, | ||
136 | rayendisintersection); | ||
137 | } | ||
138 | } | ||
139 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs deleted file mode 100644 index e5e76e9..0000000 --- a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ /dev/null | |||
@@ -1,202 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Framework.Interfaces; | ||
35 | using OpenSim.Region.CoreModules.World.Land; | ||
36 | |||
37 | namespace OpenSim.Region.RegionCombinerModule | ||
38 | { | ||
39 | public class RegionCombinerLargeLandChannel : ILandChannel | ||
40 | { | ||
41 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | |||
43 | private RegionData RegData; | ||
44 | private ILandChannel RootRegionLandChannel; | ||
45 | private readonly List<RegionData> RegionConnections; | ||
46 | |||
47 | #region ILandChannel Members | ||
48 | |||
49 | public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel, | ||
50 | List<RegionData> regionConnections) | ||
51 | { | ||
52 | RegData = regData; | ||
53 | RootRegionLandChannel = rootRegionLandChannel; | ||
54 | RegionConnections = regionConnections; | ||
55 | } | ||
56 | |||
57 | public List<ILandObject> ParcelsNearPoint(Vector3 position) | ||
58 | { | ||
59 | //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position); | ||
60 | return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset); | ||
61 | } | ||
62 | |||
63 | public List<ILandObject> AllParcels() | ||
64 | { | ||
65 | return RootRegionLandChannel.AllParcels(); | ||
66 | } | ||
67 | |||
68 | public void Clear(bool setupDefaultParcel) | ||
69 | { | ||
70 | RootRegionLandChannel.Clear(setupDefaultParcel); | ||
71 | } | ||
72 | |||
73 | public ILandObject GetLandObject(Vector3 position) | ||
74 | { | ||
75 | return GetLandObject(position.X, position.Y); | ||
76 | } | ||
77 | |||
78 | public ILandObject GetLandObject(int x, int y) | ||
79 | { | ||
80 | return GetLandObject((float)x, (float)y); | ||
81 | |||
82 | // m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y); | ||
83 | // | ||
84 | // if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize) | ||
85 | // { | ||
86 | // return RootRegionLandChannel.GetLandObject(x, y); | ||
87 | // } | ||
88 | // else | ||
89 | // { | ||
90 | // int offsetX = (x / (int)Constants.RegionSize); | ||
91 | // int offsetY = (y / (int)Constants.RegionSize); | ||
92 | // offsetX *= (int)Constants.RegionSize; | ||
93 | // offsetY *= (int)Constants.RegionSize; | ||
94 | // | ||
95 | // foreach (RegionData regionData in RegionConnections) | ||
96 | // { | ||
97 | // if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY) | ||
98 | // { | ||
99 | // m_log.DebugFormat( | ||
100 | // "[REGION COMBINER LARGE LAND CHANNEL]: Found region {0} at offset {1},{2}", | ||
101 | // regionData.RegionScene.Name, offsetX, offsetY); | ||
102 | // | ||
103 | // return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); | ||
104 | // } | ||
105 | // } | ||
106 | // //ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); | ||
107 | // //obj.LandData.Name = "NO LAND"; | ||
108 | // //return obj; | ||
109 | // } | ||
110 | // | ||
111 | // m_log.DebugFormat("[REGION COMBINER LARGE LAND CHANNEL]: No region found at {0},{1}, returning null", x, y); | ||
112 | // | ||
113 | // return null; | ||
114 | } | ||
115 | |||
116 | public ILandObject GetLandObject(int localID) | ||
117 | { | ||
118 | // XXX: Possibly should be looking in every land channel, not just the root. | ||
119 | return RootRegionLandChannel.GetLandObject(localID); | ||
120 | } | ||
121 | |||
122 | public ILandObject GetLandObject(float x, float y) | ||
123 | { | ||
124 | // m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y); | ||
125 | |||
126 | if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize) | ||
127 | { | ||
128 | return RootRegionLandChannel.GetLandObject(x, y); | ||
129 | } | ||
130 | else | ||
131 | { | ||
132 | int offsetX = (int)(x/(int) Constants.RegionSize); | ||
133 | int offsetY = (int)(y/(int) Constants.RegionSize); | ||
134 | offsetX *= (int) Constants.RegionSize; | ||
135 | offsetY *= (int) Constants.RegionSize; | ||
136 | |||
137 | foreach (RegionData regionData in RegionConnections) | ||
138 | { | ||
139 | if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY) | ||
140 | { | ||
141 | // m_log.DebugFormat( | ||
142 | // "[REGION COMBINER LARGE LAND CHANNEL]: Found region {0} at offset {1},{2}", | ||
143 | // regionData.RegionScene.Name, offsetX, offsetY); | ||
144 | |||
145 | return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | // ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); | ||
150 | // obj.LandData.Name = "NO LAND"; | ||
151 | // return obj; | ||
152 | } | ||
153 | |||
154 | // m_log.DebugFormat("[REGION COMBINER LARGE LAND CHANNEL]: No region found at {0},{1}, returning null", x, y); | ||
155 | |||
156 | return null; | ||
157 | } | ||
158 | |||
159 | public bool IsForcefulBansAllowed() | ||
160 | { | ||
161 | return RootRegionLandChannel.IsForcefulBansAllowed(); | ||
162 | } | ||
163 | |||
164 | public void UpdateLandObject(int localID, LandData data) | ||
165 | { | ||
166 | RootRegionLandChannel.UpdateLandObject(localID, data); | ||
167 | } | ||
168 | |||
169 | public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) | ||
170 | { | ||
171 | RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id); | ||
172 | } | ||
173 | |||
174 | public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) | ||
175 | { | ||
176 | RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id); | ||
177 | } | ||
178 | |||
179 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | ||
180 | { | ||
181 | RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient); | ||
182 | } | ||
183 | |||
184 | public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) | ||
185 | { | ||
186 | RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel); | ||
187 | } | ||
188 | |||
189 | public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) | ||
190 | { | ||
191 | RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel); | ||
192 | } | ||
193 | |||
194 | public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) | ||
195 | { | ||
196 | RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime); | ||
197 | } | ||
198 | |||
199 | public void sendClientInitialLandInfo(IClientAPI remoteClient) { } | ||
200 | #endregion | ||
201 | } | ||
202 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs deleted file mode 100644 index 32eead0..0000000 --- a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs +++ /dev/null | |||
@@ -1,880 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Client; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Framework.Console; | ||
39 | using OpenSim.Region.PhysicsModules.SharedBase; | ||
40 | using Mono.Addins; | ||
41 | |||
42 | namespace OpenSim.Region.RegionCombinerModule | ||
43 | { | ||
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionCombinerModule")] | ||
45 | public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule | ||
46 | { | ||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | // private static string LogHeader = "[REGION COMBINER MODULE]"; | ||
49 | |||
50 | public string Name | ||
51 | { | ||
52 | get { return "RegionCombinerModule"; } | ||
53 | } | ||
54 | |||
55 | public Type ReplaceableInterface | ||
56 | { | ||
57 | get { return null; } | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Is this module enabled? | ||
62 | /// </summary> | ||
63 | private bool m_combineContiguousRegions = false; | ||
64 | |||
65 | /// <summary> | ||
66 | /// This holds the root regions for the megaregions. | ||
67 | /// </summary> | ||
68 | /// <remarks> | ||
69 | /// Usually there is only ever one megaregion (and hence only one entry here). | ||
70 | /// </remarks> | ||
71 | private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>(); | ||
72 | |||
73 | /// <summary> | ||
74 | /// The scenes that comprise the megaregion. | ||
75 | /// </summary> | ||
76 | private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>(); | ||
77 | |||
78 | public void Initialise(IConfigSource source) | ||
79 | { | ||
80 | IConfig myConfig = source.Configs["Startup"]; | ||
81 | m_combineContiguousRegions = myConfig.GetBoolean("CombineContiguousRegions", false); | ||
82 | if (m_combineContiguousRegions) | ||
83 | m_log.ErrorFormat("[REGION COMBINER MODULE]: THIS MODULE IS BEING MARKED OBSOLETE AND MAY SOON BE REMOVED. PLEASE USE VARREGIONS INSTEAD."); | ||
84 | |||
85 | MainConsole.Instance.Commands.AddCommand( | ||
86 | "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms", | ||
87 | "Fixes phantom objects after an import to a megaregion or a change from a megaregion back to normal regions", | ||
88 | FixPhantoms); | ||
89 | } | ||
90 | |||
91 | public void Close() | ||
92 | { | ||
93 | } | ||
94 | |||
95 | public void AddRegion(Scene scene) | ||
96 | { | ||
97 | if (m_combineContiguousRegions) | ||
98 | scene.RegisterModuleInterface<IRegionCombinerModule>(this); | ||
99 | } | ||
100 | |||
101 | public void RemoveRegion(Scene scene) | ||
102 | { | ||
103 | lock (m_startingScenes) | ||
104 | m_startingScenes.Remove(scene.RegionInfo.originRegionID); | ||
105 | } | ||
106 | |||
107 | public void RegionLoaded(Scene scene) | ||
108 | { | ||
109 | lock (m_startingScenes) | ||
110 | m_startingScenes.Add(scene.RegionInfo.originRegionID, scene); | ||
111 | |||
112 | if (m_combineContiguousRegions) | ||
113 | { | ||
114 | RegionLoadedDoWork(scene); | ||
115 | |||
116 | scene.EventManager.OnNewPresence += NewPresence; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | public bool IsRootForMegaregion(UUID regionId) | ||
121 | { | ||
122 | lock (m_regions) | ||
123 | return m_regions.ContainsKey(regionId); | ||
124 | } | ||
125 | |||
126 | public Vector2 GetSizeOfMegaregion(UUID regionId) | ||
127 | { | ||
128 | lock (m_regions) | ||
129 | { | ||
130 | if (m_regions.ContainsKey(regionId)) | ||
131 | { | ||
132 | RegionConnections rootConn = m_regions[regionId]; | ||
133 | |||
134 | return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | throw new Exception(string.Format("Region with id {0} not found", regionId)); | ||
139 | } | ||
140 | |||
141 | // Test to see if this postiion (relative to the region) is within the area covered | ||
142 | // by this megaregion. | ||
143 | public bool PositionIsInMegaregion(UUID currentRegion, int xx, int yy) | ||
144 | { | ||
145 | bool ret = false; | ||
146 | if (xx < 0 || yy < 0) | ||
147 | return ret; | ||
148 | |||
149 | foreach (RegionConnections rootRegion in m_regions.Values) | ||
150 | { | ||
151 | if (currentRegion == rootRegion.RegionId) | ||
152 | { | ||
153 | // The caller is in the root region so this is an easy test | ||
154 | if (xx < rootRegion.XEnd && yy < rootRegion.YEnd) | ||
155 | { | ||
156 | ret = true; | ||
157 | } | ||
158 | break; | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | // Maybe the caller is in one of the sub-regions | ||
163 | foreach (RegionData childRegion in rootRegion.ConnectedRegions) | ||
164 | { | ||
165 | if (currentRegion == childRegion.RegionId) | ||
166 | { | ||
167 | // This is a child. Diddle the offsets and check if in | ||
168 | Vector3 positionInMegaregion = childRegion.Offset; | ||
169 | positionInMegaregion.X += xx; | ||
170 | positionInMegaregion.Y += yy; | ||
171 | if (positionInMegaregion.X < rootRegion.XEnd && positionInMegaregion.Y < rootRegion.YEnd) | ||
172 | { | ||
173 | ret = true; | ||
174 | } | ||
175 | break; | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | |||
181 | return ret; | ||
182 | } | ||
183 | |||
184 | private void NewPresence(ScenePresence presence) | ||
185 | { | ||
186 | if (presence.IsChildAgent) | ||
187 | { | ||
188 | byte[] throttleData; | ||
189 | |||
190 | try | ||
191 | { | ||
192 | throttleData = presence.ControllingClient.GetThrottlesPacked(1); | ||
193 | } | ||
194 | catch (NotImplementedException) | ||
195 | { | ||
196 | return; | ||
197 | } | ||
198 | |||
199 | if (throttleData == null) | ||
200 | return; | ||
201 | |||
202 | if (throttleData.Length == 0) | ||
203 | return; | ||
204 | |||
205 | if (throttleData.Length != 28) | ||
206 | return; | ||
207 | |||
208 | byte[] adjData; | ||
209 | int pos = 0; | ||
210 | |||
211 | if (!BitConverter.IsLittleEndian) | ||
212 | { | ||
213 | byte[] newData = new byte[7 * 4]; | ||
214 | Buffer.BlockCopy(throttleData, 0, newData, 0, 7 * 4); | ||
215 | |||
216 | for (int i = 0; i < 7; i++) | ||
217 | Array.Reverse(newData, i * 4, 4); | ||
218 | |||
219 | adjData = newData; | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | adjData = throttleData; | ||
224 | } | ||
225 | |||
226 | // 0.125f converts from bits to bytes | ||
227 | int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
228 | int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
229 | int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
230 | int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
231 | int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
232 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
233 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | ||
234 | // State is a subcategory of task that we allocate a percentage to | ||
235 | |||
236 | |||
237 | //int total = resend + land + wind + cloud + task + texture + asset; | ||
238 | |||
239 | byte[] data = new byte[7 * 4]; | ||
240 | int ii = 0; | ||
241 | |||
242 | Buffer.BlockCopy(Utils.FloatToBytes(resend), 0, data, ii, 4); ii += 4; | ||
243 | Buffer.BlockCopy(Utils.FloatToBytes(land * 50), 0, data, ii, 4); ii += 4; | ||
244 | Buffer.BlockCopy(Utils.FloatToBytes(wind), 0, data, ii, 4); ii += 4; | ||
245 | Buffer.BlockCopy(Utils.FloatToBytes(cloud), 0, data, ii, 4); ii += 4; | ||
246 | Buffer.BlockCopy(Utils.FloatToBytes(task), 0, data, ii, 4); ii += 4; | ||
247 | Buffer.BlockCopy(Utils.FloatToBytes(texture), 0, data, ii, 4); ii += 4; | ||
248 | Buffer.BlockCopy(Utils.FloatToBytes(asset), 0, data, ii, 4); | ||
249 | |||
250 | try | ||
251 | { | ||
252 | presence.ControllingClient.SetChildAgentThrottle(data); | ||
253 | } | ||
254 | catch (NotImplementedException) | ||
255 | { | ||
256 | return; | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | |||
261 | private void RegionLoadedDoWork(Scene scene) | ||
262 | { | ||
263 | /* | ||
264 | // For testing on a single instance | ||
265 | if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000) | ||
266 | return; | ||
267 | // | ||
268 | */ | ||
269 | |||
270 | RegionConnections newConn = new RegionConnections(); | ||
271 | newConn.ConnectedRegions = new List<RegionData>(); | ||
272 | newConn.RegionScene = scene; | ||
273 | newConn.RegionLandChannel = scene.LandChannel; | ||
274 | newConn.RegionId = scene.RegionInfo.originRegionID; | ||
275 | newConn.X = scene.RegionInfo.RegionLocX; | ||
276 | newConn.Y = scene.RegionInfo.RegionLocY; | ||
277 | newConn.XEnd = scene.RegionInfo.RegionSizeX; | ||
278 | newConn.YEnd = scene.RegionInfo.RegionSizeX; | ||
279 | |||
280 | lock (m_regions) | ||
281 | { | ||
282 | bool connectedYN = false; | ||
283 | |||
284 | foreach (RegionConnections rootConn in m_regions.Values) | ||
285 | { | ||
286 | #region commented | ||
287 | /* | ||
288 | // If we're one region over +x +y | ||
289 | //xxy | ||
290 | //xxx | ||
291 | //xxx | ||
292 | if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd | ||
293 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
294 | && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd | ||
295 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
296 | { | ||
297 | Vector3 offset = Vector3.Zero; | ||
298 | offset.X = (((regionConnections.X * (int) Constants.RegionSize)) - | ||
299 | ((conn.X * (int) Constants.RegionSize))); | ||
300 | offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) - | ||
301 | ((conn.Y * (int) Constants.RegionSize))); | ||
302 | |||
303 | Vector3 extents = Vector3.Zero; | ||
304 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
305 | extents.X = conn.XEnd + conn.XEnd; | ||
306 | |||
307 | m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}. Offset: {2}. Extents:{3}", | ||
308 | conn.RegionScene.RegionInfo.RegionName, | ||
309 | regionConnections.RegionScene.RegionInfo.RegionName, | ||
310 | offset, extents); | ||
311 | |||
312 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
313 | |||
314 | connectedYN = true; | ||
315 | break; | ||
316 | } | ||
317 | */ | ||
318 | |||
319 | /* | ||
320 | //If we're one region over x +y | ||
321 | //xxx | ||
322 | //xxx | ||
323 | //xyx | ||
324 | if ((((int)conn.X * (int)Constants.RegionSize) | ||
325 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
326 | && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd | ||
327 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
328 | { | ||
329 | Vector3 offset = Vector3.Zero; | ||
330 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
331 | ((conn.X * (int)Constants.RegionSize))); | ||
332 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
333 | ((conn.Y * (int)Constants.RegionSize))); | ||
334 | |||
335 | Vector3 extents = Vector3.Zero; | ||
336 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
337 | extents.X = conn.XEnd; | ||
338 | |||
339 | m_log.DebugFormat("Scene: {0} to the north of Scene{1}. Offset: {2}. Extents:{3}", | ||
340 | conn.RegionScene.RegionInfo.RegionName, | ||
341 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
342 | |||
343 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
344 | connectedYN = true; | ||
345 | break; | ||
346 | } | ||
347 | */ | ||
348 | |||
349 | /* | ||
350 | // If we're one region over -x +y | ||
351 | //xxx | ||
352 | //xxx | ||
353 | //yxx | ||
354 | if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd | ||
355 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
356 | && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd | ||
357 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
358 | { | ||
359 | Vector3 offset = Vector3.Zero; | ||
360 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
361 | ((conn.X * (int)Constants.RegionSize))); | ||
362 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
363 | ((conn.Y * (int)Constants.RegionSize))); | ||
364 | |||
365 | Vector3 extents = Vector3.Zero; | ||
366 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
367 | extents.X = conn.XEnd + conn.XEnd; | ||
368 | |||
369 | m_log.DebugFormat("Scene: {0} to the northeast of Scene. Offset: {2}. Extents:{3}", | ||
370 | conn.RegionScene.RegionInfo.RegionName, | ||
371 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
372 | |||
373 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
374 | |||
375 | |||
376 | connectedYN = true; | ||
377 | break; | ||
378 | } | ||
379 | */ | ||
380 | |||
381 | /* | ||
382 | // If we're one region over -x y | ||
383 | //xxx | ||
384 | //yxx | ||
385 | //xxx | ||
386 | if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd | ||
387 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
388 | && (((int)conn.Y * (int)Constants.RegionSize) | ||
389 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
390 | { | ||
391 | Vector3 offset = Vector3.Zero; | ||
392 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
393 | ((conn.X * (int)Constants.RegionSize))); | ||
394 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
395 | ((conn.Y * (int)Constants.RegionSize))); | ||
396 | |||
397 | Vector3 extents = Vector3.Zero; | ||
398 | extents.Y = regionConnections.YEnd; | ||
399 | extents.X = conn.XEnd + conn.XEnd; | ||
400 | |||
401 | m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}", | ||
402 | conn.RegionScene.RegionInfo.RegionName, | ||
403 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
404 | |||
405 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
406 | |||
407 | connectedYN = true; | ||
408 | break; | ||
409 | } | ||
410 | */ | ||
411 | |||
412 | /* | ||
413 | // If we're one region over -x -y | ||
414 | //yxx | ||
415 | //xxx | ||
416 | //xxx | ||
417 | if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd | ||
418 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
419 | && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd | ||
420 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
421 | { | ||
422 | Vector3 offset = Vector3.Zero; | ||
423 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
424 | ((conn.X * (int)Constants.RegionSize))); | ||
425 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
426 | ((conn.Y * (int)Constants.RegionSize))); | ||
427 | |||
428 | Vector3 extents = Vector3.Zero; | ||
429 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
430 | extents.X = conn.XEnd + conn.XEnd; | ||
431 | |||
432 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", | ||
433 | conn.RegionScene.RegionInfo.RegionName, | ||
434 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
435 | |||
436 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
437 | |||
438 | connectedYN = true; | ||
439 | break; | ||
440 | } | ||
441 | */ | ||
442 | #endregion | ||
443 | |||
444 | |||
445 | // Check to see if this new region is adjacent to the root region. | ||
446 | // Note that we expect the regions to be combined from the root region outward | ||
447 | // thus the requirement for the ordering in the configuration files. | ||
448 | |||
449 | // If we're one region over +x y (i.e. root region is to the west) | ||
450 | //xxx | ||
451 | //xxy | ||
452 | //xxx | ||
453 | if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY) | ||
454 | { | ||
455 | connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); | ||
456 | break; | ||
457 | } | ||
458 | |||
459 | // If we're one region over x +y (i.e. root region is to the south) | ||
460 | //xyx | ||
461 | //xxx | ||
462 | //xxx | ||
463 | if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) | ||
464 | { | ||
465 | connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); | ||
466 | break; | ||
467 | } | ||
468 | |||
469 | // If we're one region over +x +y (i.e. root region is to the south-west) | ||
470 | //xxy | ||
471 | //xxx | ||
472 | //xxx | ||
473 | if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) | ||
474 | { | ||
475 | connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); | ||
476 | break; | ||
477 | } | ||
478 | } | ||
479 | |||
480 | // If !connectYN means that this region is a root region | ||
481 | if (!connectedYN) | ||
482 | { | ||
483 | DoWorkForRootRegion(newConn, scene); | ||
484 | } | ||
485 | } | ||
486 | } | ||
487 | |||
488 | private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene) | ||
489 | { | ||
490 | // Offset (in meters) from the base of this region to the base of the root region. | ||
491 | Vector3 offset = Vector3.Zero; | ||
492 | offset.X = newConn.PosX - rootConn.PosX; | ||
493 | offset.Y = newConn.PosY - rootConn.PosY; | ||
494 | |||
495 | // The new total size of the region (in meters) | ||
496 | // We just extend the X and Y dimensions so the extent might temporarily include areas without regions. | ||
497 | Vector3 extents = Vector3.Zero; | ||
498 | extents.X = Math.Max(rootConn.XEnd, offset.X + newConn.RegionScene.RegionInfo.RegionSizeX); | ||
499 | extents.Y = Math.Max(rootConn.YEnd, offset.Y + newConn.RegionScene.RegionInfo.RegionSizeY); | ||
500 | |||
501 | rootConn.UpdateExtents(extents); | ||
502 | |||
503 | m_log.DebugFormat( | ||
504 | "[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}", | ||
505 | rootConn.RegionScene.RegionInfo.RegionName, | ||
506 | newConn.RegionScene.RegionInfo.RegionName, offset, extents); | ||
507 | |||
508 | RegionData ConnectedRegion = new RegionData(); | ||
509 | ConnectedRegion.Offset = offset; | ||
510 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | ||
511 | ConnectedRegion.RegionScene = scene; | ||
512 | rootConn.ConnectedRegions.Add(ConnectedRegion); | ||
513 | |||
514 | // Inform root region Physics about the extents of this region | ||
515 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | ||
516 | |||
517 | // Inform Child region that it needs to forward it's terrain to the root region | ||
518 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); | ||
519 | |||
520 | // Reset Terrain.. since terrain loads before we get here, we need to load | ||
521 | // it again so it loads in the root region | ||
522 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | ||
523 | |||
524 | // Create a client event forwarder and add this region's events to the root region. | ||
525 | if (rootConn.ClientEventForwarder != null) | ||
526 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
527 | |||
528 | return true; | ||
529 | } | ||
530 | |||
531 | /* | ||
532 | * 20140215 radams1: The border stuff was removed and the addition of regions to the mega-regions | ||
533 | * was generalized. These functions are not needed for the generalized solution but left for reference. | ||
534 | private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) | ||
535 | { | ||
536 | Vector3 offset = Vector3.Zero; | ||
537 | offset.X = newConn.PosX - rootConn.PosX; | ||
538 | offset.Y = newConn.PosY - rootConn.PosY; | ||
539 | |||
540 | Vector3 extents = Vector3.Zero; | ||
541 | extents.Y = newConn.YEnd + rootConn.YEnd; | ||
542 | extents.X = rootConn.XEnd; | ||
543 | rootConn.UpdateExtents(extents); | ||
544 | |||
545 | RegionData ConnectedRegion = new RegionData(); | ||
546 | ConnectedRegion.Offset = offset; | ||
547 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | ||
548 | ConnectedRegion.RegionScene = scene; | ||
549 | rootConn.ConnectedRegions.Add(ConnectedRegion); | ||
550 | |||
551 | m_log.DebugFormat( | ||
552 | "[REGION COMBINER MODULE]: Root region {0} is to the south of region {1}, Offset: {2}, Extents: {3}", | ||
553 | rootConn.RegionScene.RegionInfo.RegionName, | ||
554 | newConn.RegionScene.RegionInfo.RegionName, offset, extents); | ||
555 | |||
556 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | ||
557 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); | ||
558 | |||
559 | // Reset Terrain.. since terrain normally loads first. | ||
560 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | ||
561 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | ||
562 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | ||
563 | |||
564 | if (rootConn.ClientEventForwarder != null) | ||
565 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
566 | |||
567 | return true; | ||
568 | } | ||
569 | |||
570 | private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) | ||
571 | { | ||
572 | Vector3 offset = Vector3.Zero; | ||
573 | offset.X = newConn.PosX - rootConn.PosX; | ||
574 | offset.Y = newConn.PosY - rootConn.PosY; | ||
575 | |||
576 | Vector3 extents = Vector3.Zero; | ||
577 | |||
578 | // We do not want to inflate the extents for regions strictly to the NE of the root region, since this | ||
579 | // would double count regions strictly to the north and east that have already been added. | ||
580 | // extents.Y = regionConnections.YEnd + conn.YEnd; | ||
581 | // extents.X = regionConnections.XEnd + conn.XEnd; | ||
582 | // conn.UpdateExtents(extents); | ||
583 | |||
584 | extents.Y = rootConn.YEnd; | ||
585 | extents.X = rootConn.XEnd; | ||
586 | |||
587 | RegionData ConnectedRegion = new RegionData(); | ||
588 | ConnectedRegion.Offset = offset; | ||
589 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | ||
590 | ConnectedRegion.RegionScene = scene; | ||
591 | |||
592 | rootConn.ConnectedRegions.Add(ConnectedRegion); | ||
593 | |||
594 | m_log.DebugFormat( | ||
595 | "[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}", | ||
596 | rootConn.RegionScene.RegionInfo.RegionName, | ||
597 | newConn.RegionScene.RegionInfo.RegionName, offset, extents); | ||
598 | |||
599 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | ||
600 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); | ||
601 | |||
602 | // Reset Terrain.. since terrain normally loads first. | ||
603 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | ||
604 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | ||
605 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | ||
606 | |||
607 | if (rootConn.ClientEventForwarder != null) | ||
608 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
609 | |||
610 | return true; | ||
611 | |||
612 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); | ||
613 | } | ||
614 | */ | ||
615 | |||
616 | private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene) | ||
617 | { | ||
618 | m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName); | ||
619 | |||
620 | RegionData rdata = new RegionData(); | ||
621 | rdata.Offset = Vector3.Zero; | ||
622 | rdata.RegionId = scene.RegionInfo.originRegionID; | ||
623 | rdata.RegionScene = scene; | ||
624 | // save it's land channel | ||
625 | rootConn.RegionLandChannel = scene.LandChannel; | ||
626 | |||
627 | // Substitue our landchannel | ||
628 | RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, | ||
629 | rootConn.ConnectedRegions); | ||
630 | |||
631 | scene.LandChannel = lnd; | ||
632 | |||
633 | // Forward the permissions modules of each of the connected regions to the root region | ||
634 | lock (m_regions) | ||
635 | { | ||
636 | foreach (RegionData r in rootConn.ConnectedRegions) | ||
637 | { | ||
638 | ForwardPermissionRequests(rootConn, r.RegionScene); | ||
639 | } | ||
640 | |||
641 | // Create the root region's Client Event Forwarder | ||
642 | rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn); | ||
643 | |||
644 | // Sets up the CoarseLocationUpdate forwarder for this root region | ||
645 | scene.EventManager.OnNewPresence += SetCoarseLocationDelegate; | ||
646 | |||
647 | // Adds this root region to a dictionary of regions that are connectable | ||
648 | m_regions.Add(scene.RegionInfo.originRegionID, rootConn); | ||
649 | } | ||
650 | } | ||
651 | |||
652 | private void SetCoarseLocationDelegate(ScenePresence presence) | ||
653 | { | ||
654 | presence.SetSendCoarseLocationMethod(SendCoarseLocationUpdates); | ||
655 | } | ||
656 | |||
657 | // This delegate was refactored for non-combined regions. | ||
658 | // This combined region version will not use the pre-compiled lists of locations and ids | ||
659 | private void SendCoarseLocationUpdates(UUID sceneId, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | ||
660 | { | ||
661 | RegionConnections connectiondata = null; | ||
662 | lock (m_regions) | ||
663 | { | ||
664 | if (m_regions.ContainsKey(sceneId)) | ||
665 | connectiondata = m_regions[sceneId]; | ||
666 | else | ||
667 | return; | ||
668 | } | ||
669 | |||
670 | List<Vector3> CoarseLocations = new List<Vector3>(); | ||
671 | List<UUID> AvatarUUIDs = new List<UUID>(); | ||
672 | |||
673 | connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp) | ||
674 | { | ||
675 | if (sp.UUID != presence.UUID) | ||
676 | { | ||
677 | CoarseLocations.Add(sp.AbsolutePosition); | ||
678 | AvatarUUIDs.Add(sp.UUID); | ||
679 | } | ||
680 | }); | ||
681 | |||
682 | DistributeCoarseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); | ||
683 | } | ||
684 | |||
685 | private void DistributeCoarseLocationUpdates(List<Vector3> locations, List<UUID> uuids, | ||
686 | RegionConnections connectiondata, ScenePresence rootPresence) | ||
687 | { | ||
688 | RegionData[] rdata = connectiondata.ConnectedRegions.ToArray(); | ||
689 | //List<IClientAPI> clients = new List<IClientAPI>(); | ||
690 | Dictionary<Vector2, RegionCoarseLocationStruct> updates = new Dictionary<Vector2, RegionCoarseLocationStruct>(); | ||
691 | |||
692 | // Root Region entry | ||
693 | RegionCoarseLocationStruct rootupdatedata = new RegionCoarseLocationStruct(); | ||
694 | rootupdatedata.Locations = new List<Vector3>(); | ||
695 | rootupdatedata.Uuids = new List<UUID>(); | ||
696 | rootupdatedata.Offset = Vector2.Zero; | ||
697 | |||
698 | rootupdatedata.UserAPI = rootPresence.ControllingClient; | ||
699 | |||
700 | if (rootupdatedata.UserAPI != null) | ||
701 | updates.Add(Vector2.Zero, rootupdatedata); | ||
702 | |||
703 | //Each Region needs an entry or we will end up with dead minimap dots | ||
704 | foreach (RegionData regiondata in rdata) | ||
705 | { | ||
706 | Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y); | ||
707 | RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct(); | ||
708 | updatedata.Locations = new List<Vector3>(); | ||
709 | updatedata.Uuids = new List<UUID>(); | ||
710 | updatedata.Offset = offset; | ||
711 | |||
712 | if (offset == Vector2.Zero) | ||
713 | updatedata.UserAPI = rootPresence.ControllingClient; | ||
714 | else | ||
715 | updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata); | ||
716 | |||
717 | if (updatedata.UserAPI != null) | ||
718 | updates.Add(offset, updatedata); | ||
719 | } | ||
720 | |||
721 | // go over the locations and assign them to an IClientAPI | ||
722 | for (int i = 0; i < locations.Count; i++) | ||
723 | //{locations[i]/(int) Constants.RegionSize; | ||
724 | { | ||
725 | Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize, | ||
726 | (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z); | ||
727 | Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize, | ||
728 | pPosition.Y*(int) Constants.RegionSize); | ||
729 | |||
730 | if (!updates.ContainsKey(offset)) | ||
731 | { | ||
732 | // This shouldn't happen | ||
733 | RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct(); | ||
734 | updatedata.Locations = new List<Vector3>(); | ||
735 | updatedata.Uuids = new List<UUID>(); | ||
736 | updatedata.Offset = offset; | ||
737 | |||
738 | if (offset == Vector2.Zero) | ||
739 | updatedata.UserAPI = rootPresence.ControllingClient; | ||
740 | else | ||
741 | updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata); | ||
742 | |||
743 | updates.Add(offset,updatedata); | ||
744 | } | ||
745 | |||
746 | updates[offset].Locations.Add(locations[i]); | ||
747 | updates[offset].Uuids.Add(uuids[i]); | ||
748 | } | ||
749 | |||
750 | // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is | ||
751 | foreach (Vector2 offset in updates.Keys) | ||
752 | { | ||
753 | if (updates[offset].UserAPI != null) | ||
754 | { | ||
755 | updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations); | ||
756 | } | ||
757 | } | ||
758 | } | ||
759 | |||
760 | /// <summary> | ||
761 | /// Locates a the Client of a particular region in an Array of RegionData based on offset | ||
762 | /// </summary> | ||
763 | /// <param name="offset"></param> | ||
764 | /// <param name="uUID"></param> | ||
765 | /// <param name="rdata"></param> | ||
766 | /// <returns>IClientAPI or null</returns> | ||
767 | private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata) | ||
768 | { | ||
769 | IClientAPI returnclient = null; | ||
770 | foreach (RegionData r in rdata) | ||
771 | { | ||
772 | if (r.Offset.X == offset.X && r.Offset.Y == offset.Y) | ||
773 | { | ||
774 | return r.RegionScene.SceneGraph.GetControllingClient(uUID); | ||
775 | } | ||
776 | } | ||
777 | |||
778 | return returnclient; | ||
779 | } | ||
780 | |||
781 | public void PostInitialise() | ||
782 | { | ||
783 | } | ||
784 | |||
785 | // /// <summary> | ||
786 | // /// TODO: | ||
787 | // /// </summary> | ||
788 | // /// <param name="rdata"></param> | ||
789 | // public void UnCombineRegion(RegionData rdata) | ||
790 | // { | ||
791 | // lock (m_regions) | ||
792 | // { | ||
793 | // if (m_regions.ContainsKey(rdata.RegionId)) | ||
794 | // { | ||
795 | // // uncombine root region and virtual regions | ||
796 | // } | ||
797 | // else | ||
798 | // { | ||
799 | // foreach (RegionConnections r in m_regions.Values) | ||
800 | // { | ||
801 | // foreach (RegionData rd in r.ConnectedRegions) | ||
802 | // { | ||
803 | // if (rd.RegionId == rdata.RegionId) | ||
804 | // { | ||
805 | // // uncombine virtual region | ||
806 | // } | ||
807 | // } | ||
808 | // } | ||
809 | // } | ||
810 | // } | ||
811 | // } | ||
812 | |||
813 | public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion) | ||
814 | { | ||
815 | if (BigRegion.PermissionModule == null) | ||
816 | BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene); | ||
817 | |||
818 | VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions; | ||
819 | VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions; | ||
820 | VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions; | ||
821 | VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags; | ||
822 | VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel; | ||
823 | VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel; | ||
824 | VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel; | ||
825 | VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject; | ||
826 | VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod; | ||
827 | VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject; | ||
828 | VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED | ||
829 | VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED | ||
830 | VirtualRegion.Permissions.OnEditParcelProperties += BigRegion.PermissionModule.CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED | ||
831 | VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage; | ||
832 | VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED | ||
833 | VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED | ||
834 | VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED | ||
835 | VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry; | ||
836 | VirtualRegion.Permissions.OnReturnObjects += BigRegion.PermissionModule.CanReturnObjects; //NOT YET IMPLEMENTED | ||
837 | VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED | ||
838 | VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand; | ||
839 | VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED | ||
840 | VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript; | ||
841 | VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel; | ||
842 | VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject; | ||
843 | VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject; | ||
844 | VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand; | ||
845 | VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED | ||
846 | VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED | ||
847 | VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED | ||
848 | VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED | ||
849 | VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED | ||
850 | VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED | ||
851 | VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED | ||
852 | VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE | ||
853 | VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED | ||
854 | VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED | ||
855 | VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED | ||
856 | VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript; | ||
857 | VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED | ||
858 | VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED | ||
859 | VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED | ||
860 | VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED | ||
861 | VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED | ||
862 | } | ||
863 | |||
864 | #region console commands | ||
865 | |||
866 | public void FixPhantoms(string module, string[] cmdparams) | ||
867 | { | ||
868 | List<Scene> scenes = new List<Scene>(m_startingScenes.Values); | ||
869 | |||
870 | foreach (Scene s in scenes) | ||
871 | { | ||
872 | MainConsole.Instance.OutputFormat("Fixing phantoms for {0}", s.RegionInfo.RegionName); | ||
873 | |||
874 | s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition); | ||
875 | } | ||
876 | } | ||
877 | |||
878 | #endregion | ||
879 | } | ||
880 | } | ||
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs deleted file mode 100644 index ddfe3e0..0000000 --- a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs +++ /dev/null | |||
@@ -1,270 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Interfaces; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | |||
35 | namespace OpenSim.Region.RegionCombinerModule | ||
36 | { | ||
37 | public class RegionCombinerPermissionModule | ||
38 | { | ||
39 | private Scene m_rootScene; | ||
40 | |||
41 | public RegionCombinerPermissionModule(Scene RootScene) | ||
42 | { | ||
43 | m_rootScene = RootScene; | ||
44 | } | ||
45 | |||
46 | #region Permission Override | ||
47 | |||
48 | public bool BypassPermissions() | ||
49 | { | ||
50 | return m_rootScene.Permissions.BypassPermissions(); | ||
51 | } | ||
52 | |||
53 | public void SetBypassPermissions(bool value) | ||
54 | { | ||
55 | m_rootScene.Permissions.SetBypassPermissions(value); | ||
56 | } | ||
57 | |||
58 | public bool PropagatePermissions() | ||
59 | { | ||
60 | return m_rootScene.Permissions.PropagatePermissions(); | ||
61 | } | ||
62 | |||
63 | public uint GenerateClientFlags(UUID userid, UUID objectidid) | ||
64 | { | ||
65 | return m_rootScene.Permissions.GenerateClientFlags(userid,objectidid); | ||
66 | } | ||
67 | |||
68 | public bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene) | ||
69 | { | ||
70 | return m_rootScene.Permissions.CanAbandonParcel(user,parcel); | ||
71 | } | ||
72 | |||
73 | public bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene) | ||
74 | { | ||
75 | return m_rootScene.Permissions.CanReclaimParcel(user, parcel); | ||
76 | } | ||
77 | |||
78 | public bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene) | ||
79 | { | ||
80 | return m_rootScene.Permissions.CanDeedParcel(user, parcel); | ||
81 | } | ||
82 | |||
83 | public bool CanDeedObject(UUID user, UUID @group, Scene scene) | ||
84 | { | ||
85 | return m_rootScene.Permissions.CanDeedObject(user,@group); | ||
86 | } | ||
87 | |||
88 | public bool IsGod(UUID user, Scene requestfromscene) | ||
89 | { | ||
90 | return m_rootScene.Permissions.IsGod(user); | ||
91 | } | ||
92 | |||
93 | public bool CanDuplicateObject(int objectcount, UUID objectid, UUID owner, Scene scene, Vector3 objectposition) | ||
94 | { | ||
95 | return m_rootScene.Permissions.CanDuplicateObject(objectcount, objectid, owner, objectposition); | ||
96 | } | ||
97 | |||
98 | public bool CanDeleteObject(UUID objectid, UUID deleter, Scene scene) | ||
99 | { | ||
100 | return m_rootScene.Permissions.CanDeleteObject(objectid, deleter); | ||
101 | } | ||
102 | |||
103 | public bool CanEditObject(UUID objectid, UUID editorid, Scene scene) | ||
104 | { | ||
105 | return m_rootScene.Permissions.CanEditObject(objectid, editorid); | ||
106 | } | ||
107 | |||
108 | public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene, bool allowManager) | ||
109 | { | ||
110 | return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g, allowManager); | ||
111 | } | ||
112 | |||
113 | public bool CanInstantMessage(UUID user, UUID target, Scene startscene) | ||
114 | { | ||
115 | return m_rootScene.Permissions.CanInstantMessage(user, target); | ||
116 | } | ||
117 | |||
118 | public bool CanInventoryTransfer(UUID user, UUID target, Scene startscene) | ||
119 | { | ||
120 | return m_rootScene.Permissions.CanInventoryTransfer(user, target); | ||
121 | } | ||
122 | |||
123 | public bool CanIssueEstateCommand(UUID user, Scene requestfromscene, bool ownercommand) | ||
124 | { | ||
125 | return m_rootScene.Permissions.CanIssueEstateCommand(user, ownercommand); | ||
126 | } | ||
127 | |||
128 | public bool CanMoveObject(UUID objectid, UUID moverid, Scene scene) | ||
129 | { | ||
130 | return m_rootScene.Permissions.CanMoveObject(objectid, moverid); | ||
131 | } | ||
132 | |||
133 | public bool CanObjectEntry(UUID objectid, bool enteringregion, Vector3 newpoint, Scene scene) | ||
134 | { | ||
135 | return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint); | ||
136 | } | ||
137 | |||
138 | public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene) | ||
139 | { | ||
140 | return m_rootScene.Permissions.CanReturnObjects(land, user, objects); | ||
141 | } | ||
142 | |||
143 | public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene) | ||
144 | { | ||
145 | return m_rootScene.Permissions.CanRezObject(objectcount, owner, objectposition); | ||
146 | } | ||
147 | |||
148 | public bool CanRunConsoleCommand(UUID user, Scene requestfromscene) | ||
149 | { | ||
150 | return m_rootScene.Permissions.CanRunConsoleCommand(user); | ||
151 | } | ||
152 | |||
153 | public bool CanRunScript(UUID script, UUID objectid, UUID user, Scene scene) | ||
154 | { | ||
155 | return m_rootScene.Permissions.CanRunScript(script, objectid, user); | ||
156 | } | ||
157 | |||
158 | public bool CanCompileScript(UUID owneruuid, int scripttype, Scene scene) | ||
159 | { | ||
160 | return m_rootScene.Permissions.CanCompileScript(owneruuid, scripttype); | ||
161 | } | ||
162 | |||
163 | public bool CanSellParcel(UUID user, ILandObject parcel, Scene scene) | ||
164 | { | ||
165 | return m_rootScene.Permissions.CanSellParcel(user, parcel); | ||
166 | } | ||
167 | |||
168 | public bool CanTakeObject(UUID objectid, UUID stealer, Scene scene) | ||
169 | { | ||
170 | return m_rootScene.Permissions.CanTakeObject(objectid, stealer); | ||
171 | } | ||
172 | |||
173 | public bool CanTakeCopyObject(UUID objectid, UUID userid, Scene inscene) | ||
174 | { | ||
175 | return m_rootScene.Permissions.CanTakeObject(objectid, userid); | ||
176 | } | ||
177 | |||
178 | public bool CanTerraformLand(UUID user, Vector3 position, Scene requestfromscene) | ||
179 | { | ||
180 | return m_rootScene.Permissions.CanTerraformLand(user, position); | ||
181 | } | ||
182 | |||
183 | public bool CanLinkObject(UUID user, UUID objectid) | ||
184 | { | ||
185 | return m_rootScene.Permissions.CanLinkObject(user, objectid); | ||
186 | } | ||
187 | |||
188 | public bool CanDelinkObject(UUID user, UUID objectid) | ||
189 | { | ||
190 | return m_rootScene.Permissions.CanDelinkObject(user, objectid); | ||
191 | } | ||
192 | |||
193 | public bool CanBuyLand(UUID user, ILandObject parcel, Scene scene) | ||
194 | { | ||
195 | return m_rootScene.Permissions.CanBuyLand(user, parcel); | ||
196 | } | ||
197 | |||
198 | public bool CanViewNotecard(UUID script, UUID objectid, UUID user, Scene scene) | ||
199 | { | ||
200 | return m_rootScene.Permissions.CanViewNotecard(script, objectid, user); | ||
201 | } | ||
202 | |||
203 | public bool CanViewScript(UUID script, UUID objectid, UUID user, Scene scene) | ||
204 | { | ||
205 | return m_rootScene.Permissions.CanViewScript(script, objectid, user); | ||
206 | } | ||
207 | |||
208 | public bool CanEditNotecard(UUID notecard, UUID objectid, UUID user, Scene scene) | ||
209 | { | ||
210 | return m_rootScene.Permissions.CanEditNotecard(notecard, objectid, user); | ||
211 | } | ||
212 | |||
213 | public bool CanEditScript(UUID script, UUID objectid, UUID user, Scene scene) | ||
214 | { | ||
215 | return m_rootScene.Permissions.CanEditScript(script, objectid, user); | ||
216 | } | ||
217 | |||
218 | public bool CanCreateObjectInventory(int invtype, UUID objectid, UUID userid) | ||
219 | { | ||
220 | return m_rootScene.Permissions.CanCreateObjectInventory(invtype, objectid, userid); | ||
221 | } | ||
222 | |||
223 | public bool CanEditObjectInventory(UUID objectid, UUID editorid, Scene scene) | ||
224 | { | ||
225 | return m_rootScene.Permissions.CanEditObjectInventory(objectid, editorid); | ||
226 | } | ||
227 | |||
228 | public bool CanCopyObjectInventory(UUID itemid, UUID objectid, UUID userid) | ||
229 | { | ||
230 | return m_rootScene.Permissions.CanCopyObjectInventory(itemid, objectid, userid); | ||
231 | } | ||
232 | |||
233 | public bool CanDeleteObjectInventory(UUID itemid, UUID objectid, UUID userid) | ||
234 | { | ||
235 | return m_rootScene.Permissions.CanDeleteObjectInventory(itemid, objectid, userid); | ||
236 | } | ||
237 | |||
238 | public bool CanResetScript(UUID prim, UUID script, UUID user, Scene scene) | ||
239 | { | ||
240 | return m_rootScene.Permissions.CanResetScript(prim, script, user); | ||
241 | } | ||
242 | |||
243 | public bool CanCreateUserInventory(int invtype, UUID userid) | ||
244 | { | ||
245 | return m_rootScene.Permissions.CanCreateUserInventory(invtype, userid); | ||
246 | } | ||
247 | |||
248 | public bool CanCopyUserInventory(UUID itemid, UUID userid) | ||
249 | { | ||
250 | return m_rootScene.Permissions.CanCopyUserInventory(itemid, userid); | ||
251 | } | ||
252 | |||
253 | public bool CanEditUserInventory(UUID itemid, UUID userid) | ||
254 | { | ||
255 | return m_rootScene.Permissions.CanEditUserInventory(itemid, userid); | ||
256 | } | ||
257 | |||
258 | public bool CanDeleteUserInventory(UUID itemid, UUID userid) | ||
259 | { | ||
260 | return m_rootScene.Permissions.CanDeleteUserInventory(itemid, userid); | ||
261 | } | ||
262 | |||
263 | public bool CanTeleport(UUID userid, Scene scene) | ||
264 | { | ||
265 | return m_rootScene.Permissions.CanTeleport(userid); | ||
266 | } | ||
267 | |||
268 | #endregion | ||
269 | } | ||
270 | } | ||
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs deleted file mode 100644 index 6bf1c4a..0000000 --- a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Interfaces; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | |||
35 | namespace OpenSim.Region.RegionCombinerModule | ||
36 | { | ||
37 | public class RegionConnections | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Root Region ID | ||
41 | /// </summary> | ||
42 | public UUID RegionId; | ||
43 | |||
44 | /// <summary> | ||
45 | /// Root Region Scene | ||
46 | /// </summary> | ||
47 | public Scene RegionScene; | ||
48 | |||
49 | /// <summary> | ||
50 | /// LargeLandChannel for combined region | ||
51 | /// </summary> | ||
52 | public ILandChannel RegionLandChannel; | ||
53 | |||
54 | /// <summary> | ||
55 | /// The x map co-ordinate for this region (where each co-ordinate is a Constants.RegionSize block). | ||
56 | /// </summary> | ||
57 | public uint X; | ||
58 | |||
59 | /// <summary> | ||
60 | /// The y co-ordinate for this region (where each cor-odinate is a Constants.RegionSize block). | ||
61 | /// </summary> | ||
62 | public uint Y; | ||
63 | |||
64 | /// <summary> | ||
65 | /// The X meters position of this connection. | ||
66 | /// </summary> | ||
67 | public uint PosX { get { return Util.RegionToWorldLoc(X); } } | ||
68 | |||
69 | /// <summary> | ||
70 | /// The Y meters co-ordinate of this connection. | ||
71 | /// </summary> | ||
72 | public uint PosY { get { return Util.RegionToWorldLoc(Y); } } | ||
73 | |||
74 | /// <summary> | ||
75 | /// The size of the megaregion in meters. | ||
76 | /// </summary> | ||
77 | public uint XEnd; | ||
78 | |||
79 | /// <summary> | ||
80 | /// The size of the megaregion in meters. | ||
81 | /// </summary> | ||
82 | public uint YEnd; | ||
83 | |||
84 | public List<RegionData> ConnectedRegions; | ||
85 | public RegionCombinerPermissionModule PermissionModule; | ||
86 | public RegionCombinerClientEventForwarder ClientEventForwarder; | ||
87 | |||
88 | public void UpdateExtents(Vector3 extents) | ||
89 | { | ||
90 | XEnd = (uint)extents.X; | ||
91 | YEnd = (uint)extents.Y; | ||
92 | } | ||
93 | } | ||
94 | } | ||
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs deleted file mode 100644 index 224ac99..0000000 --- a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace OpenSim.Region.RegionCombinerModule | ||
34 | { | ||
35 | |||
36 | struct RegionCoarseLocationStruct | ||
37 | { | ||
38 | public List<Vector3> Locations; | ||
39 | public List<UUID> Uuids; | ||
40 | public IClientAPI UserAPI; | ||
41 | public Vector2 Offset; | ||
42 | } | ||
43 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs deleted file mode 100644 index 42fca9f..0000000 --- a/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using OpenSim.Region.Framework.Scenes; | ||
30 | |||
31 | namespace OpenSim.Region.RegionCombinerModule | ||
32 | { | ||
33 | public class RegionData | ||
34 | { | ||
35 | public UUID RegionId; | ||
36 | public Scene RegionScene; | ||
37 | // Offset of this region from the base of the root region. | ||
38 | public Vector3 Offset; | ||
39 | } | ||
40 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7a2b24f..319f14c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -3347,24 +3347,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3347 | CheckThreatLevel(ThreatLevel.None, "osGetRegionSize"); | 3347 | CheckThreatLevel(ThreatLevel.None, "osGetRegionSize"); |
3348 | m_host.AddScriptLPS(1); | 3348 | m_host.AddScriptLPS(1); |
3349 | 3349 | ||
3350 | bool isMegaregion; | 3350 | Scene scene = m_ScriptEngine.World; |
3351 | IRegionCombinerModule rcMod = World.RequestModuleInterface<IRegionCombinerModule>(); | 3351 | GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID); |
3352 | if (rcMod != null) | 3352 | return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeY, (float)Constants.RegionHeight); |
3353 | isMegaregion = rcMod.IsRootForMegaregion(World.RegionInfo.RegionID); | ||
3354 | else | ||
3355 | isMegaregion = false; | ||
3356 | |||
3357 | if (isMegaregion) | ||
3358 | { | ||
3359 | Vector2 size = rcMod.GetSizeOfMegaregion(World.RegionInfo.RegionID); | ||
3360 | return new LSL_Vector(size.X, size.Y, Constants.RegionHeight); | ||
3361 | } | ||
3362 | else | ||
3363 | { | ||
3364 | Scene scene = m_ScriptEngine.World; | ||
3365 | GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID); | ||
3366 | return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeY, (float)Constants.RegionHeight); | ||
3367 | } | ||
3368 | } | 3353 | } |
3369 | 3354 | ||
3370 | public int osGetSimulatorMemory() | 3355 | public int osGetSimulatorMemory() |