aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs48
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs194
6 files changed, 150 insertions, 138 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index e3ed905..4595a29 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -119,16 +119,40 @@ namespace OpenSim.Region.Framework.Scenes
119 119
120 private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) 120 private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity)
121 { 121 {
122 return 1; 122 // And anything attached to this avatar gets top priority as well
123 if (entity is SceneObjectPart)
124 {
125 SceneObjectPart sop = (SceneObjectPart)entity;
126 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
127 return 1;
128 }
129
130 return PriorityQueue.NumberOfImmediateQueues; // first queue past the immediate queues
123 } 131 }
124 132
125 private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) 133 private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
126 { 134 {
135 // And anything attached to this avatar gets top priority as well
136 if (entity is SceneObjectPart)
137 {
138 SceneObjectPart sop = (SceneObjectPart)entity;
139 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
140 return 1;
141 }
142
127 return ComputeDistancePriority(client,entity,false); 143 return ComputeDistancePriority(client,entity,false);
128 } 144 }
129 145
130 private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) 146 private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
131 { 147 {
148 // And anything attached to this avatar gets top priority as well
149 if (entity is SceneObjectPart)
150 {
151 SceneObjectPart sop = (SceneObjectPart)entity;
152 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
153 return 1;
154 }
155
132 return ComputeDistancePriority(client,entity,true); 156 return ComputeDistancePriority(client,entity,true);
133 } 157 }
134 158
@@ -141,18 +165,20 @@ namespace OpenSim.Region.Framework.Scenes
141 { 165 {
142 if (!presence.IsChildAgent) 166 if (!presence.IsChildAgent)
143 { 167 {
168 // All avatars other than our own go into pqueue 1
169 if (entity is ScenePresence)
170 return 1;
171
144 if (entity is SceneObjectPart) 172 if (entity is SceneObjectPart)
145 { 173 {
174 // Attachments are high priority,
175 if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
176 return 1;
177
146 // Non physical prims are lower priority than physical prims 178 // Non physical prims are lower priority than physical prims
147 PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; 179 PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
148 if (physActor == null || !physActor.IsPhysical) 180 if (physActor == null || !physActor.IsPhysical)
149 pqueue++; 181 pqueue++;
150
151 // Attachments are high priority,
152 // MIC: shouldn't these already be in the highest priority queue already
153 // since their root position is same as the avatars?
154 if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
155 pqueue = 1;
156 } 182 }
157 } 183 }
158 } 184 }
@@ -172,7 +198,7 @@ namespace OpenSim.Region.Framework.Scenes
172 198
173 // m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId); 199 // m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId);
174 // throw new InvalidOperationException("Prioritization agent not defined"); 200 // throw new InvalidOperationException("Prioritization agent not defined");
175 return Int32.MaxValue; 201 return PriorityQueue.NumberOfQueues - 1;
176 } 202 }
177 203
178 // Use group position for child prims, since we are putting child prims in 204 // Use group position for child prims, since we are putting child prims in
@@ -197,8 +223,10 @@ namespace OpenSim.Region.Framework.Scenes
197 223
198 // And convert the distance to a priority queue, this computation gives queues 224 // And convert the distance to a priority queue, this computation gives queues
199 // at 10, 20, 40, 80, 160, 320, 640, and 1280m 225 // at 10, 20, 40, 80, 160, 320, 640, and 1280m
200 uint pqueue = 1; 226 uint pqueue = PriorityQueue.NumberOfImmediateQueues;
201 for (int i = 0; i < 8; i++) 227 uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues;
228
229 for (int i = 0; i < queues - 1; i++)
202 { 230 {
203 if (distance < 10 * Math.Pow(2.0,i)) 231 if (distance < 10 * Math.Pow(2.0,i))
204 break; 232 break;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0f85925..b0f0de6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1430,6 +1430,10 @@ namespace OpenSim.Region.Framework.Scenes
1430 } 1430 }
1431 else // Updating existing item with new perms etc 1431 else // Updating existing item with new perms etc
1432 { 1432 {
1433// m_log.DebugFormat(
1434// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
1435// currentItem.Name, part.Name);
1436
1433 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); 1437 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
1434 if (agentTransactions != null) 1438 if (agentTransactions != null)
1435 { 1439 {
@@ -2039,6 +2043,12 @@ namespace OpenSim.Region.Framework.Scenes
2039 if (rot != null) 2043 if (rot != null)
2040 group.UpdateGroupRotationR((Quaternion)rot); 2044 group.UpdateGroupRotationR((Quaternion)rot);
2041 2045
2046 // TODO: This needs to be refactored with the similar code in
2047 // SceneGraph.AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
2048 // possibly by allowing this method to take a null rotation.
2049 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
2050 group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
2051
2042 // We can only call this after adding the scene object, since the scene object references the scene 2052 // We can only call this after adding the scene object, since the scene object references the scene
2043 // to find out if scripts should be activated at all. 2053 // to find out if scripts should be activated at all.
2044 group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); 2054 group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fdd5205..696c6ee 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2316,7 +2316,9 @@ namespace OpenSim.Region.Framework.Scenes
2316 /// <returns></returns> 2316 /// <returns></returns>
2317 public bool IncomingCreateObject(ISceneObject sog) 2317 public bool IncomingCreateObject(ISceneObject sog)
2318 { 2318 {
2319 //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); 2319 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
2320 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
2321
2320 SceneObjectGroup newObject; 2322 SceneObjectGroup newObject;
2321 try 2323 try
2322 { 2324 {
@@ -3665,6 +3667,15 @@ namespace OpenSim.Region.Framework.Scenes
3665 return false; 3667 return false;
3666 } 3668 }
3667 3669
3670 int num = m_sceneGraph.GetNumberOfScenePresences();
3671
3672 if (num >= RegionInfo.RegionSettings.AgentLimit)
3673 {
3674 if (!Permissions.IsAdministrator(cAgentData.AgentID))
3675 return false;
3676 }
3677
3678
3668 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); 3679 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
3669 3680
3670 if (childAgentUpdate != null) 3681 if (childAgentUpdate != null)
@@ -4966,6 +4977,17 @@ namespace OpenSim.Region.Framework.Scenes
4966 // child agent creation, thereby emulating the SL behavior. 4977 // child agent creation, thereby emulating the SL behavior.
4967 public bool QueryAccess(UUID agentID, Vector3 position, out string reason) 4978 public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
4968 { 4979 {
4980 int num = m_sceneGraph.GetNumberOfScenePresences();
4981
4982 if (num >= RegionInfo.RegionSettings.AgentLimit)
4983 {
4984 if (!Permissions.IsAdministrator(agentID))
4985 {
4986 reason = "The region is full";
4987 return false;
4988 }
4989 }
4990
4969 reason = String.Empty; 4991 reason = String.Empty;
4970 return true; 4992 return true;
4971 } 4993 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 72f0402..fc31b65 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -800,6 +800,11 @@ namespace OpenSim.Region.Framework.Scenes
800 return m_scenePresenceArray; 800 return m_scenePresenceArray;
801 } 801 }
802 802
803 public int GetNumberOfScenePresences()
804 {
805 return m_scenePresenceArray.Count;
806 }
807
803 /// <summary> 808 /// <summary>
804 /// Request a scene presence by UUID. Fast, indexed lookup. 809 /// Request a scene presence by UUID. Fast, indexed lookup.
805 /// </summary> 810 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3281eab..3b60f8c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -693,8 +693,9 @@ namespace OpenSim.Region.Framework.Scenes
693 { 693 {
694 TaskInventoryItem it = GetInventoryItem(item.ItemID); 694 TaskInventoryItem it = GetInventoryItem(item.ItemID);
695 if (it != null) 695 if (it != null)
696
697 { 696 {
697// m_log.DebugFormat("[PRIM INVENTORY]: Updating item {0} in {1}", item.Name, m_part.Name);
698
698 item.ParentID = m_part.UUID; 699 item.ParentID = m_part.UUID;
699 item.ParentPartID = m_part.UUID; 700 item.ParentPartID = m_part.UUID;
700 701
@@ -711,14 +712,16 @@ namespace OpenSim.Region.Framework.Scenes
711 m_items[item.ItemID] = item; 712 m_items[item.ItemID] = item;
712 m_inventorySerial++; 713 m_inventorySerial++;
713 } 714 }
714 715
715 if (fireScriptEvents) 716 if (fireScriptEvents)
716 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 717 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
718
717 if (considerChanged) 719 if (considerChanged)
718 { 720 {
719 HasInventoryChanged = true; 721 HasInventoryChanged = true;
720 m_part.ParentGroup.HasGroupChanged = true; 722 m_part.ParentGroup.HasGroupChanged = true;
721 } 723 }
724
722 return true; 725 return true;
723 } 726 }
724 else 727 else
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 00a1487..fe4a7d1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2340,12 +2340,14 @@ namespace OpenSim.Region.Framework.Scenes
2340 2340
2341 #region Update Client(s) 2341 #region Update Client(s)
2342 2342
2343
2343 /// <summary> 2344 /// <summary>
2344 /// Sends a location update to the client connected to this scenePresence 2345 /// Sends a location update to the client connected to this scenePresence
2345 /// </summary> 2346 /// </summary>
2346 /// <param name="remoteClient"></param> 2347 /// <param name="remoteClient"></param>
2347 public void SendTerseUpdateToClient(IClientAPI remoteClient) 2348 public void SendTerseUpdateToClient(IClientAPI remoteClient)
2348 { 2349 {
2350
2349 // If the client is inactive, it's getting its updates from another 2351 // If the client is inactive, it's getting its updates from another
2350 // server. 2352 // server.
2351 if (remoteClient.IsActive) 2353 if (remoteClient.IsActive)
@@ -2358,8 +2360,8 @@ namespace OpenSim.Region.Framework.Scenes
2358 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); 2360 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
2359 2361
2360 remoteClient.SendPrimUpdate( 2362 remoteClient.SendPrimUpdate(
2361 this, 2363 this,
2362 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity 2364 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
2363 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); 2365 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
2364 2366
2365 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2367 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
@@ -2367,16 +2369,31 @@ namespace OpenSim.Region.Framework.Scenes
2367 } 2369 }
2368 } 2370 }
2369 2371
2372
2373 // vars to support reduced update frequency when velocity is unchanged
2374 private Vector3 lastVelocitySentToAllClients = Vector3.Zero;
2375 private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount();
2376
2370 /// <summary> 2377 /// <summary>
2371 /// Send a location/velocity/accelleration update to all agents in scene 2378 /// Send a location/velocity/accelleration update to all agents in scene
2372 /// </summary> 2379 /// </summary>
2373 public void SendTerseUpdateToAllClients() 2380 public void SendTerseUpdateToAllClients()
2374 { 2381 {
2375 m_perfMonMS = Util.EnvironmentTickCount(); 2382 int currentTick = Util.EnvironmentTickCount();
2376
2377 m_scene.ForEachClient(SendTerseUpdateToClient);
2378 2383
2379 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2384 // decrease update frequency when avatar is moving but velocity is not changing
2385 if (m_velocity.Length() < 0.01f
2386 || Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f
2387 || currentTick - lastTerseUpdateToAllClientsTick > 1500)
2388 {
2389 m_perfMonMS = currentTick;
2390 lastVelocitySentToAllClients = m_velocity;
2391 lastTerseUpdateToAllClientsTick = currentTick;
2392
2393 m_scene.ForEachClient(SendTerseUpdateToClient);
2394
2395 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2396 }
2380 } 2397 }
2381 2398
2382 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2399 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
@@ -2632,18 +2649,17 @@ namespace OpenSim.Region.Framework.Scenes
2632 cadu.GroupAccess = 0; 2649 cadu.GroupAccess = 0;
2633 cadu.Position = AbsolutePosition; 2650 cadu.Position = AbsolutePosition;
2634 cadu.regionHandle = m_rootRegionHandle; 2651 cadu.regionHandle = m_rootRegionHandle;
2652
2653 // Throttles
2635 float multiplier = 1; 2654 float multiplier = 1;
2636 int innacurateNeighbors = m_scene.GetInaccurateNeighborCount(); 2655 int childRegions = m_knownChildRegions.Count;
2637 if (innacurateNeighbors != 0) 2656 if (childRegions != 0)
2638 { 2657 multiplier = 1f / childRegions;
2639 multiplier = 1f / (float)innacurateNeighbors; 2658
2640 } 2659 // Minimum throttle for a child region is 1/4 of the root region throttle
2641 if (multiplier <= 0f) 2660 if (multiplier <= 0.25f)
2642 {
2643 multiplier = 0.25f; 2661 multiplier = 0.25f;
2644 }
2645 2662
2646 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
2647 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier); 2663 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
2648 cadu.Velocity = Velocity; 2664 cadu.Velocity = Velocity;
2649 2665
@@ -3039,16 +3055,14 @@ namespace OpenSim.Region.Framework.Scenes
3039 3055
3040 // Throttles 3056 // Throttles
3041 float multiplier = 1; 3057 float multiplier = 1;
3042 int innacurateNeighbors = m_scene.GetInaccurateNeighborCount(); 3058 int childRegions = m_knownChildRegions.Count;
3043 if (innacurateNeighbors != 0) 3059 if (childRegions != 0)
3044 { 3060 multiplier = 1f / childRegions;
3045 multiplier = 1f / innacurateNeighbors; 3061
3046 } 3062 // Minimum throttle for a child region is 1/4 of the root region throttle
3047 if (multiplier <= 0f) 3063 if (multiplier <= 0.25f)
3048 {
3049 multiplier = 0.25f; 3064 multiplier = 0.25f;
3050 } 3065
3051 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
3052 cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); 3066 cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
3053 3067
3054 cAgent.HeadRotation = m_headrotation; 3068 cAgent.HeadRotation = m_headrotation;
@@ -3064,54 +3078,6 @@ namespace OpenSim.Region.Framework.Scenes
3064 3078
3065 cAgent.Appearance = new AvatarAppearance(m_appearance); 3079 cAgent.Appearance = new AvatarAppearance(m_appearance);
3066 3080
3067/*
3068 try
3069 {
3070 // We might not pass the Wearables in all cases...
3071 // They're only needed so that persistent changes to the appearance
3072 // are preserved in the new region where the user is moving to.
3073 // But in Hypergrid we might not let this happen.
3074 int i = 0;
3075 UUID[] wears = new UUID[m_appearance.Wearables.Length * 2];
3076 foreach (AvatarWearable aw in m_appearance.Wearables)
3077 {
3078 if (aw != null)
3079 {
3080 wears[i++] = aw.ItemID;
3081 wears[i++] = aw.AssetID;
3082 }
3083 else
3084 {
3085 wears[i++] = UUID.Zero;
3086 wears[i++] = UUID.Zero;
3087 }
3088 }
3089 cAgent.Wearables = wears;
3090
3091 cAgent.VisualParams = m_appearance.VisualParams;
3092
3093 if (m_appearance.Texture != null)
3094 cAgent.AgentTextures = m_appearance.Texture.GetBytes();
3095 }
3096 catch (Exception e)
3097 {
3098 m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
3099 }
3100
3101 //Attachments
3102 List<int> attPoints = m_appearance.GetAttachedPoints();
3103 if (attPoints != null)
3104 {
3105 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
3106 int i = 0;
3107 AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
3108 foreach (int point in attPoints)
3109 {
3110 attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
3111 }
3112 cAgent.Attachments = attachs;
3113 }
3114*/
3115 lock (scriptedcontrols) 3081 lock (scriptedcontrols)
3116 { 3082 {
3117 ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; 3083 ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
@@ -3131,9 +3097,24 @@ namespace OpenSim.Region.Framework.Scenes
3131 } 3097 }
3132 catch { } 3098 catch { }
3133 3099
3134 // cAgent.GroupID = ?? 3100 // Attachment objects
3135 // Groups??? 3101 if (m_attachments != null && m_attachments.Count > 0)
3136 3102 {
3103 cAgent.AttachmentObjects = new List<ISceneObject>();
3104 cAgent.AttachmentObjectStates = new List<string>();
3105 IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3106 foreach (SceneObjectGroup sog in m_attachments)
3107 {
3108 // We need to make a copy and pass that copy
3109 // because of transfers withn the same sim
3110 ISceneObject clone = sog.CloneForNewScene();
3111 // Attachment module assumes that GroupPosition holds the offsets...!
3112 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
3113 ((SceneObjectGroup)clone).RootPart.IsAttachment = false;
3114 cAgent.AttachmentObjects.Add(clone);
3115 cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
3116 }
3117 }
3137 } 3118 }
3138 3119
3139 public void CopyFrom(AgentData cAgent) 3120 public void CopyFrom(AgentData cAgent)
@@ -3174,50 +3155,6 @@ namespace OpenSim.Region.Framework.Scenes
3174 AddToPhysicalScene(isFlying); 3155 AddToPhysicalScene(isFlying);
3175 } 3156 }
3176 3157
3177/*
3178 uint i = 0;
3179 try
3180 {
3181 if (cAgent.Wearables == null)
3182 cAgent.Wearables = new UUID[0];
3183 AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
3184 for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
3185 {
3186 UUID itemId = cAgent.Wearables[n];
3187 UUID assetId = cAgent.Wearables[n + 1];
3188 wears[i++] = new AvatarWearable(itemId, assetId);
3189 }
3190 // m_appearance.Wearables = wears;
3191 Primitive.TextureEntry textures = null;
3192 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
3193 textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
3194
3195 byte[] visuals = null;
3196
3197 if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
3198 visuals = (byte[])cAgent.VisualParams.Clone();
3199
3200 m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
3201 }
3202 catch (Exception e)
3203 {
3204 m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
3205 }
3206
3207 // Attachments
3208 try
3209 {
3210 if (cAgent.Attachments != null)
3211 {
3212 m_appearance.ClearAttachments();
3213 foreach (AvatarAttachment att in cAgent.Attachments)
3214 {
3215 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
3216 }
3217 }
3218 }
3219 catch { }
3220*/
3221 try 3158 try
3222 { 3159 {
3223 lock (scriptedcontrols) 3160 lock (scriptedcontrols)
@@ -3247,8 +3184,18 @@ namespace OpenSim.Region.Framework.Scenes
3247 } 3184 }
3248 catch { } 3185 catch { }
3249 3186
3250 //cAgent.GroupID = ?? 3187 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3251 //Groups??? 3188 {
3189 m_attachments = new List<SceneObjectGroup>();
3190 int i = 0;
3191 foreach (ISceneObject so in cAgent.AttachmentObjects)
3192 {
3193 ((SceneObjectGroup)so).LocalId = 0;
3194 ((SceneObjectGroup)so).RootPart.UpdateFlag = 0;
3195 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
3196 m_scene.IncomingCreateObject(so);
3197 }
3198 }
3252 } 3199 }
3253 3200
3254 public bool CopyAgent(out IAgentData agent) 3201 public bool CopyAgent(out IAgentData agent)
@@ -3271,10 +3218,7 @@ namespace OpenSim.Region.Framework.Scenes
3271 3218
3272 m_updateflag = true; 3219 m_updateflag = true;
3273 3220
3274 // The magic constant 0.95f seems to make walking feel less jerky, 3221 Velocity = force;
3275 // probably because it hackishly accounts for the overall latency of
3276 // these Velocity updates -- Diva
3277 Velocity = force * .95F;
3278 3222
3279 m_forceToApply = null; 3223 m_forceToApply = null;
3280 } 3224 }