aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs41
3 files changed, 48 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index e2bdee0..edfc94f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1785,11 +1785,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1785 1785
1786 protected void ReInstantiateScripts(ScenePresence sp) 1786 protected void ReInstantiateScripts(ScenePresence sp)
1787 { 1787 {
1788 int i = 0;
1788 sp.Attachments.ForEach(delegate(SceneObjectGroup sog) 1789 sp.Attachments.ForEach(delegate(SceneObjectGroup sog)
1789 { 1790 {
1791 sog.SetState(sp.InTransitScriptStates[i++], sp.Scene);
1790 sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0); 1792 sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0);
1791 sog.ResumeScripts(); 1793 sog.ResumeScripts();
1792 }); 1794 });
1795
1796 sp.InTransitScriptStates.Clear();
1793 } 1797 }
1794 #endregion 1798 #endregion
1795 1799
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index a165bbd..184b223 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -594,9 +594,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
594 } 594 }
595 } 595 }
596 } 596 }
597
598 // This is a hook to do some per-asset post-processing for subclasses that need that
599 if (remoteClient != null)
600 ExportAsset(remoteClient.AgentId, assetID);
601
597 return assetID; 602 return assetID;
598 } 603 }
599 604
605 protected virtual void ExportAsset(UUID agentID, UUID assetID)
606 {
607 // nothing to do here
608 }
600 609
601 /// <summary> 610 /// <summary>
602 /// Rez an object into the scene from the user's inventory 611 /// Rez an object into the scene from the user's inventory
@@ -1025,9 +1034,5 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
1025 } 1034 }
1026 1035
1027 #endregion 1036 #endregion
1028
1029 protected virtual void ExportAsset(UUID agentID, UUID assetID)
1030 {
1031 }
1032 } 1037 }
1033} 1038}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 553b575..079223d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -253,6 +253,16 @@ namespace OpenSim.Region.Framework.Scenes
253 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); 253 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>();
254 254
255 /// <summary> 255 /// <summary>
256 /// Copy of the script states while the agent is in transit. This state may
257 /// need to be placed back in case of transfer fail.
258 /// </summary>
259 public List<string> InTransitScriptStates
260 {
261 get { return m_InTransitScriptStates; }
262 }
263 private List<string> m_InTransitScriptStates = new List<string>();
264
265 /// <summary>
256 /// Implemented Control Flags 266 /// Implemented Control Flags
257 /// </summary> 267 /// </summary>
258 private enum Dir_ControlFlags 268 private enum Dir_ControlFlags
@@ -2812,6 +2822,7 @@ namespace OpenSim.Region.Framework.Scenes
2812 2822
2813 // vars to support reduced update frequency when velocity is unchanged 2823 // vars to support reduced update frequency when velocity is unchanged
2814 private Vector3 lastVelocitySentToAllClients = Vector3.Zero; 2824 private Vector3 lastVelocitySentToAllClients = Vector3.Zero;
2825 private Vector3 lastPositionSentToAllClients = Vector3.Zero;
2815 private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount(); 2826 private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount();
2816 2827
2817 /// <summary> 2828 /// <summary>
@@ -2821,14 +2832,29 @@ namespace OpenSim.Region.Framework.Scenes
2821 { 2832 {
2822 int currentTick = Util.EnvironmentTickCount(); 2833 int currentTick = Util.EnvironmentTickCount();
2823 2834
2824 // decrease update frequency when avatar is moving but velocity is not changing 2835 // Decrease update frequency when avatar is moving but velocity is
2825 if (m_velocity.Length() < 0.01f 2836 // not changing.
2826 || Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f 2837 // If there is a mismatch between distance travelled and expected
2827 || currentTick - lastTerseUpdateToAllClientsTick > 1500) 2838 // distance based on last velocity sent and velocity hasnt changed,
2839 // then send a new terse update
2840
2841 float timeSinceLastUpdate = (currentTick - lastTerseUpdateToAllClientsTick) * 0.001f;
2842
2843 Vector3 expectedPosition = lastPositionSentToAllClients + lastVelocitySentToAllClients * timeSinceLastUpdate;
2844
2845 float distanceError = Vector3.Distance(OffsetPosition, expectedPosition);
2846
2847 float speed = Velocity.Length();
2848 float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity);
2849
2850 if (speed < 0.01f // allow rotation updates if avatar position is unchanged
2851 || Math.Abs(distanceError) > 0.25f // arbitrary distance error threshold
2852 || velocidyDiff > 0.01f) // did velocity change from last update?
2828 { 2853 {
2829 m_perfMonMS = currentTick; 2854 m_perfMonMS = currentTick;
2830 lastVelocitySentToAllClients = m_velocity; 2855 lastVelocitySentToAllClients = Velocity;
2831 lastTerseUpdateToAllClientsTick = currentTick; 2856 lastTerseUpdateToAllClientsTick = currentTick;
2857 lastPositionSentToAllClients = OffsetPosition;
2832 2858
2833 m_scene.ForEachClient(SendTerseUpdateToClient); 2859 m_scene.ForEachClient(SendTerseUpdateToClient);
2834 2860
@@ -3543,6 +3569,7 @@ namespace OpenSim.Region.Framework.Scenes
3543 cAgent.AttachmentObjects = new List<ISceneObject>(); 3569 cAgent.AttachmentObjects = new List<ISceneObject>();
3544 cAgent.AttachmentObjectStates = new List<string>(); 3570 cAgent.AttachmentObjectStates = new List<string>();
3545 IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); 3571 IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3572 m_InTransitScriptStates.Clear();
3546 foreach (SceneObjectGroup sog in m_attachments) 3573 foreach (SceneObjectGroup sog in m_attachments)
3547 { 3574 {
3548 // We need to make a copy and pass that copy 3575 // We need to make a copy and pass that copy
@@ -3552,7 +3579,9 @@ namespace OpenSim.Region.Framework.Scenes
3552 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; 3579 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
3553 ((SceneObjectGroup)clone).RootPart.IsAttachment = false; 3580 ((SceneObjectGroup)clone).RootPart.IsAttachment = false;
3554 cAgent.AttachmentObjects.Add(clone); 3581 cAgent.AttachmentObjects.Add(clone);
3555 cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot()); 3582 string state = sog.GetStateSnapshot();
3583 cAgent.AttachmentObjectStates.Add(state);
3584 m_InTransitScriptStates.Add(state);
3556 // Let's remove the scripts of the original object here 3585 // Let's remove the scripts of the original object here
3557 sog.RemoveScriptInstances(true); 3586 sog.RemoveScriptInstances(true);
3558 } 3587 }