mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -41,8 +41,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
/// </summary>
|
||||
public class AgentAssetTransactions
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// Fields
|
||||
private bool m_dumpAssetsToFile;
|
||||
@@ -149,6 +148,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
|
||||
if (asset != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[AGENT ASSETS TRANSACTIONS]: Updating item {0} in {1} for transaction {2}",
|
||||
// item.Name, part.Name, transactionID);
|
||||
|
||||
asset.FullID = UUID.Random();
|
||||
asset.Name = item.Name;
|
||||
asset.Description = item.Description;
|
||||
@@ -156,8 +159,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
item.AssetID = asset.FullID;
|
||||
|
||||
m_Scene.AssetService.Store(asset);
|
||||
|
||||
part.Inventory.UpdateInventoryItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,14 +571,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="so"></param>
|
||||
/// <param name="attachmentpoint"></param>
|
||||
/// <param name="AttachOffset"></param>
|
||||
/// <param name="attachOffset"></param>
|
||||
/// <param name="silent"></param>
|
||||
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent)
|
||||
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
|
||||
{
|
||||
// don't attach attachments to child agents
|
||||
if (avatar.IsChildAgent) return;
|
||||
|
||||
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
|
||||
attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
||||
|
||||
so.DetachFromBackup();
|
||||
|
||||
@@ -599,8 +598,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
so.RootPart.PhysActor = null;
|
||||
}
|
||||
|
||||
so.AbsolutePosition = AttachOffset;
|
||||
so.RootPart.AttachedPos = AttachOffset;
|
||||
so.AbsolutePosition = attachOffset;
|
||||
so.RootPart.AttachedPos = attachOffset;
|
||||
so.RootPart.IsAttachment = true;
|
||||
|
||||
so.RootPart.SetParentLocalId(avatar.LocalId);
|
||||
|
||||
@@ -286,11 +286,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
|
||||
string reason;
|
||||
if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason))
|
||||
string version;
|
||||
if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason);
|
||||
return;
|
||||
}
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
|
||||
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
@@ -372,20 +374,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
||||
}
|
||||
|
||||
// Expect avatar crossing is a heavy-duty function at the destination.
|
||||
// That is where MakeRoot is called, which fetches appearance and inventory.
|
||||
// Plus triggers OnMakeRoot, which spawns a series of asynchronous updates.
|
||||
//m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
|
||||
// position, false);
|
||||
|
||||
//{
|
||||
// avatar.ControllingClient.SendTeleportFailed("Problem with destination.");
|
||||
// // We should close that agent we just created over at destination...
|
||||
// List<ulong> lst = new List<ulong>();
|
||||
// lst.Add(reg.RegionHandle);
|
||||
// SendCloseChildAgentAsync(avatar.UUID, lst);
|
||||
// return;
|
||||
//}
|
||||
|
||||
SetInTransit(sp.UUID);
|
||||
|
||||
@@ -427,7 +415,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
|
||||
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
|
||||
// that the client contacted the destination before we send the attachments and close things here.
|
||||
// that the client contacted the destination before we close things here.
|
||||
if (!WaitForCallback(sp.UUID))
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
@@ -438,14 +426,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return;
|
||||
}
|
||||
|
||||
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
|
||||
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
|
||||
// For backwards compatibility
|
||||
if (version == "Unknown" || version == string.Empty)
|
||||
{
|
||||
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
|
||||
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
|
||||
}
|
||||
|
||||
// May need to logout or other cleanup
|
||||
AgentHasMovedAway(sp, logout);
|
||||
|
||||
// Well, this is it. The agent is over there.
|
||||
KillEntity(sp.Scene, sp.LocalId);
|
||||
|
||||
// May need to logout or other cleanup
|
||||
AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
|
||||
|
||||
// Now let's make it officially a child agent
|
||||
sp.MakeChildAgent();
|
||||
@@ -486,7 +480,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
// Fail. Reset it back
|
||||
sp.IsChildAgent = false;
|
||||
|
||||
ReInstantiateScripts(sp);
|
||||
ResetFromTransit(sp.UUID);
|
||||
|
||||
EnableChildAgents(sp);
|
||||
@@ -514,8 +508,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
}
|
||||
|
||||
protected virtual void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
|
||||
{
|
||||
foreach (SceneObjectGroup sop in sp.Attachments)
|
||||
{
|
||||
sop.Scene.DeleteSceneObject(sop, true);
|
||||
}
|
||||
sp.Attachments.Clear();
|
||||
}
|
||||
|
||||
protected void KillEntity(Scene scene, uint localID)
|
||||
@@ -803,7 +802,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
string reason;
|
||||
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason))
|
||||
string version;
|
||||
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason))
|
||||
{
|
||||
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
|
||||
if (r == null)
|
||||
@@ -823,7 +823,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agent.InTransit();
|
||||
|
||||
CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
|
||||
d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, CrossAgentToNewRegionCompleted, d);
|
||||
d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -880,17 +880,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying);
|
||||
public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version);
|
||||
|
||||
/// <summary>
|
||||
/// This Closes child agents on neighbouring regions
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying)
|
||||
protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version)
|
||||
{
|
||||
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury);
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
|
||||
|
||||
Scene m_scene = agent.Scene;
|
||||
|
||||
@@ -953,6 +953,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
if (!WaitForCallback(agent.UUID))
|
||||
{
|
||||
m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
|
||||
ReInstantiateScripts(agent);
|
||||
ResetFromTransit(agent.UUID);
|
||||
|
||||
// Yikes! We should just have a ref to scene here.
|
||||
@@ -968,7 +969,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agent.SendOtherAgentsAvatarDataToMe();
|
||||
agent.SendOtherAgentsAppearanceToMe();
|
||||
|
||||
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
|
||||
// Backwards compatibility
|
||||
if (version == "Unknown" || version == string.Empty)
|
||||
{
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
|
||||
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
|
||||
}
|
||||
|
||||
AgentHasMovedAway(agent, false);
|
||||
|
||||
// the user may change their profile information in other region,
|
||||
// so the userinfo in UserProfileCache is not reliable any more, delete it
|
||||
@@ -1775,7 +1783,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected void ReInstantiateScripts(ScenePresence sp)
|
||||
{
|
||||
sp.Attachments.ForEach(delegate(SceneObjectGroup sog)
|
||||
{
|
||||
sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0);
|
||||
sog.ResumeScripts();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -142,11 +142,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
protected override void AgentHasMovedAway(ScenePresence sp, bool logout)
|
||||
{
|
||||
base.AgentHasMovedAway(sp, logout);
|
||||
if (logout)
|
||||
// Log them out of this grid
|
||||
m_aScene.PresenceService.LogoutAgent(sessionID);
|
||||
m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
|
||||
}
|
||||
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||
|
||||
@@ -41,6 +41,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// Version of this service
|
||||
private const string m_Version = "SIMULATION/0.1";
|
||||
|
||||
private List<Scene> m_sceneList = new List<Scene>();
|
||||
|
||||
private IEntityTransferModule m_AgentTransferModule;
|
||||
@@ -257,9 +260,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
|
||||
{
|
||||
reason = "Communications failure";
|
||||
version = m_Version;
|
||||
if (destination == null)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -229,19 +229,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
|
||||
{
|
||||
reason = "Communications failure";
|
||||
version = "Unknown";
|
||||
if (destination == null)
|
||||
return false;
|
||||
|
||||
// Try local first
|
||||
if (m_localBackend.QueryAccess(destination, id, position, out reason))
|
||||
if (m_localBackend.QueryAccess(destination, id, position, out version, out reason))
|
||||
return true;
|
||||
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
|
||||
return m_remoteConnector.QueryAccess(destination, id, position, out reason);
|
||||
return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason);
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user