aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2011-04-30 14:37:37 +0100
committerMelanie2011-04-30 14:37:37 +0100
commitd1cf1fe3d7d3867bcdf7c725ceebdb7aa9579be9 (patch)
tree1310049348fe722ca9c3e970cf5e300f9ad29fce /OpenSim/Region/CoreModules
parentMerge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff)
parentDelaying starting the scripts on TPs and crossings until the agent is root. (diff)
downloadopensim-SC-d1cf1fe3d7d3867bcdf7c725ceebdb7aa9579be9.zip
opensim-SC-d1cf1fe3d7d3867bcdf7c725ceebdb7aa9579be9.tar.gz
opensim-SC-d1cf1fe3d7d3867bcdf7c725ceebdb7aa9579be9.tar.bz2
opensim-SC-d1cf1fe3d7d3867bcdf7c725ceebdb7aa9579be9.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs73
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs7
6 files changed, 67 insertions, 46 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 4255c79..ff4ec4c 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -41,8 +41,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
41 /// </summary> 41 /// </summary>
42 public class AgentAssetTransactions 42 public class AgentAssetTransactions
43 { 43 {
44// private static readonly ILog m_log = LogManager.GetLogger( 44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45// MethodBase.GetCurrentMethod().DeclaringType);
46 45
47 // Fields 46 // Fields
48 private bool m_dumpAssetsToFile; 47 private bool m_dumpAssetsToFile;
@@ -149,6 +148,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
149 148
150 if (asset != null) 149 if (asset != null)
151 { 150 {
151// m_log.DebugFormat(
152// "[AGENT ASSETS TRANSACTIONS]: Updating item {0} in {1} for transaction {2}",
153// item.Name, part.Name, transactionID);
154
152 asset.FullID = UUID.Random(); 155 asset.FullID = UUID.Random();
153 asset.Name = item.Name; 156 asset.Name = item.Name;
154 asset.Description = item.Description; 157 asset.Description = item.Description;
@@ -156,8 +159,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
156 item.AssetID = asset.FullID; 159 item.AssetID = asset.FullID;
157 160
158 m_Scene.AssetService.Store(asset); 161 m_Scene.AssetService.Store(asset);
159
160 part.Inventory.UpdateInventoryItem(item);
161 } 162 }
162 } 163 }
163 } 164 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index dc33dbb..47476a9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -571,14 +571,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
571 /// <param name="sp"></param> 571 /// <param name="sp"></param>
572 /// <param name="so"></param> 572 /// <param name="so"></param>
573 /// <param name="attachmentpoint"></param> 573 /// <param name="attachmentpoint"></param>
574 /// <param name="AttachOffset"></param> 574 /// <param name="attachOffset"></param>
575 /// <param name="silent"></param> 575 /// <param name="silent"></param>
576 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent) 576 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
577 { 577 {
578 // don't attach attachments to child agents
579 if (avatar.IsChildAgent) return;
580 578
581// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name); 579 m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
580 attachmentpoint, attachOffset, so.RootPart.AttachedPos);
582 581
583 so.DetachFromBackup(); 582 so.DetachFromBackup();
584 583
@@ -599,8 +598,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
599 so.RootPart.PhysActor = null; 598 so.RootPart.PhysActor = null;
600 } 599 }
601 600
602 so.AbsolutePosition = AttachOffset; 601 so.AbsolutePosition = attachOffset;
603 so.RootPart.AttachedPos = AttachOffset; 602 so.RootPart.AttachedPos = attachOffset;
604 so.RootPart.IsAttachment = true; 603 so.RootPart.IsAttachment = true;
605 604
606 so.RootPart.SetParentLocalId(avatar.LocalId); 605 so.RootPart.SetParentLocalId(avatar.LocalId);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 138556f..e2bdee0 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -286,11 +286,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
286 } 286 }
287 287
288 string reason; 288 string reason;
289 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason)) 289 string version;
290 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
290 { 291 {
291 sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); 292 sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason);
292 return; 293 return;
293 } 294 }
295 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
294 296
295 sp.ControllingClient.SendTeleportStart(teleportFlags); 297 sp.ControllingClient.SendTeleportStart(teleportFlags);
296 298
@@ -372,20 +374,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
372 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); 374 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
373 } 375 }
374 376
375 // Expect avatar crossing is a heavy-duty function at the destination.
376 // That is where MakeRoot is called, which fetches appearance and inventory.
377 // Plus triggers OnMakeRoot, which spawns a series of asynchronous updates.
378 //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
379 // position, false);
380
381 //{
382 // avatar.ControllingClient.SendTeleportFailed("Problem with destination.");
383 // // We should close that agent we just created over at destination...
384 // List<ulong> lst = new List<ulong>();
385 // lst.Add(reg.RegionHandle);
386 // SendCloseChildAgentAsync(avatar.UUID, lst);
387 // return;
388 //}
389 377
390 SetInTransit(sp.UUID); 378 SetInTransit(sp.UUID);
391 379
@@ -427,7 +415,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
427 415
428 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which 416 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
429 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation 417 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
430 // that the client contacted the destination before we send the attachments and close things here. 418 // that the client contacted the destination before we close things here.
431 if (!WaitForCallback(sp.UUID)) 419 if (!WaitForCallback(sp.UUID))
432 { 420 {
433 m_log.WarnFormat( 421 m_log.WarnFormat(
@@ -438,14 +426,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
438 return; 426 return;
439 } 427 }
440 428
441 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 429 // For backwards compatibility
442 CrossAttachmentsIntoNewRegion(finalDestination, sp, true); 430 if (version == "Unknown" || version == string.Empty)
431 {
432 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
433 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
434 CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
435 }
436
437 // May need to logout or other cleanup
438 AgentHasMovedAway(sp, logout);
443 439
444 // Well, this is it. The agent is over there. 440 // Well, this is it. The agent is over there.
445 KillEntity(sp.Scene, sp.LocalId); 441 KillEntity(sp.Scene, sp.LocalId);
446 442
447 // May need to logout or other cleanup
448 AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
449 443
450 // Now let's make it officially a child agent 444 // Now let's make it officially a child agent
451 sp.MakeChildAgent(); 445 sp.MakeChildAgent();
@@ -486,7 +480,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
486 480
487 // Fail. Reset it back 481 // Fail. Reset it back
488 sp.IsChildAgent = false; 482 sp.IsChildAgent = false;
489 483 ReInstantiateScripts(sp);
490 ResetFromTransit(sp.UUID); 484 ResetFromTransit(sp.UUID);
491 485
492 EnableChildAgents(sp); 486 EnableChildAgents(sp);
@@ -514,8 +508,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
514 508
515 } 509 }
516 510
517 protected virtual void AgentHasMovedAway(UUID sessionID, bool logout) 511 protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
518 { 512 {
513 foreach (SceneObjectGroup sop in sp.Attachments)
514 {
515 sop.Scene.DeleteSceneObject(sop, true);
516 }
517 sp.Attachments.Clear();
519 } 518 }
520 519
521 protected void KillEntity(Scene scene, uint localID) 520 protected void KillEntity(Scene scene, uint localID)
@@ -803,7 +802,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
803 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 802 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
804 803
805 string reason; 804 string reason;
806 if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason)) 805 string version;
806 if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason))
807 { 807 {
808 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); 808 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
809 if (r == null) 809 if (r == null)
@@ -823,7 +823,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
823 agent.InTransit(); 823 agent.InTransit();
824 824
825 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; 825 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
826 d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, CrossAgentToNewRegionCompleted, d); 826 d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
827 827
828 return true; 828 return true;
829 } 829 }
@@ -880,17 +880,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
880 icon.EndInvoke(iar); 880 icon.EndInvoke(iar);
881 } 881 }
882 882
883 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying); 883 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version);
884 884
885 /// <summary> 885 /// <summary>
886 /// This Closes child agents on neighbouring regions 886 /// This Closes child agents on neighbouring regions
887 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 887 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
888 /// </summary> 888 /// </summary>
889 protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying) 889 protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version)
890 { 890 {
891 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 891 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
892 892
893 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury); 893 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
894 894
895 Scene m_scene = agent.Scene; 895 Scene m_scene = agent.Scene;
896 896
@@ -953,6 +953,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
953 if (!WaitForCallback(agent.UUID)) 953 if (!WaitForCallback(agent.UUID))
954 { 954 {
955 m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); 955 m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
956 ReInstantiateScripts(agent);
956 ResetFromTransit(agent.UUID); 957 ResetFromTransit(agent.UUID);
957 958
958 // Yikes! We should just have a ref to scene here. 959 // Yikes! We should just have a ref to scene here.
@@ -968,7 +969,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
968 agent.SendOtherAgentsAvatarDataToMe(); 969 agent.SendOtherAgentsAvatarDataToMe();
969 agent.SendOtherAgentsAppearanceToMe(); 970 agent.SendOtherAgentsAppearanceToMe();
970 971
971 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); 972 // Backwards compatibility
973 if (version == "Unknown" || version == string.Empty)
974 {
975 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
976 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
977 }
978
979 AgentHasMovedAway(agent, false);
972 980
973 // the user may change their profile information in other region, 981 // the user may change their profile information in other region,
974 // so the userinfo in UserProfileCache is not reliable any more, delete it 982 // so the userinfo in UserProfileCache is not reliable any more, delete it
@@ -1775,7 +1783,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1775 return false; 1783 return false;
1776 } 1784 }
1777 1785
1778 1786 protected void ReInstantiateScripts(ScenePresence sp)
1787 {
1788 sp.Attachments.ForEach(delegate(SceneObjectGroup sog)
1789 {
1790 sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0);
1791 sog.ResumeScripts();
1792 });
1793 }
1779 #endregion 1794 #endregion
1780 1795
1781 } 1796 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 5a80100..1ccbcfd 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -142,11 +142,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
142 return false; 142 return false;
143 } 143 }
144 144
145 protected override void AgentHasMovedAway(UUID sessionID, bool logout) 145 protected override void AgentHasMovedAway(ScenePresence sp, bool logout)
146 { 146 {
147 base.AgentHasMovedAway(sp, logout);
147 if (logout) 148 if (logout)
148 // Log them out of this grid 149 // Log them out of this grid
149 m_aScene.PresenceService.LogoutAgent(sessionID); 150 m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
150 } 151 }
151 152
152 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) 153 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 41dbffb..9714c36 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -41,6 +41,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
41 public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService 41 public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 // Version of this service
45 private const string m_Version = "SIMULATION/0.1";
46
44 private List<Scene> m_sceneList = new List<Scene>(); 47 private List<Scene> m_sceneList = new List<Scene>();
45 48
46 private IEntityTransferModule m_AgentTransferModule; 49 private IEntityTransferModule m_AgentTransferModule;
@@ -257,9 +260,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
257 return false; 260 return false;
258 } 261 }
259 262
260 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) 263 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
261 { 264 {
262 reason = "Communications failure"; 265 reason = "Communications failure";
266 version = m_Version;
263 if (destination == null) 267 if (destination == null)
264 return false; 268 return false;
265 269
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 97833f3..5564067 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -229,19 +229,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
229 229
230 } 230 }
231 231
232 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) 232 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
233 { 233 {
234 reason = "Communications failure"; 234 reason = "Communications failure";
235 version = "Unknown";
235 if (destination == null) 236 if (destination == null)
236 return false; 237 return false;
237 238
238 // Try local first 239 // Try local first
239 if (m_localBackend.QueryAccess(destination, id, position, out reason)) 240 if (m_localBackend.QueryAccess(destination, id, position, out version, out reason))
240 return true; 241 return true;
241 242
242 // else do the remote thing 243 // else do the remote thing
243 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 244 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
244 return m_remoteConnector.QueryAccess(destination, id, position, out reason); 245 return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason);
245 246
246 return false; 247 return false;
247 248