Merge branch 'master' into httptests
commit
3cf8a58f9d
|
@ -47,7 +47,6 @@ namespace OpenSim.Framework
|
|||
public uint ParentEstateID;
|
||||
public Guid RegionID;
|
||||
public uint timestamp;
|
||||
public Guid ID;
|
||||
|
||||
public GridInstantMessage()
|
||||
{
|
||||
|
@ -68,7 +67,6 @@ namespace OpenSim.Framework
|
|||
binaryBucket = im.binaryBucket;
|
||||
RegionID = im.RegionID;
|
||||
ParentEstateID = im.ParentEstateID;
|
||||
ID = im.ID;
|
||||
|
||||
if (addTimestamp)
|
||||
timestamp = (uint)Util.UnixTimeSinceEpoch();
|
||||
|
@ -78,7 +76,7 @@ namespace OpenSim.Framework
|
|||
string _fromAgentName, UUID _toAgentID,
|
||||
byte _dialog, bool _fromGroup, string _message,
|
||||
UUID _imSessionID, bool _offline, Vector3 _position,
|
||||
byte[] _binaryBucket, UUID _ID, bool addTimestamp)
|
||||
byte[] _binaryBucket, bool addTimestamp)
|
||||
{
|
||||
fromAgentID = _fromAgentID.Guid;
|
||||
fromAgentName = _fromAgentName;
|
||||
|
@ -87,7 +85,6 @@ namespace OpenSim.Framework
|
|||
fromGroup = _fromGroup;
|
||||
message = _message;
|
||||
imSessionID = _imSessionID.Guid;
|
||||
ID = _ID.Guid;
|
||||
|
||||
if (_offline)
|
||||
offline = 1;
|
||||
|
@ -106,22 +103,12 @@ namespace OpenSim.Framework
|
|||
timestamp = (uint)Util.UnixTimeSinceEpoch();
|
||||
}
|
||||
|
||||
public GridInstantMessage(IScene scene, UUID _fromAgentID,
|
||||
string _fromAgentName, UUID _toAgentID,
|
||||
byte _dialog, bool _fromGroup, string _message,
|
||||
UUID _imSessionID, bool _offline, Vector3 _position,
|
||||
byte[] _binaryBucket, bool addTimestamp) : this (scene, _fromAgentID,
|
||||
_fromAgentName, _toAgentID, _dialog, _fromGroup, _message,
|
||||
_imSessionID, _offline, _position, _binaryBucket, UUID.Zero, addTimestamp)
|
||||
{
|
||||
}
|
||||
|
||||
public GridInstantMessage(IScene scene, UUID _fromAgentID,
|
||||
string _fromAgentName, UUID _toAgentID, byte _dialog,
|
||||
string _message, bool _offline,
|
||||
Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
|
||||
_toAgentID, _dialog, false, _message,
|
||||
_fromAgentID ^ _toAgentID, _offline, _position, new byte[0], UUID.Zero, true)
|
||||
_fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -961,11 +961,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
= (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
|
||||
|
||||
msg.AgentData.AgentID = new UUID(im.fromAgentID);
|
||||
msg.AgentData.SessionID = new UUID(im.imSessionID);
|
||||
msg.AgentData.SessionID = UUID.Zero;
|
||||
msg.MessageBlock.FromAgentName = Util.StringToBytes256(im.fromAgentName);
|
||||
msg.MessageBlock.Dialog = im.dialog;
|
||||
msg.MessageBlock.FromGroup = im.fromGroup;
|
||||
msg.MessageBlock.ID = new UUID(im.ID);
|
||||
// this is odd
|
||||
if (im.imSessionID == UUID.Zero.Guid)
|
||||
msg.MessageBlock.ID = new UUID(im.fromAgentID) ^ new UUID(im.toAgentID);
|
||||
else
|
||||
msg.MessageBlock.ID = new UUID(im.imSessionID);
|
||||
msg.MessageBlock.Offline = im.offline;
|
||||
msg.MessageBlock.ParentEstateID = im.ParentEstateID;
|
||||
msg.MessageBlock.Position = im.Position;
|
||||
|
|
|
@ -216,7 +216,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
UUID fromAgentID = UUID.Zero;
|
||||
UUID toAgentID = UUID.Zero;
|
||||
UUID imSessionID = UUID.Zero;
|
||||
UUID imID = UUID.Zero;
|
||||
uint timestamp = 0;
|
||||
string fromAgentName = "";
|
||||
string message = "";
|
||||
|
@ -263,7 +262,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
UUID.TryParse((string)requestData["to_agent_id"], out toAgentID);
|
||||
UUID.TryParse((string)requestData["im_session_id"], out imSessionID);
|
||||
UUID.TryParse((string)requestData["region_id"], out RegionID);
|
||||
UUID.TryParse((string)requestData["id"], out imID);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -391,8 +389,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
gim.ParentEstateID = ParentEstateID;
|
||||
gim.Position = Position;
|
||||
gim.binaryBucket = binaryBucket;
|
||||
gim.ID = imID.Guid;
|
||||
|
||||
|
||||
// Trigger the Instant message in the scene.
|
||||
foreach (Scene scene in m_Scenes)
|
||||
|
@ -702,8 +698,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
gim["from_agent_session"] = UUID.Zero.ToString();
|
||||
gim["to_agent_id"] = msg.toAgentID.ToString();
|
||||
gim["im_session_id"] = msg.imSessionID.ToString();
|
||||
if(msg.ID != Guid.Empty)
|
||||
gim["id"] = msg.ID.ToString();
|
||||
gim["timestamp"] = msg.timestamp.ToString();
|
||||
gim["from_agent_name"] = msg.fromAgentName;
|
||||
gim["message"] = msg.message;
|
||||
|
|
|
@ -173,7 +173,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
private BannedRegionCache m_bannedRegionCache = new BannedRegionCache();
|
||||
|
||||
private IEventQueue m_eqModule;
|
||||
private IRegionCombinerModule m_regionCombinerModule;
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
|
@ -339,7 +338,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return;
|
||||
|
||||
m_eqModule = Scene.RequestModuleInterface<IEventQueue>();
|
||||
m_regionCombinerModule = Scene.RequestModuleInterface<IRegionCombinerModule>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1341,18 +1339,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
protected virtual bool NeedsNewAgent(float viewdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY,
|
||||
int oldsizeX, int oldsizeY, int newsizeX, int newsizeY)
|
||||
{
|
||||
if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
|
||||
{
|
||||
Vector2 swCorner, neCorner;
|
||||
GetMegaregionViewRange(out swCorner, out neCorner);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1} to {2} with new agent check for {3},{4}",
|
||||
Scene.Name, swCorner, neCorner, newRegionX, newRegionY);
|
||||
|
||||
return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y);
|
||||
}
|
||||
|
||||
return Util.IsOutsideView(viewdist, oldRegionX, newRegionX, oldRegionY, newRegionY,
|
||||
oldsizeX, oldsizeY, newsizeX, newsizeY);
|
||||
}
|
||||
|
@ -2205,7 +2191,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
#endregion // NotFoundLocationCache class
|
||||
private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache();
|
||||
|
||||
// needed for current OSG or old grid code
|
||||
// needed for old grid code
|
||||
|
||||
protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py)
|
||||
{
|
||||
|
@ -2375,29 +2361,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the range considered in view of this megaregion (assuming this is a megaregion).
|
||||
/// </summary>
|
||||
/// <remarks>Expressed in 256m units</remarks>
|
||||
/// <param name='swCorner'></param>
|
||||
/// <param name='neCorner'></param>
|
||||
private void GetMegaregionViewRange(out Vector2 swCorner, out Vector2 neCorner)
|
||||
{
|
||||
Vector2 extent = Vector2.Zero;
|
||||
|
||||
if (m_regionCombinerModule != null)
|
||||
{
|
||||
Vector2 megaRegionSize = m_regionCombinerModule.GetSizeOfMegaregion(Scene.RegionInfo.RegionID);
|
||||
extent.X = (float)Util.WorldToRegionLoc((uint)megaRegionSize.X);
|
||||
extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y);
|
||||
}
|
||||
|
||||
swCorner.X = Scene.RegionInfo.RegionLocX - 1;
|
||||
swCorner.Y = Scene.RegionInfo.RegionLocY - 1;
|
||||
neCorner.X = Scene.RegionInfo.RegionLocX + extent.X;
|
||||
neCorner.Y = Scene.RegionInfo.RegionLocY + extent.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the list of online regions that are considered to be neighbours to the given scene.
|
||||
/// </summary>
|
||||
|
@ -2411,14 +2374,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
RegionInfo m_regionInfo = pScene.RegionInfo;
|
||||
List<GridRegion> neighbours;
|
||||
|
||||
// Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
|
||||
// clear what should be done with a "far view" given that megaregions already extended the
|
||||
// view to include everything in the megaregion
|
||||
if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
|
||||
{
|
||||
uint dd = (uint)avatar.RegionViewDistance;
|
||||
|
||||
// until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors
|
||||
// until avatar movement updates client connections, we need to seend at least this current region imediate neighbors
|
||||
uint ddX = Math.Max(dd, Constants.RegionSize);
|
||||
uint ddY = Math.Max(dd, Constants.RegionSize);
|
||||
|
||||
|
@ -2439,18 +2397,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
neighbours
|
||||
= avatar.Scene.GridService.GetRegionRange(
|
||||
m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 swCorner, neCorner;
|
||||
GetMegaregionViewRange(out swCorner, out neCorner);
|
||||
|
||||
neighbours
|
||||
= pScene.GridService.GetRegionRange(
|
||||
m_regionInfo.ScopeID,
|
||||
(int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X),
|
||||
(int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y));
|
||||
}
|
||||
|
||||
// The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1).
|
||||
neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID );
|
||||
|
|
|
@ -522,22 +522,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
|
||||
protected static void WriteRegionInfo(Scene scene, XmlTextWriter xtw)
|
||||
{
|
||||
bool isMegaregion;
|
||||
Vector2 size;
|
||||
|
||||
IRegionCombinerModule rcMod = scene.RequestModuleInterface<IRegionCombinerModule>();
|
||||
|
||||
if (rcMod != null)
|
||||
isMegaregion = rcMod.IsRootForMegaregion(scene.RegionInfo.RegionID);
|
||||
else
|
||||
isMegaregion = false;
|
||||
|
||||
if (isMegaregion)
|
||||
size = rcMod.GetSizeOfMegaregion(scene.RegionInfo.RegionID);
|
||||
else
|
||||
size = new Vector2((float)scene.RegionInfo.RegionSizeX, (float)scene.RegionInfo.RegionSizeY);
|
||||
|
||||
xtw.WriteElementString("is_megaregion", isMegaregion.ToString());
|
||||
xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y));
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public Scene Scene { get; private set; }
|
||||
public IRegionCombinerModule RegionCombinerModule { get; private set; }
|
||||
|
||||
/// <value>
|
||||
/// 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
|
|||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
RegionCombinerModule = scene.RequestModuleInterface<IRegionCombinerModule>();
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using System.IO;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface IRegionCombinerModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Does the given id belong to the root region of a megaregion?
|
||||
/// </summary>
|
||||
bool IsRootForMegaregion(UUID regionId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of megaregion.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Returns size in meters.
|
||||
/// Do not rely on this method remaining the same - this area is actively under development.
|
||||
/// </remarks>
|
||||
/// <param name="sceneId">
|
||||
/// The id of the root region for a megaregion.
|
||||
/// This may change in the future to allow any region id that makes up a megaregion.
|
||||
/// Currently, will throw an exception if this does not match a root region.
|
||||
/// </param>
|
||||
Vector2 GetSizeOfMegaregion(UUID regionId);
|
||||
|
||||
/// <summary>
|
||||
/// Tests to see of position (relative to the region) is within the megaregion
|
||||
/// </summary>
|
||||
bool PositionIsInMegaregion(UUID currentRegion, int xx, int yy);
|
||||
}
|
||||
}
|
|
@ -1,148 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
public class Border
|
||||
{
|
||||
/// <summary>
|
||||
/// Line perpendicular to the Direction Cardinal. Z value is the
|
||||
/// </summary>
|
||||
public Vector3 BorderLine = Vector3.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Direction cardinal of the border, think, 'which side of the region this is'. EX South border: Cardinal.S
|
||||
/// </summary>
|
||||
public Cardinals CrossDirection = Cardinals.N;
|
||||
public uint TriggerRegionX = 0;
|
||||
public uint TriggerRegionY = 0;
|
||||
|
||||
public Border()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Border. The line is perpendicular to the direction cardinal.
|
||||
/// IE: if the direction cardinal is South, the line is West->East
|
||||
/// </summary>
|
||||
/// <param name="lineStart">The starting point for the line of the border.
|
||||
/// The position of an object must be greater then this for this border to trigger.
|
||||
/// Perpendicular to the direction cardinal</param>
|
||||
/// <param name="lineEnd">The ending point for the line of the border.
|
||||
/// The position of an object must be less then this for this border to trigger.
|
||||
/// Perpendicular to the direction cardinal</param>
|
||||
/// <param name="triggerCoordinate">The position that triggers border the border
|
||||
/// cross parallel to the direction cardinal. On the North cardinal, this
|
||||
/// normally 256. On the South cardinal, it's normally 0. Any position past this
|
||||
/// point on the cartesian coordinate will trigger the border cross as long as it
|
||||
/// falls within the line start and the line end.</param>
|
||||
/// <param name="triggerRegionX">When this border triggers, teleport to this regionX
|
||||
/// in the grid</param>
|
||||
/// <param name="triggerRegionY">When this border triggers, teleport to this regionY
|
||||
/// in the grid</param>
|
||||
/// <param name="direction">Cardinal for border direction. Think, 'which side of the
|
||||
/// region is this'</param>
|
||||
public Border(float lineStart, float lineEnd, float triggerCoordinate, uint triggerRegionX,
|
||||
uint triggerRegionY, Cardinals direction)
|
||||
{
|
||||
BorderLine = new Vector3(lineStart,lineEnd,triggerCoordinate);
|
||||
CrossDirection = direction;
|
||||
TriggerRegionX = triggerRegionX;
|
||||
TriggerRegionY = triggerRegionY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests to see if the given position would cross this border.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool TestCross(Vector3 position)
|
||||
{
|
||||
bool result = false;
|
||||
switch (CrossDirection)
|
||||
{
|
||||
case Cardinals.N: // x+0, y+1
|
||||
if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y > BorderLine.Z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Cardinals.NE: // x+1, y+1
|
||||
break;
|
||||
case Cardinals.E: // x+1, y+0
|
||||
if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X > BorderLine.Z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Cardinals.SE: // x+1, y-1
|
||||
break;
|
||||
case Cardinals.S: // x+0, y-1
|
||||
if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Cardinals.SW: // x-1, y-1
|
||||
break;
|
||||
case Cardinals.W: // x-1, y+0
|
||||
if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Cardinals.NW: // x-1, y+1
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public float Extent
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (CrossDirection)
|
||||
{
|
||||
case Cardinals.N:
|
||||
break;
|
||||
case Cardinals.S:
|
||||
break;
|
||||
case Cardinals.W:
|
||||
break;
|
||||
case Cardinals.E:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -430,7 +430,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
private int m_lastFrameTick;
|
||||
|
||||
public bool CombineRegions = false;
|
||||
/// <summary>
|
||||
/// Tick at which the last maintenance run occurred.
|
||||
/// </summary>
|
||||
|
@ -1060,7 +1059,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
|
||||
m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
|
||||
CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
|
||||
|
||||
string[] possibleMapConfigSections = new string[] { "Map", "Startup" };
|
||||
|
||||
|
@ -2925,18 +2923,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (xx < 0 || yy < 0)
|
||||
return false;
|
||||
|
||||
IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>();
|
||||
if (regionCombinerModule == null)
|
||||
{
|
||||
// Regular region. Just check for region size
|
||||
if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY )
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're in a mega-region so see if we are still in that larger region
|
||||
ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -297,8 +297,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </returns>
|
||||
protected internal bool AddRestoredSceneObject(
|
||||
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
|
||||
{
|
||||
if (!m_parentScene.CombineRegions)
|
||||
{
|
||||
// temporary checks to remove after varsize suport
|
||||
float regionSizeX = m_parentScene.RegionInfo.RegionSizeX;
|
||||
|
@ -337,7 +335,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
rootpart.AngularVelocity = Vector3.Zero;
|
||||
rootpart.Acceleration = Vector3.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
|
||||
|
||||
|
|
|
@ -2910,10 +2910,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// Allow move to another sub-region within a megaregion
|
||||
Vector2 regionSize;
|
||||
IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>();
|
||||
if (regionCombinerModule != null)
|
||||
regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
|
||||
else
|
||||
regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
|
||||
|
||||
if (pos.X < 0 || pos.X >= regionSize.X
|
||||
|
@ -2923,20 +2919,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
float terrainHeight;
|
||||
Scene targetScene = m_scene;
|
||||
// Get terrain height for sub-region in a megaregion if necessary
|
||||
if (regionCombinerModule != null)
|
||||
{
|
||||
int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X);
|
||||
int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y);
|
||||
GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y);
|
||||
// If X and Y is NaN, target_region will be null
|
||||
if (target_region == null)
|
||||
return;
|
||||
UUID target_regionID = target_region.RegionID;
|
||||
SceneManager.Instance.TryGetScene(target_region.RegionID, out targetScene);
|
||||
terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)];
|
||||
}
|
||||
else
|
||||
terrainHeight = m_scene.GetGroundHeight(pos.X, pos.Y);
|
||||
|
||||
// dont try to land underground
|
||||
|
|
|
@ -1,340 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class BorderTests : OpenSimTestCase
|
||||
{
|
||||
[Test]
|
||||
public void TestCross()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<Border> testborders = new List<Border>();
|
||||
|
||||
Border NorthBorder = new Border();
|
||||
NorthBorder.BorderLine = new Vector3(0, 256, 256); //<---
|
||||
NorthBorder.CrossDirection = Cardinals.N;
|
||||
testborders.Add(NorthBorder);
|
||||
|
||||
Border SouthBorder = new Border();
|
||||
SouthBorder.BorderLine = new Vector3(0, 256, 0); //--->
|
||||
SouthBorder.CrossDirection = Cardinals.S;
|
||||
testborders.Add(SouthBorder);
|
||||
|
||||
Border EastBorder = new Border();
|
||||
EastBorder.BorderLine = new Vector3(0, 256, 256); //<---
|
||||
EastBorder.CrossDirection = Cardinals.E;
|
||||
testborders.Add(EastBorder);
|
||||
|
||||
Border WestBorder = new Border();
|
||||
WestBorder.BorderLine = new Vector3(0, 256, 0); //--->
|
||||
WestBorder.CrossDirection = Cardinals.W;
|
||||
testborders.Add(WestBorder);
|
||||
|
||||
Vector3 position = new Vector3(200,200,21);
|
||||
|
||||
foreach (Border b in testborders)
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
position = new Vector3(200,280,21);
|
||||
Assert.That(NorthBorder.TestCross(position));
|
||||
|
||||
// Test automatic border crossing
|
||||
// by setting the border crossing aabb to be the whole region
|
||||
position = new Vector3(25,25,21); // safely within one 256m region
|
||||
|
||||
// The Z value of the BorderLine is reversed, making all positions within the region
|
||||
// trigger bordercross
|
||||
|
||||
SouthBorder.BorderLine = new Vector3(0,256,256); // automatic border cross in the region
|
||||
Assert.That(SouthBorder.TestCross(position));
|
||||
|
||||
NorthBorder.BorderLine = new Vector3(0, 256, 0); // automatic border cross in the region
|
||||
Assert.That(NorthBorder.TestCross(position));
|
||||
|
||||
EastBorder.BorderLine = new Vector3(0, 256, 0); // automatic border cross in the region
|
||||
Assert.That(EastBorder.TestCross(position));
|
||||
|
||||
WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region
|
||||
Assert.That(WestBorder.TestCross(position));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCrossSquare512()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<Border> testborders = new List<Border>();
|
||||
|
||||
Border NorthBorder = new Border();
|
||||
NorthBorder.BorderLine = new Vector3(0, 512, 512);
|
||||
NorthBorder.CrossDirection = Cardinals.N;
|
||||
testborders.Add(NorthBorder);
|
||||
|
||||
Border SouthBorder = new Border();
|
||||
SouthBorder.BorderLine = new Vector3(0, 512, 0);
|
||||
SouthBorder.CrossDirection = Cardinals.S;
|
||||
testborders.Add(SouthBorder);
|
||||
|
||||
Border EastBorder = new Border();
|
||||
EastBorder.BorderLine = new Vector3(0, 512, 512);
|
||||
EastBorder.CrossDirection = Cardinals.E;
|
||||
testborders.Add(EastBorder);
|
||||
|
||||
Border WestBorder = new Border();
|
||||
WestBorder.BorderLine = new Vector3(0, 512, 0);
|
||||
WestBorder.CrossDirection = Cardinals.W;
|
||||
testborders.Add(WestBorder);
|
||||
|
||||
Vector3 position = new Vector3(450,220,21);
|
||||
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
//Trigger east border
|
||||
position = new Vector3(513,220,21);
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
if (b.CrossDirection == Cardinals.E)
|
||||
Assert.That(b.TestCross(position));
|
||||
else
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
//Trigger west border
|
||||
position = new Vector3(-1, 220, 21);
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
if (b.CrossDirection == Cardinals.W)
|
||||
Assert.That(b.TestCross(position));
|
||||
else
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
//Trigger north border
|
||||
position = new Vector3(220, 513, 21);
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
if (b.CrossDirection == Cardinals.N)
|
||||
Assert.That(b.TestCross(position));
|
||||
else
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
//Trigger south border
|
||||
position = new Vector3(220, -1, 21);
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
if (b.CrossDirection == Cardinals.S)
|
||||
Assert.That(b.TestCross(position));
|
||||
else
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCrossRectangle512x256()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<Border> testborders = new List<Border>();
|
||||
|
||||
Border NorthBorder = new Border();
|
||||
NorthBorder.BorderLine = new Vector3(0, 512, 256);
|
||||
NorthBorder.CrossDirection = Cardinals.N;
|
||||
testborders.Add(NorthBorder);
|
||||
|
||||
Border SouthBorder = new Border();
|
||||
SouthBorder.BorderLine = new Vector3(0, 512, 0);
|
||||
SouthBorder.CrossDirection = Cardinals.S;
|
||||
testborders.Add(SouthBorder);
|
||||
|
||||
Border EastBorder = new Border();
|
||||
EastBorder.BorderLine = new Vector3(0, 256, 512);
|
||||
EastBorder.CrossDirection = Cardinals.E;
|
||||
testborders.Add(EastBorder);
|
||||
|
||||
Border WestBorder = new Border();
|
||||
WestBorder.BorderLine = new Vector3(0, 256, 0);
|
||||
WestBorder.CrossDirection = Cardinals.W;
|
||||
testborders.Add(WestBorder);
|
||||
|
||||
Vector3 position = new Vector3(450, 220, 21);
|
||||
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
//Trigger east border
|
||||
position = new Vector3(513, 220, 21);
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
if (b.CrossDirection == Cardinals.E)
|
||||
Assert.That(b.TestCross(position));
|
||||
else
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
//Trigger west border
|
||||
position = new Vector3(-1, 220, 21);
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
if (b.CrossDirection == Cardinals.W)
|
||||
Assert.That(b.TestCross(position));
|
||||
else
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
//Trigger north border
|
||||
position = new Vector3(220, 257, 21);
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
if (b.CrossDirection == Cardinals.N)
|
||||
Assert.That(b.TestCross(position));
|
||||
else
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
//Trigger south border
|
||||
position = new Vector3(220, -1, 21);
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
if (b.CrossDirection == Cardinals.S)
|
||||
Assert.That(b.TestCross(position));
|
||||
else
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCrossOdd512x512w256hole()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<Border> testborders = new List<Border>();
|
||||
// 512____
|
||||
// | |
|
||||
// 256__| |___
|
||||
// | |
|
||||
// |______|
|
||||
// 0 | 512
|
||||
// 256
|
||||
|
||||
// Compound North border since the hole is at the top
|
||||
Border NorthBorder1 = new Border();
|
||||
NorthBorder1.BorderLine = new Vector3(0, 256, 512);
|
||||
NorthBorder1.CrossDirection = Cardinals.N;
|
||||
testborders.Add(NorthBorder1);
|
||||
|
||||
Border NorthBorder2 = new Border();
|
||||
NorthBorder2.BorderLine = new Vector3(256, 512, 256);
|
||||
NorthBorder2.CrossDirection = Cardinals.N;
|
||||
testborders.Add(NorthBorder2);
|
||||
|
||||
Border SouthBorder = new Border();
|
||||
SouthBorder.BorderLine = new Vector3(0, 512, 0);
|
||||
SouthBorder.CrossDirection = Cardinals.S;
|
||||
testborders.Add(SouthBorder);
|
||||
|
||||
//Compound East border
|
||||
Border EastBorder1 = new Border();
|
||||
EastBorder1.BorderLine = new Vector3(0, 256, 512);
|
||||
EastBorder1.CrossDirection = Cardinals.E;
|
||||
testborders.Add(EastBorder1);
|
||||
|
||||
Border EastBorder2 = new Border();
|
||||
EastBorder2.BorderLine = new Vector3(257, 512, 256);
|
||||
EastBorder2.CrossDirection = Cardinals.E;
|
||||
testborders.Add(EastBorder2);
|
||||
|
||||
|
||||
|
||||
Border WestBorder = new Border();
|
||||
WestBorder.BorderLine = new Vector3(0, 512, 0);
|
||||
WestBorder.CrossDirection = Cardinals.W;
|
||||
testborders.Add(WestBorder);
|
||||
|
||||
Vector3 position = new Vector3(450, 220, 21);
|
||||
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
position = new Vector3(220, 450, 21);
|
||||
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
bool result = false;
|
||||
int bordersTriggered = 0;
|
||||
|
||||
position = new Vector3(450, 450, 21);
|
||||
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
{
|
||||
bordersTriggered++;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
Assert.That(result);
|
||||
Assert.That(bordersTriggered == 2);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.RegionCombinerModule
|
||||
{
|
||||
public class RegionCombinerClientEventForwarder
|
||||
{
|
||||
private Scene m_rootScene;
|
||||
private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>();
|
||||
private Dictionary<UUID,RegionCombinerIndividualEventForwarder> m_forwarders = new Dictionary<UUID,
|
||||
RegionCombinerIndividualEventForwarder>();
|
||||
|
||||
public RegionCombinerClientEventForwarder(RegionConnections rootScene)
|
||||
{
|
||||
m_rootScene = rootScene.RegionScene;
|
||||
}
|
||||
|
||||
public void AddSceneToEventForwarding(Scene virtualScene)
|
||||
{
|
||||
lock (m_virtScene)
|
||||
{
|
||||
if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
|
||||
{
|
||||
m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene);
|
||||
}
|
||||
}
|
||||
|
||||
lock (m_forwarders)
|
||||
{
|
||||
// TODO: Fix this to unregister if this happens
|
||||
if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID))
|
||||
m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
|
||||
|
||||
RegionCombinerIndividualEventForwarder forwarder =
|
||||
new RegionCombinerIndividualEventForwarder(m_rootScene, virtualScene);
|
||||
m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder);
|
||||
|
||||
virtualScene.EventManager.OnNewClient += forwarder.ClientConnect;
|
||||
virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveSceneFromEventForwarding (Scene virtualScene)
|
||||
{
|
||||
lock (m_forwarders)
|
||||
{
|
||||
RegionCombinerIndividualEventForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID];
|
||||
virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect;
|
||||
virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed;
|
||||
m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
|
||||
}
|
||||
lock (m_virtScene)
|
||||
{
|
||||
if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
|
||||
{
|
||||
m_virtScene.Remove(virtualScene.RegionInfo.originRegionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.Avatar.Attachments;
|
||||
using OpenSim.Region.CoreModules.Avatar.Gods;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.RegionCombinerModule
|
||||
{
|
||||
public class RegionCombinerIndividualEventForwarder
|
||||
{
|
||||
private Scene m_rootScene;
|
||||
private Scene m_virtScene;
|
||||
|
||||
public RegionCombinerIndividualEventForwarder(Scene rootScene, Scene virtScene)
|
||||
{
|
||||
m_rootScene = rootScene;
|
||||
m_virtScene = virtScene;
|
||||
}
|
||||
|
||||
public void ClientConnect(IClientAPI client)
|
||||
{
|
||||
m_virtScene.UnSubscribeToClientPrimEvents(client);
|
||||
m_virtScene.UnSubscribeToClientPrimRezEvents(client);
|
||||
m_virtScene.UnSubscribeToClientInventoryEvents(client);
|
||||
if(m_virtScene.AttachmentsModule != null)
|
||||
((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
|
||||
//m_virtScene.UnSubscribeToClientTeleportEvents(client);
|
||||
m_virtScene.UnSubscribeToClientScriptEvents(client);
|
||||
|
||||
IGodsModule virtGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
|
||||
if (virtGodsModule != null)
|
||||
((GodsModule)virtGodsModule).UnsubscribeFromClientEvents(client);
|
||||
|
||||
m_virtScene.UnSubscribeToClientNetworkEvents(client);
|
||||
|
||||
m_rootScene.SubscribeToClientPrimEvents(client);
|
||||
client.OnAddPrim += LocalAddNewPrim;
|
||||
client.OnRezObject += LocalRezObject;
|
||||
|
||||
m_rootScene.SubscribeToClientInventoryEvents(client);
|
||||
if (m_rootScene.AttachmentsModule != null)
|
||||
((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
|
||||
//m_rootScene.SubscribeToClientTeleportEvents(client);
|
||||
m_rootScene.SubscribeToClientScriptEvents(client);
|
||||
|
||||
IGodsModule rootGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
|
||||
if (rootGodsModule != null)
|
||||
((GodsModule)rootGodsModule).UnsubscribeFromClientEvents(client);
|
||||
|
||||
m_rootScene.SubscribeToClientNetworkEvents(client);
|
||||
}
|
||||
|
||||
public void ClientClosed(UUID clientid, Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fixes position based on the region the Rez event came in on
|
||||
/// </summary>
|
||||
/// <param name="remoteclient"></param>
|
||||
/// <param name="itemid"></param>
|
||||
/// <param name="rayend"></param>
|
||||
/// <param name="raystart"></param>
|
||||
/// <param name="raytargetid"></param>
|
||||
/// <param name="bypassraycast"></param>
|
||||
/// <param name="rayendisintersection"></param>
|
||||
/// <param name="rezselected"></param>
|
||||
/// <param name="removeitem"></param>
|
||||
/// <param name="fromtaskid"></param>
|
||||
private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
|
||||
UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
|
||||
UUID fromtaskid)
|
||||
{
|
||||
int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
|
||||
int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
|
||||
rayend.X += differenceX * (int)Constants.RegionSize;
|
||||
rayend.Y += differenceY * (int)Constants.RegionSize;
|
||||
raystart.X += differenceX * (int)Constants.RegionSize;
|
||||
raystart.Y += differenceY * (int)Constants.RegionSize;
|
||||
|
||||
m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
|
||||
rayendisintersection, rezselected, removeitem, fromtaskid);
|
||||
}
|
||||
/// <summary>
|
||||
/// Fixes position based on the region the AddPrimShape event came in on
|
||||
/// </summary>
|
||||
/// <param name="ownerid"></param>
|
||||
/// <param name="groupid"></param>
|
||||
/// <param name="rayend"></param>
|
||||
/// <param name="rot"></param>
|
||||
/// <param name="shape"></param>
|
||||
/// <param name="bypassraycast"></param>
|
||||
/// <param name="raystart"></param>
|
||||
/// <param name="raytargetid"></param>
|
||||
/// <param name="rayendisintersection"></param>
|
||||
private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot,
|
||||
PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid,
|
||||
byte rayendisintersection)
|
||||
{
|
||||
int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
|
||||
int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
|
||||
rayend.X += differenceX * (int)Constants.RegionSize;
|
||||
rayend.Y += differenceY * (int)Constants.RegionSize;
|
||||
raystart.X += differenceX * (int)Constants.RegionSize;
|
||||
raystart.Y += differenceY * (int)Constants.RegionSize;
|
||||
m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
|
||||
rayendisintersection);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,202 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.CoreModules.World.Land;
|
||||
|
||||
namespace OpenSim.Region.RegionCombinerModule
|
||||
{
|
||||
public class RegionCombinerLargeLandChannel : ILandChannel
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private RegionData RegData;
|
||||
private ILandChannel RootRegionLandChannel;
|
||||
private readonly List<RegionData> RegionConnections;
|
||||
|
||||
#region ILandChannel Members
|
||||
|
||||
public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
|
||||
List<RegionData> regionConnections)
|
||||
{
|
||||
RegData = regData;
|
||||
RootRegionLandChannel = rootRegionLandChannel;
|
||||
RegionConnections = regionConnections;
|
||||
}
|
||||
|
||||
public List<ILandObject> ParcelsNearPoint(Vector3 position)
|
||||
{
|
||||
//m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
|
||||
return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
|
||||
}
|
||||
|
||||
public List<ILandObject> AllParcels()
|
||||
{
|
||||
return RootRegionLandChannel.AllParcels();
|
||||
}
|
||||
|
||||
public void Clear(bool setupDefaultParcel)
|
||||
{
|
||||
RootRegionLandChannel.Clear(setupDefaultParcel);
|
||||
}
|
||||
|
||||
public ILandObject GetLandObject(Vector3 position)
|
||||
{
|
||||
return GetLandObject(position.X, position.Y);
|
||||
}
|
||||
|
||||
public ILandObject GetLandObject(int x, int y)
|
||||
{
|
||||
return GetLandObject((float)x, (float)y);
|
||||
|
||||
// m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
|
||||
//
|
||||
// if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
|
||||
// {
|
||||
// return RootRegionLandChannel.GetLandObject(x, y);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// int offsetX = (x / (int)Constants.RegionSize);
|
||||
// int offsetY = (y / (int)Constants.RegionSize);
|
||||
// offsetX *= (int)Constants.RegionSize;
|
||||
// offsetY *= (int)Constants.RegionSize;
|
||||
//
|
||||
// foreach (RegionData regionData in RegionConnections)
|
||||
// {
|
||||
// if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[REGION COMBINER LARGE LAND CHANNEL]: Found region {0} at offset {1},{2}",
|
||||
// regionData.RegionScene.Name, offsetX, offsetY);
|
||||
//
|
||||
// return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
|
||||
// }
|
||||
// }
|
||||
// //ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
|
||||
// //obj.LandData.Name = "NO LAND";
|
||||
// //return obj;
|
||||
// }
|
||||
//
|
||||
// m_log.DebugFormat("[REGION COMBINER LARGE LAND CHANNEL]: No region found at {0},{1}, returning null", x, y);
|
||||
//
|
||||
// return null;
|
||||
}
|
||||
|
||||
public ILandObject GetLandObject(int localID)
|
||||
{
|
||||
// XXX: Possibly should be looking in every land channel, not just the root.
|
||||
return RootRegionLandChannel.GetLandObject(localID);
|
||||
}
|
||||
|
||||
public ILandObject GetLandObject(float x, float y)
|
||||
{
|
||||
// m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
|
||||
|
||||
if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
|
||||
{
|
||||
return RootRegionLandChannel.GetLandObject(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
int offsetX = (int)(x/(int) Constants.RegionSize);
|
||||
int offsetY = (int)(y/(int) Constants.RegionSize);
|
||||
offsetX *= (int) Constants.RegionSize;
|
||||
offsetY *= (int) Constants.RegionSize;
|
||||
|
||||
foreach (RegionData regionData in RegionConnections)
|
||||
{
|
||||
if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[REGION COMBINER LARGE LAND CHANNEL]: Found region {0} at offset {1},{2}",
|
||||
// regionData.RegionScene.Name, offsetX, offsetY);
|
||||
|
||||
return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
|
||||
}
|
||||
}
|
||||
|
||||
// ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
|
||||
// obj.LandData.Name = "NO LAND";
|
||||
// return obj;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[REGION COMBINER LARGE LAND CHANNEL]: No region found at {0},{1}, returning null", x, y);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsForcefulBansAllowed()
|
||||
{
|
||||
return RootRegionLandChannel.IsForcefulBansAllowed();
|
||||
}
|
||||
|
||||
public void UpdateLandObject(int localID, LandData data)
|
||||
{
|
||||
RootRegionLandChannel.UpdateLandObject(localID, data);
|
||||
}
|
||||
|
||||
public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
|
||||
{
|
||||
RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id);
|
||||
}
|
||||
|
||||
public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
|
||||
{
|
||||
RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id);
|
||||
}
|
||||
|
||||
public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
|
||||
{
|
||||
RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
|
||||
}
|
||||
|
||||
public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
|
||||
{
|
||||
RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
|
||||
}
|
||||
|
||||
public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
|
||||
{
|
||||
RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
|
||||
}
|
||||
|
||||
public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
|
||||
{
|
||||
RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
|
||||
}
|
||||
|
||||
public void sendClientInitialLandInfo(IClientAPI remoteClient) { }
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,880 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Client;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.PhysicsModules.SharedBase;
|
||||
using Mono.Addins;
|
||||
|
||||
namespace OpenSim.Region.RegionCombinerModule
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionCombinerModule")]
|
||||
public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static string LogHeader = "[REGION COMBINER MODULE]";
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "RegionCombinerModule"; }
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is this module enabled?
|
||||
/// </summary>
|
||||
private bool m_combineContiguousRegions = false;
|
||||
|
||||
/// <summary>
|
||||
/// This holds the root regions for the megaregions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Usually there is only ever one megaregion (and hence only one entry here).
|
||||
/// </remarks>
|
||||
private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
|
||||
|
||||
/// <summary>
|
||||
/// The scenes that comprise the megaregion.
|
||||
/// </summary>
|
||||
private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig myConfig = source.Configs["Startup"];
|
||||
m_combineContiguousRegions = myConfig.GetBoolean("CombineContiguousRegions", false);
|
||||
if (m_combineContiguousRegions)
|
||||
m_log.ErrorFormat("[REGION COMBINER MODULE]: THIS MODULE IS BEING MARKED OBSOLETE AND MAY SOON BE REMOVED. PLEASE USE VARREGIONS INSTEAD.");
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"RegionCombinerModule", false, "fix-phantoms", "fix-phantoms",
|
||||
"Fixes phantom objects after an import to a megaregion or a change from a megaregion back to normal regions",
|
||||
FixPhantoms);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (m_combineContiguousRegions)
|
||||
scene.RegisterModuleInterface<IRegionCombinerModule>(this);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
lock (m_startingScenes)
|
||||
m_startingScenes.Remove(scene.RegionInfo.originRegionID);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
lock (m_startingScenes)
|
||||
m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
|
||||
|
||||
if (m_combineContiguousRegions)
|
||||
{
|
||||
RegionLoadedDoWork(scene);
|
||||
|
||||
scene.EventManager.OnNewPresence += NewPresence;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRootForMegaregion(UUID regionId)
|
||||
{
|
||||
lock (m_regions)
|
||||
return m_regions.ContainsKey(regionId);
|
||||
}
|
||||
|
||||
public Vector2 GetSizeOfMegaregion(UUID regionId)
|
||||
{
|
||||
lock (m_regions)
|
||||
{
|
||||
if (m_regions.ContainsKey(regionId))
|
||||
{
|
||||
RegionConnections rootConn = m_regions[regionId];
|
||||
|
||||
return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd);
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception(string.Format("Region with id {0} not found", regionId));
|
||||
}
|
||||
|
||||
// Test to see if this postiion (relative to the region) is within the area covered
|
||||
// by this megaregion.
|
||||
public bool PositionIsInMegaregion(UUID currentRegion, int xx, int yy)
|
||||
{
|
||||
bool ret = false;
|
||||
if (xx < 0 || yy < 0)
|
||||
return ret;
|
||||
|
||||
foreach (RegionConnections rootRegion in m_regions.Values)
|
||||
{
|
||||
if (currentRegion == rootRegion.RegionId)
|
||||
{
|
||||
// The caller is in the root region so this is an easy test
|
||||
if (xx < rootRegion.XEnd && yy < rootRegion.YEnd)
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Maybe the caller is in one of the sub-regions
|
||||
foreach (RegionData childRegion in rootRegion.ConnectedRegions)
|
||||
{
|
||||
if (currentRegion == childRegion.RegionId)
|
||||
{
|
||||
// This is a child. Diddle the offsets and check if in
|
||||
Vector3 positionInMegaregion = childRegion.Offset;
|
||||
positionInMegaregion.X += xx;
|
||||
positionInMegaregion.Y += yy;
|
||||
if (positionInMegaregion.X < rootRegion.XEnd && positionInMegaregion.Y < rootRegion.YEnd)
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void NewPresence(ScenePresence presence)
|
||||
{
|
||||
if (presence.IsChildAgent)
|
||||
{
|
||||
byte[] throttleData;
|
||||
|
||||
try
|
||||
{
|
||||
throttleData = presence.ControllingClient.GetThrottlesPacked(1);
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (throttleData == null)
|
||||
return;
|
||||
|
||||
if (throttleData.Length == 0)
|
||||
return;
|
||||
|
||||
if (throttleData.Length != 28)
|
||||
return;
|
||||
|
||||
byte[] adjData;
|
||||
int pos = 0;
|
||||
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
byte[] newData = new byte[7 * 4];
|
||||
Buffer.BlockCopy(throttleData, 0, newData, 0, 7 * 4);
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
Array.Reverse(newData, i * 4, 4);
|
||||
|
||||
adjData = newData;
|
||||
}
|
||||
else
|
||||
{
|
||||
adjData = throttleData;
|
||||
}
|
||||
|
||||
// 0.125f converts from bits to bytes
|
||||
int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||
int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||
int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||
int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||
int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||
int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||
int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||
// State is a subcategory of task that we allocate a percentage to
|
||||
|
||||
|
||||
//int total = resend + land + wind + cloud + task + texture + asset;
|
||||
|
||||
byte[] data = new byte[7 * 4];
|
||||
int ii = 0;
|
||||
|
||||
Buffer.BlockCopy(Utils.FloatToBytes(resend), 0, data, ii, 4); ii += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes(land * 50), 0, data, ii, 4); ii += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes(wind), 0, data, ii, 4); ii += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes(cloud), 0, data, ii, 4); ii += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes(task), 0, data, ii, 4); ii += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes(texture), 0, data, ii, 4); ii += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes(asset), 0, data, ii, 4);
|
||||
|
||||
try
|
||||
{
|
||||
presence.ControllingClient.SetChildAgentThrottle(data);
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RegionLoadedDoWork(Scene scene)
|
||||
{
|
||||
/*
|
||||
// For testing on a single instance
|
||||
if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
|
||||
return;
|
||||
//
|
||||
*/
|
||||
|
||||
RegionConnections newConn = new RegionConnections();
|
||||
newConn.ConnectedRegions = new List<RegionData>();
|
||||
newConn.RegionScene = scene;
|
||||
newConn.RegionLandChannel = scene.LandChannel;
|
||||
newConn.RegionId = scene.RegionInfo.originRegionID;
|
||||
newConn.X = scene.RegionInfo.RegionLocX;
|
||||
newConn.Y = scene.RegionInfo.RegionLocY;
|
||||
newConn.XEnd = scene.RegionInfo.RegionSizeX;
|
||||
newConn.YEnd = scene.RegionInfo.RegionSizeX;
|
||||
|
||||
lock (m_regions)
|
||||
{
|
||||
bool connectedYN = false;
|
||||
|
||||
foreach (RegionConnections rootConn in m_regions.Values)
|
||||
{
|
||||
#region commented
|
||||
/*
|
||||
// If we're one region over +x +y
|
||||
//xxy
|
||||
//xxx
|
||||
//xxx
|
||||
if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
|
||||
== (regionConnections.X * (int)Constants.RegionSize))
|
||||
&& (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
|
||||
== (regionConnections.Y * (int)Constants.RegionSize)))
|
||||
{
|
||||
Vector3 offset = Vector3.Zero;
|
||||
offset.X = (((regionConnections.X * (int) Constants.RegionSize)) -
|
||||
((conn.X * (int) Constants.RegionSize)));
|
||||
offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) -
|
||||
((conn.Y * (int) Constants.RegionSize)));
|
||||
|
||||
Vector3 extents = Vector3.Zero;
|
||||
extents.Y = regionConnections.YEnd + conn.YEnd;
|
||||
extents.X = conn.XEnd + conn.XEnd;
|
||||
|
||||
m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}. Offset: {2}. Extents:{3}",
|
||||
conn.RegionScene.RegionInfo.RegionName,
|
||||
regionConnections.RegionScene.RegionInfo.RegionName,
|
||||
offset, extents);
|
||||
|
||||
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
|
||||
|
||||
connectedYN = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
//If we're one region over x +y
|
||||
//xxx
|
||||
//xxx
|
||||
//xyx
|
||||
if ((((int)conn.X * (int)Constants.RegionSize)
|
||||
== (regionConnections.X * (int)Constants.RegionSize))
|
||||
&& (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
|
||||
== (regionConnections.Y * (int)Constants.RegionSize)))
|
||||
{
|
||||
Vector3 offset = Vector3.Zero;
|
||||
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
|
||||
((conn.X * (int)Constants.RegionSize)));
|
||||
offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
|
||||
((conn.Y * (int)Constants.RegionSize)));
|
||||
|
||||
Vector3 extents = Vector3.Zero;
|
||||
extents.Y = regionConnections.YEnd + conn.YEnd;
|
||||
extents.X = conn.XEnd;
|
||||
|
||||
m_log.DebugFormat("Scene: {0} to the north of Scene{1}. Offset: {2}. Extents:{3}",
|
||||
conn.RegionScene.RegionInfo.RegionName,
|
||||
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||
|
||||
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
|
||||
connectedYN = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// If we're one region over -x +y
|
||||
//xxx
|
||||
//xxx
|
||||
//yxx
|
||||
if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
|
||||
== (regionConnections.X * (int)Constants.RegionSize))
|
||||
&& (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
|
||||
== (regionConnections.Y * (int)Constants.RegionSize)))
|
||||
{
|
||||
Vector3 offset = Vector3.Zero;
|
||||
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
|
||||
((conn.X * (int)Constants.RegionSize)));
|
||||
offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
|
||||
((conn.Y * (int)Constants.RegionSize)));
|
||||
|
||||
Vector3 extents = Vector3.Zero;
|
||||
extents.Y = regionConnections.YEnd + conn.YEnd;
|
||||
extents.X = conn.XEnd + conn.XEnd;
|
||||
|
||||
m_log.DebugFormat("Scene: {0} to the northeast of Scene. Offset: {2}. Extents:{3}",
|
||||
conn.RegionScene.RegionInfo.RegionName,
|
||||
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||
|
||||
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
|
||||
|
||||
|
||||
connectedYN = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// If we're one region over -x y
|
||||
//xxx
|
||||
//yxx
|
||||
//xxx
|
||||
if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
|
||||
== (regionConnections.X * (int)Constants.RegionSize))
|
||||
&& (((int)conn.Y * (int)Constants.RegionSize)
|
||||
== (regionConnections.Y * (int)Constants.RegionSize)))
|
||||
{
|
||||
Vector3 offset = Vector3.Zero;
|
||||
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
|
||||
((conn.X * (int)Constants.RegionSize)));
|
||||
offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
|
||||
((conn.Y * (int)Constants.RegionSize)));
|
||||
|
||||
Vector3 extents = Vector3.Zero;
|
||||
extents.Y = regionConnections.YEnd;
|
||||
extents.X = conn.XEnd + conn.XEnd;
|
||||
|
||||
m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}",
|
||||
conn.RegionScene.RegionInfo.RegionName,
|
||||
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||
|
||||
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
|
||||
|
||||
connectedYN = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// If we're one region over -x -y
|
||||
//yxx
|
||||
//xxx
|
||||
//xxx
|
||||
if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
|
||||
== (regionConnections.X * (int)Constants.RegionSize))
|
||||
&& (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
|
||||
== (regionConnections.Y * (int)Constants.RegionSize)))
|
||||
{
|
||||
Vector3 offset = Vector3.Zero;
|
||||
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
|
||||
((conn.X * (int)Constants.RegionSize)));
|
||||
offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
|
||||
((conn.Y * (int)Constants.RegionSize)));
|
||||
|
||||
Vector3 extents = Vector3.Zero;
|
||||
extents.Y = regionConnections.YEnd + conn.YEnd;
|
||||
extents.X = conn.XEnd + conn.XEnd;
|
||||
|
||||
m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
|
||||
conn.RegionScene.RegionInfo.RegionName,
|
||||
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||
|
||||
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
|
||||
|
||||
connectedYN = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
#endregion
|
||||
|
||||
|
||||
// Check to see if this new region is adjacent to the root region.
|
||||
// Note that we expect the regions to be combined from the root region outward
|
||||
// thus the requirement for the ordering in the configuration files.
|
||||
|
||||
// If we're one region over +x y (i.e. root region is to the west)
|
||||
//xxx
|
||||
//xxy
|
||||
//xxx
|
||||
if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY)
|
||||
{
|
||||
connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
|
||||
break;
|
||||
}
|
||||
|
||||
// If we're one region over x +y (i.e. root region is to the south)
|
||||
//xyx
|
||||
//xxx
|
||||
//xxx
|
||||
if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
|
||||
{
|
||||
connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
|
||||
break;
|
||||
}
|
||||
|
||||
// If we're one region over +x +y (i.e. root region is to the south-west)
|
||||
//xxy
|
||||
//xxx
|
||||
//xxx
|
||||
if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
|
||||
{
|
||||
connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If !connectYN means that this region is a root region
|
||||
if (!connectedYN)
|
||||
{
|
||||
DoWorkForRootRegion(newConn, scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
||||
{
|
||||
// Offset (in meters) from the base of this region to the base of the root region.
|
||||
Vector3 offset = Vector3.Zero;
|
||||
offset.X = newConn.PosX - rootConn.PosX;
|
||||
offset.Y = newConn.PosY - rootConn.PosY;
|
||||
|
||||
// The new total size of the region (in meters)
|
||||
// We just extend the X and Y dimensions so the extent might temporarily include areas without regions.
|
||||
Vector3 extents = Vector3.Zero;
|
||||
extents.X = Math.Max(rootConn.XEnd, offset.X + newConn.RegionScene.RegionInfo.RegionSizeX);
|
||||
extents.Y = Math.Max(rootConn.YEnd, offset.Y + newConn.RegionScene.RegionInfo.RegionSizeY);
|
||||
|
||||
rootConn.UpdateExtents(extents);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}",
|
||||
rootConn.RegionScene.RegionInfo.RegionName,
|
||||
newConn.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||
|
||||
RegionData ConnectedRegion = new RegionData();
|
||||
ConnectedRegion.Offset = offset;
|
||||
ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
|
||||
ConnectedRegion.RegionScene = scene;
|
||||
rootConn.ConnectedRegions.Add(ConnectedRegion);
|
||||
|
||||
// Inform root region Physics about the extents of this region
|
||||
rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
||||
|
||||
// Inform Child region that it needs to forward it's terrain to the root region
|
||||
scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
||||
|
||||
// Reset Terrain.. since terrain loads before we get here, we need to load
|
||||
// it again so it loads in the root region
|
||||
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
||||
|
||||
// Create a client event forwarder and add this region's events to the root region.
|
||||
if (rootConn.ClientEventForwarder != null)
|
||||
rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* 20140215 radams1: The border stuff was removed and the addition of regions to the mega-regions
|
||||
* was generalized. These functions are not needed for the generalized solution but left for reference.
|
||||
private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
||||
{
|
||||
Vector3 offset = Vector3.Zero;
|
||||
offset.X = newConn.PosX - rootConn.PosX;
|
||||
offset.Y = newConn.PosY - rootConn.PosY;
|
||||
|
||||
Vector3 extents = Vector3.Zero;
|
||||
extents.Y = newConn.YEnd + rootConn.YEnd;
|
||||
extents.X = rootConn.XEnd;
|
||||
rootConn.UpdateExtents(extents);
|
||||
|
||||
RegionData ConnectedRegion = new RegionData();
|
||||
ConnectedRegion.Offset = offset;
|
||||
ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
|
||||
ConnectedRegion.RegionScene = scene;
|
||||
rootConn.ConnectedRegions.Add(ConnectedRegion);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[REGION COMBINER MODULE]: Root region {0} is to the south of region {1}, Offset: {2}, Extents: {3}",
|
||||
rootConn.RegionScene.RegionInfo.RegionName,
|
||||
newConn.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||
|
||||
rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
||||
scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
||||
|
||||
// Reset Terrain.. since terrain normally loads first.
|
||||
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
||||
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
||||
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
||||
|
||||
if (rootConn.ClientEventForwarder != null)
|
||||
rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
||||
{
|
||||
Vector3 offset = Vector3.Zero;
|
||||
offset.X = newConn.PosX - rootConn.PosX;
|
||||
offset.Y = newConn.PosY - rootConn.PosY;
|
||||
|
||||
Vector3 extents = Vector3.Zero;
|
||||
|
||||
// We do not want to inflate the extents for regions strictly to the NE of the root region, since this
|
||||
// would double count regions strictly to the north and east that have already been added.
|
||||
// extents.Y = regionConnections.YEnd + conn.YEnd;
|
||||
// extents.X = regionConnections.XEnd + conn.XEnd;
|
||||
// conn.UpdateExtents(extents);
|
||||
|
||||
extents.Y = rootConn.YEnd;
|
||||
extents.X = rootConn.XEnd;
|
||||
|
||||
RegionData ConnectedRegion = new RegionData();
|
||||
ConnectedRegion.Offset = offset;
|
||||
ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
|
||||
ConnectedRegion.RegionScene = scene;
|
||||
|
||||
rootConn.ConnectedRegions.Add(ConnectedRegion);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}",
|
||||
rootConn.RegionScene.RegionInfo.RegionName,
|
||||
newConn.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||
|
||||
rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
||||
scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
||||
|
||||
// Reset Terrain.. since terrain normally loads first.
|
||||
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
||||
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
||||
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
||||
|
||||
if (rootConn.ClientEventForwarder != null)
|
||||
rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
|
||||
|
||||
return true;
|
||||
|
||||
//scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
|
||||
}
|
||||
*/
|
||||
|
||||
private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene)
|
||||
{
|
||||
m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName);
|
||||
|
||||
RegionData rdata = new RegionData();
|
||||
rdata.Offset = Vector3.Zero;
|
||||
rdata.RegionId = scene.RegionInfo.originRegionID;
|
||||
rdata.RegionScene = scene;
|
||||
// save it's land channel
|
||||
rootConn.RegionLandChannel = scene.LandChannel;
|
||||
|
||||
// Substitue our landchannel
|
||||
RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
|
||||
rootConn.ConnectedRegions);
|
||||
|
||||
scene.LandChannel = lnd;
|
||||
|
||||
// Forward the permissions modules of each of the connected regions to the root region
|
||||
lock (m_regions)
|
||||
{
|
||||
foreach (RegionData r in rootConn.ConnectedRegions)
|
||||
{
|
||||
ForwardPermissionRequests(rootConn, r.RegionScene);
|
||||
}
|
||||
|
||||
// Create the root region's Client Event Forwarder
|
||||
rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
|
||||
|
||||
// Sets up the CoarseLocationUpdate forwarder for this root region
|
||||
scene.EventManager.OnNewPresence += SetCoarseLocationDelegate;
|
||||
|
||||
// Adds this root region to a dictionary of regions that are connectable
|
||||
m_regions.Add(scene.RegionInfo.originRegionID, rootConn);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetCoarseLocationDelegate(ScenePresence presence)
|
||||
{
|
||||
presence.SetSendCoarseLocationMethod(SendCoarseLocationUpdates);
|
||||
}
|
||||
|
||||
// This delegate was refactored for non-combined regions.
|
||||
// This combined region version will not use the pre-compiled lists of locations and ids
|
||||
private void SendCoarseLocationUpdates(UUID sceneId, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
|
||||
{
|
||||
RegionConnections connectiondata = null;
|
||||
lock (m_regions)
|
||||
{
|
||||
if (m_regions.ContainsKey(sceneId))
|
||||
connectiondata = m_regions[sceneId];
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
List<Vector3> CoarseLocations = new List<Vector3>();
|
||||
List<UUID> AvatarUUIDs = new List<UUID>();
|
||||
|
||||
connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
if (sp.UUID != presence.UUID)
|
||||
{
|
||||
CoarseLocations.Add(sp.AbsolutePosition);
|
||||
AvatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
});
|
||||
|
||||
DistributeCoarseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
|
||||
}
|
||||
|
||||
private void DistributeCoarseLocationUpdates(List<Vector3> locations, List<UUID> uuids,
|
||||
RegionConnections connectiondata, ScenePresence rootPresence)
|
||||
{
|
||||
RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
|
||||
//List<IClientAPI> clients = new List<IClientAPI>();
|
||||
Dictionary<Vector2, RegionCoarseLocationStruct> updates = new Dictionary<Vector2, RegionCoarseLocationStruct>();
|
||||
|
||||
// Root Region entry
|
||||
RegionCoarseLocationStruct rootupdatedata = new RegionCoarseLocationStruct();
|
||||
rootupdatedata.Locations = new List<Vector3>();
|
||||
rootupdatedata.Uuids = new List<UUID>();
|
||||
rootupdatedata.Offset = Vector2.Zero;
|
||||
|
||||
rootupdatedata.UserAPI = rootPresence.ControllingClient;
|
||||
|
||||
if (rootupdatedata.UserAPI != null)
|
||||
updates.Add(Vector2.Zero, rootupdatedata);
|
||||
|
||||
//Each Region needs an entry or we will end up with dead minimap dots
|
||||
foreach (RegionData regiondata in rdata)
|
||||
{
|
||||
Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
|
||||
RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct();
|
||||
updatedata.Locations = new List<Vector3>();
|
||||
updatedata.Uuids = new List<UUID>();
|
||||
updatedata.Offset = offset;
|
||||
|
||||
if (offset == Vector2.Zero)
|
||||
updatedata.UserAPI = rootPresence.ControllingClient;
|
||||
else
|
||||
updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
|
||||
|
||||
if (updatedata.UserAPI != null)
|
||||
updates.Add(offset, updatedata);
|
||||
}
|
||||
|
||||
// go over the locations and assign them to an IClientAPI
|
||||
for (int i = 0; i < locations.Count; i++)
|
||||
//{locations[i]/(int) Constants.RegionSize;
|
||||
{
|
||||
Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize,
|
||||
(int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z);
|
||||
Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize,
|
||||
pPosition.Y*(int) Constants.RegionSize);
|
||||
|
||||
if (!updates.ContainsKey(offset))
|
||||
{
|
||||
// This shouldn't happen
|
||||
RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct();
|
||||
updatedata.Locations = new List<Vector3>();
|
||||
updatedata.Uuids = new List<UUID>();
|
||||
updatedata.Offset = offset;
|
||||
|
||||
if (offset == Vector2.Zero)
|
||||
updatedata.UserAPI = rootPresence.ControllingClient;
|
||||
else
|
||||
updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
|
||||
|
||||
updates.Add(offset,updatedata);
|
||||
}
|
||||
|
||||
updates[offset].Locations.Add(locations[i]);
|
||||
updates[offset].Uuids.Add(uuids[i]);
|
||||
}
|
||||
|
||||
// Send out the CoarseLocationupdates from their respective client connection based on where the avatar is
|
||||
foreach (Vector2 offset in updates.Keys)
|
||||
{
|
||||
if (updates[offset].UserAPI != null)
|
||||
{
|
||||
updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locates a the Client of a particular region in an Array of RegionData based on offset
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="uUID"></param>
|
||||
/// <param name="rdata"></param>
|
||||
/// <returns>IClientAPI or null</returns>
|
||||
private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
|
||||
{
|
||||
IClientAPI returnclient = null;
|
||||
foreach (RegionData r in rdata)
|
||||
{
|
||||
if (r.Offset.X == offset.X && r.Offset.Y == offset.Y)
|
||||
{
|
||||
return r.RegionScene.SceneGraph.GetControllingClient(uUID);
|
||||
}
|
||||
}
|
||||
|
||||
return returnclient;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// TODO:
|
||||
// /// </summary>
|
||||
// /// <param name="rdata"></param>
|
||||
// public void UnCombineRegion(RegionData rdata)
|
||||
// {
|
||||
// lock (m_regions)
|
||||
// {
|
||||
// if (m_regions.ContainsKey(rdata.RegionId))
|
||||
// {
|
||||
// // uncombine root region and virtual regions
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// foreach (RegionConnections r in m_regions.Values)
|
||||
// {
|
||||
// foreach (RegionData rd in r.ConnectedRegions)
|
||||
// {
|
||||
// if (rd.RegionId == rdata.RegionId)
|
||||
// {
|
||||
// // uncombine virtual region
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
|
||||
{
|
||||
if (BigRegion.PermissionModule == null)
|
||||
BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene);
|
||||
|
||||
VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions;
|
||||
VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions;
|
||||
VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions;
|
||||
VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags;
|
||||
VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel;
|
||||
VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel;
|
||||
VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel;
|
||||
VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject;
|
||||
VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod;
|
||||
VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
|
||||
VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnEditParcelProperties += BigRegion.PermissionModule.CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
|
||||
VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
|
||||
VirtualRegion.Permissions.OnReturnObjects += BigRegion.PermissionModule.CanReturnObjects; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
|
||||
VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript;
|
||||
VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel;
|
||||
VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject;
|
||||
VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject;
|
||||
VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand;
|
||||
VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
|
||||
VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
|
||||
VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
|
||||
VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
|
||||
}
|
||||
|
||||
#region console commands
|
||||
|
||||
public void FixPhantoms(string module, string[] cmdparams)
|
||||
{
|
||||
List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
|
||||
|
||||
foreach (Scene s in scenes)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Fixing phantoms for {0}", s.RegionInfo.RegionName);
|
||||
|
||||
s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,270 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.RegionCombinerModule
|
||||
{
|
||||
public class RegionCombinerPermissionModule
|
||||
{
|
||||
private Scene m_rootScene;
|
||||
|
||||
public RegionCombinerPermissionModule(Scene RootScene)
|
||||
{
|
||||
m_rootScene = RootScene;
|
||||
}
|
||||
|
||||
#region Permission Override
|
||||
|
||||
public bool BypassPermissions()
|
||||
{
|
||||
return m_rootScene.Permissions.BypassPermissions();
|
||||
}
|
||||
|
||||
public void SetBypassPermissions(bool value)
|
||||
{
|
||||
m_rootScene.Permissions.SetBypassPermissions(value);
|
||||
}
|
||||
|
||||
public bool PropagatePermissions()
|
||||
{
|
||||
return m_rootScene.Permissions.PropagatePermissions();
|
||||
}
|
||||
|
||||
public uint GenerateClientFlags(UUID userid, UUID objectidid)
|
||||
{
|
||||
return m_rootScene.Permissions.GenerateClientFlags(userid,objectidid);
|
||||
}
|
||||
|
||||
public bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanAbandonParcel(user,parcel);
|
||||
}
|
||||
|
||||
public bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanReclaimParcel(user, parcel);
|
||||
}
|
||||
|
||||
public bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanDeedParcel(user, parcel);
|
||||
}
|
||||
|
||||
public bool CanDeedObject(UUID user, UUID @group, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanDeedObject(user,@group);
|
||||
}
|
||||
|
||||
public bool IsGod(UUID user, Scene requestfromscene)
|
||||
{
|
||||
return m_rootScene.Permissions.IsGod(user);
|
||||
}
|
||||
|
||||
public bool CanDuplicateObject(int objectcount, UUID objectid, UUID owner, Scene scene, Vector3 objectposition)
|
||||
{
|
||||
return m_rootScene.Permissions.CanDuplicateObject(objectcount, objectid, owner, objectposition);
|
||||
}
|
||||
|
||||
public bool CanDeleteObject(UUID objectid, UUID deleter, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanDeleteObject(objectid, deleter);
|
||||
}
|
||||
|
||||
public bool CanEditObject(UUID objectid, UUID editorid, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanEditObject(objectid, editorid);
|
||||
}
|
||||
|
||||
public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene, bool allowManager)
|
||||
{
|
||||
return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g, allowManager);
|
||||
}
|
||||
|
||||
public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanInstantMessage(user, target);
|
||||
}
|
||||
|
||||
public bool CanInventoryTransfer(UUID user, UUID target, Scene startscene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanInventoryTransfer(user, target);
|
||||
}
|
||||
|
||||
public bool CanIssueEstateCommand(UUID user, Scene requestfromscene, bool ownercommand)
|
||||
{
|
||||
return m_rootScene.Permissions.CanIssueEstateCommand(user, ownercommand);
|
||||
}
|
||||
|
||||
public bool CanMoveObject(UUID objectid, UUID moverid, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanMoveObject(objectid, moverid);
|
||||
}
|
||||
|
||||
public bool CanObjectEntry(UUID objectid, bool enteringregion, Vector3 newpoint, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint);
|
||||
}
|
||||
|
||||
public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanReturnObjects(land, user, objects);
|
||||
}
|
||||
|
||||
public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanRezObject(objectcount, owner, objectposition);
|
||||
}
|
||||
|
||||
public bool CanRunConsoleCommand(UUID user, Scene requestfromscene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanRunConsoleCommand(user);
|
||||
}
|
||||
|
||||
public bool CanRunScript(UUID script, UUID objectid, UUID user, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanRunScript(script, objectid, user);
|
||||
}
|
||||
|
||||
public bool CanCompileScript(UUID owneruuid, int scripttype, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanCompileScript(owneruuid, scripttype);
|
||||
}
|
||||
|
||||
public bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanSellParcel(user, parcel);
|
||||
}
|
||||
|
||||
public bool CanTakeObject(UUID objectid, UUID stealer, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanTakeObject(objectid, stealer);
|
||||
}
|
||||
|
||||
public bool CanTakeCopyObject(UUID objectid, UUID userid, Scene inscene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanTakeObject(objectid, userid);
|
||||
}
|
||||
|
||||
public bool CanTerraformLand(UUID user, Vector3 position, Scene requestfromscene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanTerraformLand(user, position);
|
||||
}
|
||||
|
||||
public bool CanLinkObject(UUID user, UUID objectid)
|
||||
{
|
||||
return m_rootScene.Permissions.CanLinkObject(user, objectid);
|
||||
}
|
||||
|
||||
public bool CanDelinkObject(UUID user, UUID objectid)
|
||||
{
|
||||
return m_rootScene.Permissions.CanDelinkObject(user, objectid);
|
||||
}
|
||||
|
||||
public bool CanBuyLand(UUID user, ILandObject parcel, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanBuyLand(user, parcel);
|
||||
}
|
||||
|
||||
public bool CanViewNotecard(UUID script, UUID objectid, UUID user, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanViewNotecard(script, objectid, user);
|
||||
}
|
||||
|
||||
public bool CanViewScript(UUID script, UUID objectid, UUID user, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanViewScript(script, objectid, user);
|
||||
}
|
||||
|
||||
public bool CanEditNotecard(UUID notecard, UUID objectid, UUID user, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanEditNotecard(notecard, objectid, user);
|
||||
}
|
||||
|
||||
public bool CanEditScript(UUID script, UUID objectid, UUID user, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanEditScript(script, objectid, user);
|
||||
}
|
||||
|
||||
public bool CanCreateObjectInventory(int invtype, UUID objectid, UUID userid)
|
||||
{
|
||||
return m_rootScene.Permissions.CanCreateObjectInventory(invtype, objectid, userid);
|
||||
}
|
||||
|
||||
public bool CanEditObjectInventory(UUID objectid, UUID editorid, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanEditObjectInventory(objectid, editorid);
|
||||
}
|
||||
|
||||
public bool CanCopyObjectInventory(UUID itemid, UUID objectid, UUID userid)
|
||||
{
|
||||
return m_rootScene.Permissions.CanCopyObjectInventory(itemid, objectid, userid);
|
||||
}
|
||||
|
||||
public bool CanDeleteObjectInventory(UUID itemid, UUID objectid, UUID userid)
|
||||
{
|
||||
return m_rootScene.Permissions.CanDeleteObjectInventory(itemid, objectid, userid);
|
||||
}
|
||||
|
||||
public bool CanResetScript(UUID prim, UUID script, UUID user, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanResetScript(prim, script, user);
|
||||
}
|
||||
|
||||
public bool CanCreateUserInventory(int invtype, UUID userid)
|
||||
{
|
||||
return m_rootScene.Permissions.CanCreateUserInventory(invtype, userid);
|
||||
}
|
||||
|
||||
public bool CanCopyUserInventory(UUID itemid, UUID userid)
|
||||
{
|
||||
return m_rootScene.Permissions.CanCopyUserInventory(itemid, userid);
|
||||
}
|
||||
|
||||
public bool CanEditUserInventory(UUID itemid, UUID userid)
|
||||
{
|
||||
return m_rootScene.Permissions.CanEditUserInventory(itemid, userid);
|
||||
}
|
||||
|
||||
public bool CanDeleteUserInventory(UUID itemid, UUID userid)
|
||||
{
|
||||
return m_rootScene.Permissions.CanDeleteUserInventory(itemid, userid);
|
||||
}
|
||||
|
||||
public bool CanTeleport(UUID userid, Scene scene)
|
||||
{
|
||||
return m_rootScene.Permissions.CanTeleport(userid);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.RegionCombinerModule
|
||||
{
|
||||
public class RegionConnections
|
||||
{
|
||||
/// <summary>
|
||||
/// Root Region ID
|
||||
/// </summary>
|
||||
public UUID RegionId;
|
||||
|
||||
/// <summary>
|
||||
/// Root Region Scene
|
||||
/// </summary>
|
||||
public Scene RegionScene;
|
||||
|
||||
/// <summary>
|
||||
/// LargeLandChannel for combined region
|
||||
/// </summary>
|
||||
public ILandChannel RegionLandChannel;
|
||||
|
||||
/// <summary>
|
||||
/// The x map co-ordinate for this region (where each co-ordinate is a Constants.RegionSize block).
|
||||
/// </summary>
|
||||
public uint X;
|
||||
|
||||
/// <summary>
|
||||
/// The y co-ordinate for this region (where each cor-odinate is a Constants.RegionSize block).
|
||||
/// </summary>
|
||||
public uint Y;
|
||||
|
||||
/// <summary>
|
||||
/// The X meters position of this connection.
|
||||
/// </summary>
|
||||
public uint PosX { get { return Util.RegionToWorldLoc(X); } }
|
||||
|
||||
/// <summary>
|
||||
/// The Y meters co-ordinate of this connection.
|
||||
/// </summary>
|
||||
public uint PosY { get { return Util.RegionToWorldLoc(Y); } }
|
||||
|
||||
/// <summary>
|
||||
/// The size of the megaregion in meters.
|
||||
/// </summary>
|
||||
public uint XEnd;
|
||||
|
||||
/// <summary>
|
||||
/// The size of the megaregion in meters.
|
||||
/// </summary>
|
||||
public uint YEnd;
|
||||
|
||||
public List<RegionData> ConnectedRegions;
|
||||
public RegionCombinerPermissionModule PermissionModule;
|
||||
public RegionCombinerClientEventForwarder ClientEventForwarder;
|
||||
|
||||
public void UpdateExtents(Vector3 extents)
|
||||
{
|
||||
XEnd = (uint)extents.X;
|
||||
YEnd = (uint)extents.Y;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.RegionCombinerModule
|
||||
{
|
||||
|
||||
struct RegionCoarseLocationStruct
|
||||
{
|
||||
public List<Vector3> Locations;
|
||||
public List<UUID> Uuids;
|
||||
public IClientAPI UserAPI;
|
||||
public Vector2 Offset;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.RegionCombinerModule
|
||||
{
|
||||
public class RegionData
|
||||
{
|
||||
public UUID RegionId;
|
||||
public Scene RegionScene;
|
||||
// Offset of this region from the base of the root region.
|
||||
public Vector3 Offset;
|
||||
}
|
||||
}
|
|
@ -3347,25 +3347,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
CheckThreatLevel(ThreatLevel.None, "osGetRegionSize");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
bool isMegaregion;
|
||||
IRegionCombinerModule rcMod = World.RequestModuleInterface<IRegionCombinerModule>();
|
||||
if (rcMod != null)
|
||||
isMegaregion = rcMod.IsRootForMegaregion(World.RegionInfo.RegionID);
|
||||
else
|
||||
isMegaregion = false;
|
||||
|
||||
if (isMegaregion)
|
||||
{
|
||||
Vector2 size = rcMod.GetSizeOfMegaregion(World.RegionInfo.RegionID);
|
||||
return new LSL_Vector(size.X, size.Y, Constants.RegionHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
Scene scene = m_ScriptEngine.World;
|
||||
GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID);
|
||||
return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeY, (float)Constants.RegionHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public int osGetSimulatorMemory()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue