Merge branch 'master' into vehicles

This commit is contained in:
Melanie
2009-10-15 21:14:13 +01:00
63 changed files with 2254 additions and 1996 deletions

View File

@@ -0,0 +1,37 @@
/*
* 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;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IHyperAssetService
{
string GetUserAssetServer(UUID userID);
string GetSimAssetServer();
}
}

View File

@@ -35,6 +35,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Clients;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
//using HyperGrid.Framework;
@@ -52,13 +53,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
private Scene m_scene;
private IHyperlinkService m_hyper;
IHyperlinkService HyperlinkService
private IHyperAssetService m_hyper;
IHyperAssetService HyperlinkAssets
{
get
{
if (m_hyper == null)
m_hyper = m_scene.RequestModuleInterface<IHyperlinkService>();
m_hyper = m_scene.RequestModuleInterface<IHyperAssetService>();
return m_hyper;
}
}
@@ -99,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
if (asset != null)
{
m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID);
m_log.DebugFormat("[HGScene]: Copied asset {0} from {1} to local asset server. ", asset.ID, url);
return asset;
}
return null;
@@ -129,6 +130,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
}
m_scene.AssetService.Store(asset1);
m_log.DebugFormat("[HGScene]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
}
return true;
}
@@ -167,34 +169,32 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
public void Get(UUID assetID, UUID ownerID)
{
if (!HyperlinkService.IsLocalUser(ownerID))
// Get the item from the remote asset server onto the local AssetCache
// and place an entry in m_assetMap
string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID);
if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer()))
{
// Get the item from the remote asset server onto the local AssetCache
// and place an entry in m_assetMap
m_log.Debug("[HGScene]: Fetching object " + assetID + " from asset server " + userAssetURL);
AssetBase asset = FetchAsset(userAssetURL, assetID);
string userAssetURL = UserAssetURL(ownerID);
if (userAssetURL != null)
if (asset != null)
{
m_log.Debug("[HGScene]: Fetching object " + assetID + " to asset server " + userAssetURL);
AssetBase asset = FetchAsset(userAssetURL, assetID);
// OK, now fetch the inside.
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
foreach (UUID uuid in ids.Keys)
FetchAsset(userAssetURL, uuid);
if (asset != null)
{
m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL);
m_log.DebugFormat("[HGScene]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL);
// OK, now fetch the inside.
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
foreach (UUID uuid in ids.Keys)
FetchAsset(userAssetURL, uuid);
}
else
m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
}
else
m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");
m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
}
else
m_log.Debug("[HGScene]: user's asset server is the local region's asset server");
}
//public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
@@ -225,44 +225,38 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
public void Post(UUID assetID, UUID ownerID)
{
if (!HyperlinkService.IsLocalUser(ownerID))
{
// Post the item from the local AssetCache onto the remote asset server
// and place an entry in m_assetMap
string userAssetURL = UserAssetURL(ownerID);
if (userAssetURL != null)
string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID);
if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer()))
{
m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
if (asset != null)
{
m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
if (asset != null)
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
foreach (UUID uuid in ids.Keys)
{
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
foreach (UUID uuid in ids.Keys)
{
asset = m_scene.AssetService.Get(uuid.ToString());
if (asset != null)
m_log.DebugFormat("[HGScene]: Posting {0} {1}", asset.Type.ToString(), asset.Name);
else
m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid);
PostAsset(userAssetURL, asset);
}
if (ids.Count > 0) // maybe it succeeded...
m_log.DebugFormat("[HGScene]: Successfully posted item {0} to remote asset server {1}", assetID, userAssetURL);
asset = m_scene.AssetService.Get(uuid.ToString());
if (asset == null)
m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid);
else
m_log.WarnFormat("[HGScene]: Could not post asset {0} to remote asset server {1}", assetID, userAssetURL);
PostAsset(userAssetURL, asset);
}
else
m_log.Debug("[HGScene]: Something wrong with asset, it could not be found");
// maybe all pieces got there...
m_log.DebugFormat("[HGScene]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL);
}
else
m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");
m_log.DebugFormat("[HGScene]: Something wrong with asset {0}, it could not be found", assetID);
}
else
m_log.Debug("[HGScene]: user's asset server is local region's asset server");
}
#endregion

View File

@@ -32,6 +32,7 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes.Hypergrid
{
@@ -41,6 +42,21 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private HGAssetMapper m_assMapper;
public HGAssetMapper AssetMapper
{
get { return m_assMapper; }
}
private IHyperAssetService m_hyper;
private IHyperAssetService HyperAssets
{
get
{
if (m_hyper == null)
m_hyper = RequestModuleInterface<IHyperAssetService>();
return m_hyper;
}
}
#endregion
@@ -140,6 +156,16 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
}
protected override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
{
string userAssetServer = HyperAssets.GetUserAssetServer(sender);
if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer()))
m_assMapper.Get(item.AssetID, sender);
userAssetServer = HyperAssets.GetUserAssetServer(receiver);
if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer()))
m_assMapper.Post(item.AssetID, receiver);
}
#endregion

View File

@@ -408,7 +408,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual InventoryItemBase GiveInventoryItem(
UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId)
{
Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
//Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
InventoryItemBase item = new InventoryItemBase(itemId, senderId);
item = InventoryService.GetItem(item);
@@ -472,7 +472,8 @@ namespace OpenSim.Region.Framework.Scenes
itemCopy.SalePrice = item.SalePrice;
itemCopy.SaleType = item.SaleType;
InventoryService.AddItem(itemCopy);
if (InventoryService.AddItem(itemCopy))
TransferInventoryAssets(itemCopy, senderId, recipient);
if (!Permissions.BypassPermissions())
{
@@ -494,6 +495,10 @@ namespace OpenSim.Region.Framework.Scenes
}
protected virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
{
}
/// <summary>
/// Give an entire inventory folder from one user to another. The entire contents (including all descendent
/// folders) is given.

View File

@@ -390,6 +390,32 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerScriptReset(part.LocalId, itemID);
}
}
void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
{
// TODO: don't create new blocks if recycling an old packet
List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
for (int i = 0; i < args.Count; i++)
{
ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
effect.AgentID = args[i].AgentID;
effect.Color = args[i].Color;
effect.Duration = args[i].Duration;
effect.ID = args[i].ID;
effect.Type = args[i].Type;
effect.TypeData = args[i].TypeData;
effectBlock.Add(effect);
}
ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray();
ClientManager.ForEach(
delegate(IClientAPI client)
{
if (client.AgentId != remoteClient.AgentId)
client.SendViewerEffect(effectBlockArray);
}
);
}
/// <summary>
/// Handle a fetch inventory request from the client

View File

@@ -117,6 +117,8 @@ namespace OpenSim.Region.Framework.Scenes
private volatile bool m_backingup = false;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
protected string m_simulatorVersion = "OpenSimulator Server";
@@ -246,8 +248,7 @@ namespace OpenSim.Region.Framework.Scenes
private int m_update_physics = 1;
private int m_update_entitymovement = 1;
private int m_update_entities = 1; // Run through all objects checking for updates
private int m_update_entitiesquick = 200; // Run through objects that have scheduled updates checking for updates
private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
private int m_update_presences = 1; // Update scene presence movements
private int m_update_events = 1;
private int m_update_backup = 200;
@@ -867,7 +868,7 @@ namespace OpenSim.Region.Framework.Scenes
Thread.Sleep(500);
// Stop all client threads.
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(true); });
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
// Stop updating the scene objects and agents.
//m_heartbeatTimer.Close();
@@ -979,28 +980,7 @@ namespace OpenSim.Region.Framework.Scenes
maintc = Environment.TickCount;
TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
// Aquire a lock so only one update call happens at once
//updateLock.WaitOne();
float physicsFPS = 0;
//m_log.Info("sadfadf" + m_neighbours.Count.ToString());
int agentsInScene = m_sceneGraph.GetRootAgentCount() + m_sceneGraph.GetChildAgentCount();
if (agentsInScene > 21)
{
if (m_update_entities == 1)
{
m_update_entities = 5;
StatsReporter.SetUpdateMS(6000);
}
}
else
{
if (m_update_entities == 5)
{
m_update_entities = 1;
StatsReporter.SetUpdateMS(3000);
}
}
frameMS = Environment.TickCount;
try
@@ -1013,30 +993,17 @@ namespace OpenSim.Region.Framework.Scenes
m_frame = 0;
otherMS = Environment.TickCount;
// run through all entities looking for updates (slow)
if (m_frame % m_update_entities == 0)
{
/* // Adam Experimental
if (m_updateEntitiesThread == null)
{
m_updateEntitiesThread = new Thread(m_sceneGraph.UpdateEntities);
ThreadTracker.Add(m_updateEntitiesThread);
}
// Check if any objects have reached their targets
CheckAtTargets();
// Update SceneObjectGroups that have scheduled themselves for updates
// Objects queue their updates onto all scene presences
if (m_frame % m_update_objects == 0)
m_sceneGraph.UpdateObjectGroups();
if (m_updateEntitiesThread.ThreadState == ThreadState.Stopped)
m_updateEntitiesThread.Start();
*/
m_sceneGraph.UpdateEntities();
}
// run through entities that have scheduled themselves for
// updates looking for updates(faster)
if (m_frame % m_update_entitiesquick == 0)
m_sceneGraph.ProcessUpdates();
// Run through scenepresences looking for updates
// Run through all ScenePresences looking for updates
// Presence updates and queued object updates for each presence are sent to clients
if (m_frame % m_update_presences == 0)
m_sceneGraph.UpdatePresences();
@@ -1140,6 +1107,31 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void AddGroupTarget(SceneObjectGroup grp)
{
lock(m_groupsWithTargets)
m_groupsWithTargets[grp.UUID] = grp;
}
public void RemoveGroupTarget(SceneObjectGroup grp)
{
lock(m_groupsWithTargets)
m_groupsWithTargets.Remove(grp.UUID);
}
private void CheckAtTargets()
{
lock (m_groupsWithTargets)
{
foreach (KeyValuePair<UUID, SceneObjectGroup> kvp in m_groupsWithTargets)
{
kvp.Value.checkAtTargets();
}
}
}
/// <summary>
/// Send out simstats data to all clients
/// </summary>
@@ -1186,10 +1178,10 @@ namespace OpenSim.Region.Framework.Scenes
if (!m_backingup)
{
m_backingup = true;
Thread backupthread = new Thread(Backup);
backupthread.Name = "BackupWriter";
backupthread.IsBackground = true;
backupthread.Start();
System.ComponentModel.BackgroundWorker backupWorker = new System.ComponentModel.BackgroundWorker();
backupWorker.DoWork += delegate(object sender, System.ComponentModel.DoWorkEventArgs e) { Backup(); };
backupWorker.RunWorkerAsync();
}
}
@@ -1780,36 +1772,87 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pos = attemptedPosition;
int changeX = 1;
int changeY = 1;
if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W))
{
if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
{
//Border crossedBorderx = GetCrossedBorder(attemptedPosition,Cardinals.W);
//Border crossedBordery = GetCrossedBorder(attemptedPosition, Cardinals.S);
Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
if (crossedBorderx.BorderLine.Z > 0)
{
pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize);
}
else
pos.X = ((pos.X + Constants.RegionSize));
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
pos.X = ((pos.X + Constants.RegionSize));
pos.Y = ((pos.Y + Constants.RegionSize));
if (crossedBordery.BorderLine.Z > 0)
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
(uint)((thisy - 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
(uint)((thisy - changeY) * Constants.RegionSize));
// x - 1
// y - 1
}
else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
{
pos.X = ((pos.X + Constants.RegionSize));
pos.Y = ((pos.Y - Constants.RegionSize));
Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
if (crossedBorderx.BorderLine.Z > 0)
{
pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.X = ((pos.X + Constants.RegionSize));
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
if (crossedBordery.BorderLine.Z > 0)
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
(uint)((thisy + 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
(uint)((thisy + changeY) * Constants.RegionSize));
// x - 1
// y + 1
}
else
{
pos.X = ((pos.X + Constants.RegionSize));
Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
if (crossedBorderx.BorderLine.Z > 0)
{
pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.X = ((pos.X + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint) ((thisx - 1)*Constants.RegionSize),
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
(uint) (thisy*Constants.RegionSize));
// x - 1
}
@@ -1818,11 +1861,23 @@ namespace OpenSim.Region.Framework.Scenes
{
if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
{
pos.X = ((pos.X - Constants.RegionSize));
pos.Y = ((pos.Y + Constants.RegionSize));
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
if (crossedBordery.BorderLine.Z > 0)
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
(uint)((thisy - 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
(uint)((thisy - changeY) * Constants.RegionSize));
// x + 1
// y - 1
}
@@ -1831,8 +1886,8 @@ namespace OpenSim.Region.Framework.Scenes
pos.X = ((pos.X - Constants.RegionSize));
pos.Y = ((pos.Y - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
(uint)((thisy + 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
(uint)((thisy + changeY) * Constants.RegionSize));
// x + 1
// y + 1
}
@@ -1840,16 +1895,26 @@ namespace OpenSim.Region.Framework.Scenes
{
pos.X = ((pos.X - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint) ((thisx + 1)*Constants.RegionSize),
= Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
(uint) (thisy*Constants.RegionSize));
// x + 1
}
}
else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
{
pos.Y = ((pos.Y + Constants.RegionSize));
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
if (crossedBordery.BorderLine.Z > 0)
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize));
// y - 1
}
else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
@@ -1857,7 +1922,7 @@ namespace OpenSim.Region.Framework.Scenes
pos.Y = ((pos.Y - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize));
// y + 1
}
@@ -2363,6 +2428,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="client"></param>
public override void AddNewClient(IClientAPI client)
{
ClientManager.Add(client);
CheckHeartbeat();
SubscribeToClientEvents(client);
ScenePresence presence;
@@ -2572,6 +2639,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void SubscribeToClientNetworkEvents(IClientAPI client)
{
client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats;
client.OnViewerEffect += ProcessViewerEffect;
}
protected virtual void UnsubscribeToClientEvents(IClientAPI client)
@@ -2726,11 +2794,9 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client)
{
client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats;
client.OnViewerEffect -= ProcessViewerEffect;
}
/// <summary>
/// Teleport an avatar to their home region
/// </summary>
@@ -3003,7 +3069,9 @@ namespace OpenSim.Region.Framework.Scenes
agentTransactions.RemoveAgentAssetTransactions(agentID);
}
// Remove the avatar from the scene
m_sceneGraph.RemoveScenePresence(agentID);
ClientManager.Remove(agentID);
try
{
@@ -3052,16 +3120,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Closes all endpoints with the circuitcode provided.
/// </summary>
/// <param name="circuitcode">Circuit Code of the endpoint to close</param>
public override void CloseAllAgents(uint circuitcode)
{
// Called by ClientView to kill all circuit codes
ClientManager.CloseAllAgents(circuitcode);
}
/// <summary>
/// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
/// </summary>
@@ -3383,7 +3441,7 @@ namespace OpenSim.Region.Framework.Scenes
loggingOffUser.ControllingClient.Kick(message);
// Give them a second to receive the message!
Thread.Sleep(1000);
loggingOffUser.ControllingClient.Close(true);
loggingOffUser.ControllingClient.Close();
}
else
{
@@ -3554,7 +3612,7 @@ namespace OpenSim.Region.Framework.Scenes
presence.ControllingClient.SendShutdownConnectionNotice();
}
presence.ControllingClient.Close(true);
presence.ControllingClient.Close();
return true;
}

View File

@@ -196,8 +196,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="agentID"></param>
public abstract void RemoveClient(UUID agentID);
public abstract void CloseAllAgents(uint circuitcode);
#endregion
/// <summary>

View File

@@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes
protected RegionInfo m_regInfo;
protected Scene m_parentScene;
protected Dictionary<UUID, EntityBase> m_updateList = new Dictionary<UUID, EntityBase>();
protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>();
protected int m_numRootAgents = 0;
protected int m_numPrim = 0;
protected int m_numChildAgents = 0;
@@ -155,16 +155,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected internal void UpdateEntities()
{
List<EntityBase> updateEntities = GetEntities();
foreach (EntityBase entity in updateEntities)
{
entity.Update();
}
}
protected internal void UpdatePresences()
{
List<ScenePresence> updateScenePresences = GetScenePresences();
@@ -365,12 +355,12 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
/// Add an entity to the list of prims to process on the next update
/// Add an object to the list of prims to process on the next update
/// </summary>
/// <param name="obj">
/// A <see cref="EntityBase"/>
/// A <see cref="SceneObjectGroup"/>
/// </param>
protected internal void AddToUpdateList(EntityBase obj)
protected internal void AddToUpdateList(SceneObjectGroup obj)
{
lock (m_updateList)
{
@@ -381,18 +371,18 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Process all pending updates
/// </summary>
protected internal void ProcessUpdates()
protected internal void UpdateObjectGroups()
{
Dictionary<UUID, EntityBase> updates;
Dictionary<UUID, SceneObjectGroup> updates;
// Some updates add more updates to the updateList.
// Get the current list of updates and clear the list before iterating
lock (m_updateList)
{
updates = new Dictionary<UUID, EntityBase>(m_updateList);
updates = new Dictionary<UUID, SceneObjectGroup>(m_updateList);
m_updateList.Clear();
}
// Go through all timers
foreach (KeyValuePair<UUID, EntityBase> kvp in updates)
// Go through all updates
foreach (KeyValuePair<UUID, SceneObjectGroup> kvp in updates)
{
// Don't abort the whole update if one entity happens to give us an exception.
try

View File

@@ -1241,6 +1241,7 @@ namespace OpenSim.Region.Framework.Scenes
{
lock (m_targets)
m_targets.Clear();
m_scene.RemoveGroupTarget(this);
}
ScheduleGroupForFullUpdate();
@@ -1871,12 +1872,6 @@ namespace OpenSim.Region.Framework.Scenes
m_rootPart.UpdateFlag = 1;
lastPhysGroupPos = AbsolutePosition;
}
//foreach (SceneObjectPart part in m_parts.Values)
//{
//if (part.UpdateFlag == 0) part.UpdateFlag = 1;
//}
checkAtTargets();
if (UsePhysics && ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
|| (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
@@ -3126,6 +3121,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_targets.Add(handle, waypoint);
}
m_scene.AddGroupTarget(this);
return (int)handle;
}
@@ -3133,12 +3129,13 @@ namespace OpenSim.Region.Framework.Scenes
{
lock (m_targets)
{
if (m_targets.ContainsKey((uint)handle))
m_targets.Remove((uint)handle);
m_targets.Remove((uint)handle);
if (m_targets.Count == 0)
m_scene.RemoveGroupTarget(this);
}
}
private void checkAtTargets()
public void checkAtTargets()
{
if (m_scriptListens_atTarget || m_scriptListens_notAtTarget)
{

View File

@@ -61,11 +61,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
throw new NotImplementedException();
}
public override void CloseAllAgents(uint circuitcode)
{
throw new NotImplementedException();
}
public override void OtherRegionUp(GridRegion otherRegion)
{
throw new NotImplementedException();