From 44d84bc2779165e75224975e83ca4539a00e9d24 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 10 Feb 2012 19:58:34 +0000 Subject: [PATCH 1/9] Fix bug where somebody taking a copy of an object they didn't own that was rezzed before the region was restarted would wrongly place the copy in the object owner's inventory. Addresses http://opensimulator.org/mantis/view.php?id=5825 --- .../InventoryAccess/InventoryAccessModule.cs | 12 ++++++++++-- .../Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8b5b1a749f..63ba3d39b8 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -546,12 +546,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return null; userID = remoteClient.AgentId; + +// m_log.DebugFormat( +// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is {1} {2}", +// action, remoteClient.Name, userID); } else { // All returns / deletes go to the object owner // userID = so.RootPart.OwnerID; + +// m_log.DebugFormat( +// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is object owner {1}", +// action, userID); } if (userID == UUID.Zero) // Can't proceed @@ -637,11 +645,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } // Override and put into where it came from, if it came - // from anywhere in inventory + // from anywhere in inventory and the owner is taking it back. // if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) { - if (so.RootPart.FromFolderID != UUID.Zero) + if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) { InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); folder = m_Scene.InventoryService.GetFolder(f); diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 5dfd3e027b..f678d07805 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -148,7 +148,8 @@ namespace OpenSim.Region.Framework.Scenes x = m_inventoryDeletes.Dequeue(); m_log.DebugFormat( - "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", left, x.action, x.objectGroups.Count); + "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", + left, x.action, x.objectGroups.Count); try { From a7dc7e636e3de9028668a6c570c6a713d4cd729b Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Fri, 10 Feb 2012 21:18:43 +0100 Subject: [PATCH 2/9] Fix: Covenant view fails after updates or cache-clean see mantis http://opensimulator.org/mantis/view.php?id=2879 Signed-off-by: BlueWall --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ff96f4dcf0..d98ff68d39 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -7625,6 +7625,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } + else + if (transfer.TransferInfo.SourceType == (int)SourceType.SimEstate) + { + //TransferRequestPacket does not include covenant uuid? + //get scene covenant uuid + taskID = m_scene.RegionInfo.RegionSettings.Covenant; + } MakeAssetRequest(transfer, taskID); @@ -11985,6 +11992,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP { requestID = new UUID(transferRequest.TransferInfo.Params, 80); } + else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimEstate) + { + requestID = taskID; + } + // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); From b3d152f3ba5cb07c005b0163c752f2c0f97c0034 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 10 Feb 2012 21:26:05 +0000 Subject: [PATCH 3/9] Fix an npc delete race condition with LSL sensors where an initial presence check could succeed but then the npc removed before the subequent npc check. The resulting null would cause an exception. We now check for null before looking at SenseAsAgent. Hopefully fixes http://opensimulator.org/mantis/view.php?id=5872 --- .../Implementation/Plugins/SensorRepeat.cs | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 3e0e452ce0..850f50b13d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -445,17 +445,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins Vector3 toRegionPos; double dis; - Action senseEntity = new Action(delegate(ScenePresence presence) + Action senseEntity = new Action(presence => { - if ((ts.type & NPC) == 0 - && presence.PresenceType == PresenceType.Npc - && !npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent) - return; + if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) + { + INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); + if (npcData == null || !npcData.SenseAsAgent) + return; + } - if ((ts.type & AGENT) == 0 - && (presence.PresenceType == PresenceType.User - || npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent)) - return; + if ((ts.type & AGENT) == 0) + { + if (presence.PresenceType == PresenceType.User) + { + return; + } + else + { + INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); + if (npcData != null && npcData.SenseAsAgent) + return; + } + } if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) return; From d80422eba7a4c75f6947ab9186d652b0a31b845e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 10 Feb 2012 23:39:32 +0000 Subject: [PATCH 4/9] Add line numbers to Util.PrintCallStack() --- OpenSim/Framework/Util.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index ed92b2d2f4..4b0b13c3f4 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1664,13 +1664,14 @@ namespace OpenSim.Framework /// public static void PrintCallStack() { - StackTrace stackTrace = new StackTrace(); // get call stack + StackTrace stackTrace = new StackTrace(true); // get call stack StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) // write call stack method names foreach (StackFrame stackFrame in stackFrames) { - m_log.Debug(stackFrame.GetMethod().DeclaringType + "." + stackFrame.GetMethod().Name); // write method name + MethodBase mb = stackFrame.GetMethod(); + m_log.DebugFormat("{0}.{1}:{2}", mb.DeclaringType, mb.Name, stackFrame.GetFileLineNumber()); // write method name } } From 71e484516a0323187077c734d5b30d2839ebab99 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 10 Feb 2012 23:41:14 +0000 Subject: [PATCH 5/9] minor: Remove warning from RegionInfo due to repeated config.GetString() call where the first was unused. --- OpenSim/Framework/RegionInfo.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 661b457146..5ba3863529 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -625,7 +625,6 @@ namespace OpenSim.Framework foreach (String s in allKeys) { - string val = config.GetString(s); SetOtherSetting(s, config.GetString(s)); } } From 5023cc86f095d7d3f25213ff63c4e1fcaf6c4e92 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 10 Feb 2012 23:52:06 +0000 Subject: [PATCH 6/9] Change parser to leave embedded quotes alone if the pattern is recognized as an OptionSet long option --- OpenSim/Framework/Console/CommandConsole.cs | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index a0d3541b32..0d6288b5a3 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Text; +using System.Text.RegularExpressions; using System.Threading; using log4net; using OpenSim.Framework; @@ -531,6 +532,11 @@ namespace OpenSim.Framework.Console public class Parser { + // If an unquoted portion ends with an element matching this regex + // and the next element contains a space, then we have stripped + // embedded quotes that should not have been stripped + private static Regex optionRegex = new Regex("^--[a-zA-Z0-9-]+=$"); + public static string[] Parse(string text) { List result = new List(); @@ -544,10 +550,38 @@ namespace OpenSim.Framework.Console if (index % 2 == 0) { string[] words = unquoted[index].Split(new char[] {' '}); + + bool option = false; foreach (string w in words) { if (w != String.Empty) + { + if (optionRegex.Match(w) == Match.Empty) + option = false; + else + option = true; result.Add(w); + } + } + // The last item matched the regex, put the quotes back + if (option) + { + // If the line ended with it, don't do anything + if (index < (unquoted.Length - 1)) + { + // Get and remove the option name + string optionText = result[result.Count - 1]; + result.RemoveAt(result.Count - 1); + + // Add the quoted value back + optionText += "\"" + unquoted[index + 1] + "\""; + + // Push the result into our return array + result.Add(optionText); + + // Skip the already used value + index++; + } } } else From e7fd7322095d518ccd7b446cf5c0683ef8009793 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 11 Feb 2012 00:10:59 +0000 Subject: [PATCH 7/9] Make ScenePresence.MovementFlag a private only settable value to reduce complexity of code analysis --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5c56150003..77f7b32fe3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -291,13 +291,10 @@ namespace OpenSim.Region.Framework.Scenes /// public PhysicsActor PhysicsActor { get; private set; } - private byte m_movementflag; - - public byte MovementFlag - { - set { m_movementflag = value; } - get { return m_movementflag; } - } + /// + /// Record user movement inputs. + /// + public byte MovementFlag { get; private set; } private bool m_updateflag; From f49897a4195df5fbd00e2c16461bcebb36ce8f72 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 11 Feb 2012 02:26:53 +0000 Subject: [PATCH 8/9] Clamp ODE character velocity. Make ODE falling character 54m/s by default. If velocity reaches 256 in any vector then bad things happen with ODE, so we now clamp this value. In addition, a falling avatar is clamped by default at 54 m/s, which is the same as a falling skydiver. This also appears to be the value used on the linden lab grid. This should resolve http://opensimulator.org/mantis/view.php?id=5882 --- .../Region/Physics/OdePlugin/ODECharacter.cs | 43 ++++++++++++++++++- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 11 +++++ bin/OpenSimDefaults.ini | 5 +++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 7c1c046522..6d1f41da05 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -156,6 +156,22 @@ namespace OpenSim.Region.Physics.OdePlugin internal UUID m_uuid { get; private set; } internal bool bad = false; + /// + /// ODE Avatar. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Only used right now to return information to LSL. Not actually used to set mass in ODE! + /// + /// + /// public OdeCharacter( String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, @@ -786,6 +802,10 @@ namespace OpenSim.Region.Physics.OdePlugin Vector3 vec = Vector3.Zero; d.Vector3 vel = d.BodyGetLinearVel(Body); +// m_log.DebugFormat( +// "[ODE CHARACTER]: Current velocity in Move() is <{0},{1},{2}>, target {3} for {4}", +// vel.X, vel.Y, vel.Z, _target_velocity, Name); + float movementdivisor = 1f; if (!m_alwaysRun) @@ -884,18 +904,20 @@ namespace OpenSim.Region.Physics.OdePlugin if (flying) { + // This also acts as anti-gravity so that we hover when flying rather than fall. vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); } } if (flying) { + // Anti-gravity so that we hover when flying rather than fall. vec.Z += ((-1 * _parent_scene.gravityz) * m_mass); //Added for auto fly height. Kitto Flora //d.Vector3 pos = d.BodyGetPosition(Body); float target_altitude = _parent_scene.GetTerrainHeightAtXY(_position.X, _position.Y) + MinimumGroundFlightOffset; - + if (_position.Z < target_altitude) { vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f; @@ -921,6 +943,25 @@ namespace OpenSim.Region.Physics.OdePlugin return; } + + d.Vector3 newVel = d.BodyGetLinearVel(Body); + if (newVel.X >= 256 || newVel.X <= 256 || newVel.Y >= 256 || newVel.Y <= 256 || newVel.Z >= 256 || newVel.Z <= 256) + { +// m_log.DebugFormat( +// "[ODE CHARACTER]: Limiting falling velocity from {0} to {1} for {2}", newVel.Z, -9.8, Name); + + newVel.X = Util.Clamp(newVel.X, -255f, 255f); + newVel.Y = Util.Clamp(newVel.Y, -255f, 255f); + + if (!flying) + newVel.Z + = Util.Clamp( + newVel.Z, -_parent_scene.AvatarTerminalVelocity, _parent_scene.AvatarTerminalVelocity); + else + newVel.Z = Util.Clamp(newVel.Z, -255f, 255f); + + d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); + } } /// diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 4530c09464..7d1401c7b8 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -144,6 +144,8 @@ namespace OpenSim.Region.Physics.OdePlugin public float gravityy = 0f; public float gravityz = -9.8f; + public float AvatarTerminalVelocity { get; set; } + private float contactsurfacelayer = 0.001f; private int worldHashspaceLow = -4; @@ -459,6 +461,15 @@ namespace OpenSim.Region.Physics.OdePlugin gravityy = physicsconfig.GetFloat("world_gravityy", 0f); gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f); + float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 9f); + AvatarTerminalVelocity = Util.Clamp(avatarTerminalVelocity, 0, 255f); + if (AvatarTerminalVelocity != avatarTerminalVelocity) + { + m_log.WarnFormat( + "[ODE SCENE]: avatar_terminal_velocity of {0} is invalid. Clamping to {1}", + avatarTerminalVelocity, AvatarTerminalVelocity); + } + worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4); worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128); diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 62fe9d4188..3fd3d31b6e 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -655,6 +655,11 @@ world_gravityy = 0 world_gravityz = -9.8 + ; Terminal velocity of a falling avatar + ; This is the same http://en.wikipedia.org/wiki/Terminal_velocity#Examples + ; Max value is 255, min value is 0 + avatar_terminal_velocity = 54 + ; World Step size. (warning these are dangerous. Changing these will probably cause your scene to explode dramatically) ; reference: fps = (0.089/ODE_STEPSIZE) * 1000; world_stepsize = 0.0178 From b92b9228ef5c7833dac019aba12babb5df954d35 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 11 Feb 2012 02:29:07 +0000 Subject: [PATCH 9/9] correct the default avatar_terminal_velocity value that I accidentally left in whilst testing --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 7d1401c7b8..598530c50f 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -461,7 +461,7 @@ namespace OpenSim.Region.Physics.OdePlugin gravityy = physicsconfig.GetFloat("world_gravityy", 0f); gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f); - float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 9f); + float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 54f); AvatarTerminalVelocity = Util.Clamp(avatarTerminalVelocity, 0, 255f); if (AvatarTerminalVelocity != avatarTerminalVelocity) {