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 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)); } } 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 } } 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); 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 { 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; 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..598530c50f 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", 54f); + 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/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; 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