diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 2410f31901..4bf9018862 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -209,35 +209,24 @@ namespace OpenSim.Framework.Communications private string[] doUUIDNameRequest(UUID uuid) { - string[] returnstring = new string[0]; - bool doLookup = false; - lock (m_nameRequestCache) { if (m_nameRequestCache.ContainsKey(uuid)) - { - returnstring = m_nameRequestCache[uuid]; - } - else - { - // we don't want to lock the dictionary while we're doing the lookup - doLookup = true; - } + return m_nameRequestCache[uuid]; } - if (doLookup) { - UserProfileData profileData = m_userService.GetUserProfile(uuid); - if (profileData != null) + string[] returnstring = new string[0]; + CachedUserInfo uinfo = UserProfileCacheService.GetUserDetails(uuid); + + if ((uinfo != null) && (uinfo.UserProfile != null)) + { + returnstring = new string[2]; + returnstring[0] = uinfo.UserProfile.FirstName; + returnstring[1] = uinfo.UserProfile.SurName; + lock (m_nameRequestCache) { - returnstring = new string[2]; - // UUID profileId = profileData.ID; - returnstring[0] = profileData.FirstName; - returnstring[1] = profileData.SurName; - lock (m_nameRequestCache) - { - if (!m_nameRequestCache.ContainsKey(uuid)) - m_nameRequestCache.Add(uuid, returnstring); - } + if (!m_nameRequestCache.ContainsKey(uuid)) + m_nameRequestCache.Add(uuid, returnstring); } } diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 901144a289..fe9de1b3c5 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -556,6 +556,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions // Customize the EveryoneMask uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); + if (objectOwner != UUID.Zero) + objectEveryoneMask |= (uint)PrimFlags.ObjectAnyOwner; if (m_bypassPermissions) return objectOwnerMask; @@ -578,12 +580,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions { // Admin objects should not be editable by the above if (!IsAdministrator(objectOwner)) - return objectOwnerMask; + return objectOwnerMask; } - if ((objectOwnerMask & (uint)PermissionMask.Transfer) != 0 && task.ObjectSaleType != 0) - objectEveryoneMask |= (uint)PrimFlags.ObjectTransfer; - // Group permissions if ((task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0)) return objectGroupMask | objectEveryoneMask; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3996cdcaaa..15fb11f19b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3409,7 +3409,7 @@ namespace OpenSim.Region.Framework.Scenes scene.AddPhysicsActorTaint(m_physicsActor); //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; - m_physicsActor.SubscribeEvents(1000); + m_physicsActor.SubscribeEvents(500); m_physicsActor.LocalID = LocalId; } @@ -3417,7 +3417,15 @@ namespace OpenSim.Region.Framework.Scenes // Event called by the physics plugin to tell the avatar about a collision. private void PhysicsCollisionUpdate(EventArgs e) { - if ((e == null) || m_invulnerable) + if (e == null) + return; + + //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) + // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( + // as of this comment the interval is set in AddToPhysicalScene + UpdateMovementAnimations(); + + if (m_invulnerable) return; CollisionEventUpdate collisionData = (CollisionEventUpdate)e; Dictionary coldata = collisionData.m_objCollisionList; @@ -3455,8 +3463,7 @@ namespace OpenSim.Region.Framework.Scenes m_scene.EventManager.TriggerAvatarKill(killerObj, this); } - if (Velocity.X > 0 || Velocity.Y > 0) - UpdateMovementAnimations(); + } public void setHealthWithUpdate(float health) diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index a00ba11d14..bd81d50f39 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -98,6 +98,7 @@ namespace OpenSim.Region.Physics.OdePlugin private bool m_alwaysRun = false; private bool m_hackSentFall = false; private bool m_hackSentFly = false; + private int m_requestedUpdateFrequency = 0; private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0); public uint m_localID = 0; public bool m_returnCollisions = false; @@ -1184,26 +1185,31 @@ namespace OpenSim.Region.Physics.OdePlugin public override void SubscribeEvents(int ms) { + m_requestedUpdateFrequency = ms; m_eventsubscription = ms; _parent_scene.addCollisionEventReporting(this); } public override void UnSubscribeEvents() { _parent_scene.remCollisionEventReporting(this); + m_requestedUpdateFrequency = 0; m_eventsubscription = 0; } public void AddCollisionEvent(uint CollidedWith, float depth) { if (m_eventsubscription > 0) - CollisionEventsThisFrame.addCollider(CollidedWith,depth); + { + CollisionEventsThisFrame.addCollider(CollidedWith, depth); + } } public void SendCollisions() { - if (m_eventsubscription > 0) + if (m_eventsubscription > m_requestedUpdateFrequency) { base.SendCollisionUpdate(CollisionEventsThisFrame); CollisionEventsThisFrame = new CollisionEventUpdate(); + m_eventsubscription = 0; } } public override bool SubscribedEvents() @@ -1309,5 +1315,13 @@ namespace OpenSim.Region.Physics.OdePlugin } } + + internal void AddCollisionFrameTime(int p) + { + // protect it from overflow crashing + if (m_eventsubscription + p >= int.MaxValue) + m_eventsubscription = 0; + m_eventsubscription += p; + } } } diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index f5ab1de1e8..083b7db37f 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -2928,6 +2928,7 @@ namespace OpenSim.Region.Physics.OdePlugin { case ActorTypes.Agent: OdeCharacter cobj = (OdeCharacter)obj; + cobj.AddCollisionFrameTime(100); cobj.SendCollisions(); break; case ActorTypes.Prim: