From d3b43a96fbbb2d0c4afab546acbc72f6e3612198 Mon Sep 17 00:00:00 2001 From: Dev Random Date: Tue, 4 Nov 2014 21:31:11 -0500 Subject: [PATCH 1/8] Add 'terrain feature' command --- .../Terrain/Features/RectangleFeature.cs | 149 ++++++++++++++++++ .../World/Terrain/ITerrainFeature.cs | 60 +++++++ .../World/Terrain/TerrainFeature.cs | 89 +++++++++++ .../World/Terrain/TerrainModule.cs | 57 ++++++- 4 files changed, 353 insertions(+), 2 deletions(-) create mode 100644 OpenSim/Region/CoreModules/World/Terrain/Features/RectangleFeature.cs create mode 100644 OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs create mode 100644 OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs diff --git a/OpenSim/Region/CoreModules/World/Terrain/Features/RectangleFeature.cs b/OpenSim/Region/CoreModules/World/Terrain/Features/RectangleFeature.cs new file mode 100644 index 0000000000..33c3fbe35b --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Terrain/Features/RectangleFeature.cs @@ -0,0 +1,149 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using OpenSim.Region.CoreModules.World.Terrain; +using OpenSim.Region.Framework.Interfaces; + +namespace OpenSim.Region.CoreModules.World.Terrain.Features +{ + public class RectangleFeature : TerrainFeature + { + public RectangleFeature(ITerrainModule module) : base(module) + { + } + + public override string CreateFeature(ITerrainChannel map, string[] args) + { + string val; + string result; + if (args.Length < 7) + { + result = "Usage: " + GetUsage(); + } + else + { + result = String.Empty; + + float targetElevation; + val = base.parseFloat(args[3], out targetElevation); + if (val != String.Empty) + { + result = val; + } + + int xOrigin; + val = base.parseInt(args[4], out xOrigin); + if (val != String.Empty) + { + result = val; + } + else if (xOrigin < 0 || xOrigin >= map.Width) + { + result = "x-origin must be within the region"; + } + + int yOrigin; + val = base.parseInt(args[5], out yOrigin); + if (val != String.Empty) + { + result = val; + } + else if (yOrigin < 0 || yOrigin >= map.Height) + { + result = "y-origin must be within the region"; + } + + int xDelta; + val = base.parseInt(args[6], out xDelta); + if (val != String.Empty) + { + result = val; + } + else if (xDelta <= 0) + { + result = "x-size must be greater than zero"; + } + + int yDelta; + if (args.Length > 7) + { + val = base.parseInt(args[7], out yDelta); + if (val != String.Empty) + { + result = val; + } + else if (yDelta <= 0) + { + result = "y-size must be greater than zero"; + } + } + else + { + // no y-size.. make it square + yDelta = xDelta; + } + + // slightly more complex validation, if required. + if (result == String.Empty) + { + if (xOrigin + xDelta > map.Width) + { + result = "(x-origin + x-size) must be within the region size"; + } + else if (yOrigin + yDelta > map.Height) + { + result = "(y-origin + y-size) must be within the region size"; + } + } + + // if it's all good, then do the work + if (result == String.Empty) + { + int yPos = yOrigin + yDelta; + while(--yPos >= yOrigin) + { + int xPos = xOrigin + xDelta; + while(--xPos >= xOrigin) + { + map[xPos, yPos] = (double)targetElevation; + } + } + } + } + + return result; + } + + public override string GetUsage() + { + return "rectangle []"; + } + } + +} + diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs new file mode 100644 index 0000000000..78a43dbaff --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using OpenSim.Region.Framework.Interfaces; + +namespace OpenSim.Region.CoreModules.World.Terrain +{ + public interface ITerrainFeature + { + /// + /// Creates the feature. + /// + /// + /// Empty string if successful, otherwise error message. + /// + /// + /// ITerrainChannel holding terrain data. + /// + /// + /// command-line arguments from console. + /// + string CreateFeature(ITerrainChannel map, string[] args); + + /// + /// Gets a string describing the usage. + /// + /// + /// A string describing parameters for creating the feature. + /// Format is "feature-name ..." + /// + string GetUsage(); + } + +} + diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs new file mode 100644 index 0000000000..701a729d2e --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs @@ -0,0 +1,89 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Reflection; + +using OpenSim.Region.Framework.Interfaces; + +namespace OpenSim.Region.CoreModules.World.Terrain +{ + public abstract class TerrainFeature : ITerrainFeature + { + protected ITerrainModule m_module; + + protected TerrainFeature(ITerrainModule module) + { + m_module = module; + } + + public abstract string CreateFeature(ITerrainChannel map, string[] args); + + public abstract string GetUsage(); + + protected string parseFloat(String s, out float f) + { + string result; + double d; + if (Double.TryParse(s, out d)) + { + try + { + f = (float)d; + result = String.Empty; + } + catch(InvalidCastException) + { + result = String.Format("{0} is invalid", s); + f = -1.0f; + } + } + else + { + f = -1.0f; + result = String.Format("{0} is invalid", s); + } + return result; + } + + protected string parseInt(String s, out int i) + { + string result; + if (Int32.TryParse(s, out i)) + { + result = String.Empty; + } + else + { + result = String.Format("{0} is invalid", s); + } + return result; + } + + } + +} + diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index cd76693f42..3bb804098c 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -42,6 +42,7 @@ using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; +using OpenSim.Region.CoreModules.World.Terrain.Features; using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes; using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; using OpenSim.Region.Framework.Interfaces; @@ -74,6 +75,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain #endregion + /// + /// Terrain Features + /// + public enum TerrainFeatures: byte + { + Rectangle = 1, + } + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); #pragma warning disable 414 @@ -90,8 +99,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain private readonly Dictionary m_painteffects = new Dictionary(); - private ITerrainChannel m_channel; private Dictionary m_plugineffects; + + private Dictionary m_featureEffects = + new Dictionary(); + + private ITerrainChannel m_channel; private ITerrainChannel m_revert; private Scene m_scene; private volatile bool m_tainted; @@ -648,6 +661,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea(); m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_revert); + // Terrain Feature effects + m_featureEffects["rectangle"] = new RectangleFeature(this); + // Filesystem load/save loaders m_loaders[".r32"] = new RAW32(); m_loaders[".f32"] = m_loaders[".r32"]; @@ -1622,7 +1638,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain "Enables experimental brushes which replace the standard terrain brushes. WARNING: This is a debug setting and may be removed at any time."); experimentalBrushesCommand.AddArgument("Enabled?", "true / false - Enable new brushes", "Boolean"); - //Plugins + // Plugins Command pluginRunCommand = new Command("effect", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRunPluginEffect, "Runs a specified plugin effect"); pluginRunCommand.AddArgument("name", "The plugin effect you wish to run, or 'list' to see all plugins", "String"); @@ -1648,9 +1664,46 @@ namespace OpenSim.Region.CoreModules.World.Terrain // Add this to our scene so scripts can call these functions m_scene.RegisterModuleCommander(m_commander); + + // Add Feature command to Scene, since Command object requires fixed-length arglists + m_scene.AddCommand("Terrain", this, "terrain feature", + "terrain feature ", "Constructs a feature of the requested type.", FeatureCommand); + } + public void FeatureCommand(string module, string[] cmd) + { + string result; + if (cmd.Length > 2) + { + string featureType = cmd[2]; + ITerrainFeature feature; + if (!m_featureEffects.TryGetValue(featureType, out feature)) + { + result = String.Format("Terrain Feature \"{0}\" not found.", featureType); + } + else if ((cmd.Length > 3) && (cmd[3] == "usage")) + { + result = "Usage: " + feature.GetUsage(); + } + else + { + result = feature.CreateFeature(m_channel, cmd); + } + + if(result == String.Empty) + { + result = "Created Feature"; + m_log.DebugFormat("Created terrain feature {0}", featureType); + } + } + else + { + result = "Usage: ..."; + } + MainConsole.Instance.Output(result); + } #endregion } From b9f870fa73d18de15b8a2d067e65366ab624be2b Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Fri, 14 Nov 2014 21:55:52 +0000 Subject: [PATCH 2/8] Minor: Update LLLoginService to handle explicitly set login locations that include decimal precision. Fractions might be introduced if setting the initial login location from a viewer splash screen with data from the DataSnapshot service. At present the fractions cause regex to fail when matching the login string causing an exception. --- OpenSim/Services/LLLoginService/LLLoginService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index b1aabe6b93..d2ff29256c 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -615,7 +615,7 @@ namespace OpenSim.Services.LLLoginService // e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34 where = "url"; GridRegion region = null; - Regex reURI = new Regex(@"^uri:(?[^&]+)&(?\d+)&(?\d+)&(?\d+)$"); + Regex reURI = new Regex(@"^uri:(?[^&]+)&(?\d+[.]?\d*)&(?\d+[.]?\d*)&(?\d+[.]?\d*)$"); Match uriMatch = reURI.Match(startLocation); if (uriMatch == null) { From 67e56872f3529e5e2b1bf6b6f548bc00fec129e7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey Date: Wed, 19 Nov 2014 19:08:33 +0000 Subject: [PATCH 3/8] If llStopMoveToTarget() is called on an attachment, then stop the avatar if it was moving to target. Same behaviour as on Linden Lab grid. Will probably also address http://opensimulator.org/mantis/view.php?id=7369 by not generating spurious object updates when llStopMoveToTarget() is called in attachments where the avatar is not moving. --- .../Framework/Scenes/SceneObjectGroup.cs | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 853558773e..167485eccc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1891,10 +1891,9 @@ namespace OpenSim.Region.Framework.Scenes if (IsAttachment) { ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); + if (avatar != null) - { avatar.MoveToTarget(target, false, false); - } } else { @@ -1911,10 +1910,25 @@ namespace OpenSim.Region.Framework.Scenes public void stopMoveToTarget() { - PhysicsActor pa = RootPart.PhysActor; + if (IsAttachment) + { + ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); - if (pa != null) - pa.PIDActive = false; + if (avatar != null) + avatar.ResetMoveToTarget(); + } + else + { + PhysicsActor pa = RootPart.PhysActor; + + if (pa != null) + { + pa.PIDActive = false; + + ScheduleGroupForTerseUpdate(); + //ParentGroup.ScheduleGroupForFullUpdate(); + } + } } /// From bdebd525dbc3b7738a59d7987649173b1f48435b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey Date: Wed, 19 Nov 2014 19:16:03 +0000 Subject: [PATCH 4/8] Remove SOP.StopMoveToTarget scheduled update which is now being done in SOG.stopMoveToTarget() as of last commit 67e568 --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c587b2aff4..fb1372f8a6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3280,9 +3280,6 @@ namespace OpenSim.Region.Framework.Scenes public void StopMoveToTarget() { ParentGroup.stopMoveToTarget(); - - ParentGroup.ScheduleGroupForTerseUpdate(); - //ParentGroup.ScheduleGroupForFullUpdate(); } public void StoreUndoState() From 7a2c77e7eace93d722ef37595e9fab21d3cd266f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey Date: Wed, 19 Nov 2014 20:06:56 +0000 Subject: [PATCH 5/8] If calling llStopMoveToTarget() on an in-world prim, don't send an unnecessary object update if the prim was not moving to target. This involves making PhysicsActor.PIDActive get as well as set. On physics components that don't implement this (all characters and some phys engines) we return false. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 3 +-- .../BasicPhysicsPlugin/BasicPhysicsActor.cs | 1 + .../Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs | 1 + .../Region/Physics/BulletSPlugin/BSCharacter.cs | 6 +++--- .../Region/Physics/BulletSPlugin/BSPhysObject.cs | 7 ++++++- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 14 +++++++++++--- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 10 ++++++++-- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 6 +++++- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 11 +++++------ OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | 7 ++++--- OpenSim/Region/Physics/POSPlugin/POSPrim.cs | 1 + 11 files changed, 46 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 167485eccc..b2b0002383 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1921,12 +1921,11 @@ namespace OpenSim.Region.Framework.Scenes { PhysicsActor pa = RootPart.PhysActor; - if (pa != null) + if (pa != null && pa.PIDActive) { pa.PIDActive = false; ScheduleGroupForTerseUpdate(); - //ParentGroup.ScheduleGroupForFullUpdate(); } } } diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index c1a37cc5e7..43fba7b994 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs @@ -238,6 +238,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin public override bool PIDActive { + get { return false; } set { return; } } diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs index 47d7df3cc1..dfe4c19d88 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs @@ -251,6 +251,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin public override bool PIDActive { + get { return false; } set { return; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 9b56fb432d..a3039721d2 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -614,9 +614,9 @@ public sealed class BSCharacter : BSPhysObject public override OMV.Vector3 PIDTarget { set { _PIDTarget = value; } } - public override bool PIDActive { - set { _usePID = value; } - } + + public override bool PIDActive { get; set; } + public override float PIDTau { set { _PIDTau = value; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 75ffeb4830..f05932291c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -246,7 +246,12 @@ public abstract class BSPhysObject : PhysicsActor public virtual bool ForceBodyShapeRebuild(bool inTaintTime) { return false; } - public override bool PIDActive { set { MoveToTargetActive = value; } } + public override bool PIDActive + { + get { return MoveToTargetActive; } + set { MoveToTargetActive = value; } + } + public override OMV.Vector3 PIDTarget { set { MoveToTargetTarget = value; } } public override float PIDTau { set { MoveToTargetTau = value; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index edec949eb1..27ee5ac9a8 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1087,9 +1087,17 @@ public class BSPrim : BSPhysObject } } - public override bool PIDActive { - set { - base.MoveToTargetActive = value; + public override bool PIDActive + { + get + { + return MoveToTargetActive; + } + + set + { + MoveToTargetActive = value; + EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate() { return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName); diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 1750853aeb..6bc6e23f8d 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -291,7 +291,7 @@ namespace OpenSim.Region.Physics.Manager // Used for MoveTo public abstract Vector3 PIDTarget { set; } - public abstract bool PIDActive { set;} + public abstract bool PIDActive { get; set; } public abstract float PIDTau { set; } // Used for llSetHoverHeight and maybe vehicle height @@ -545,7 +545,13 @@ namespace OpenSim.Region.Physics.Manager } public override Vector3 PIDTarget { set { return; } } - public override bool PIDActive { set { return; } } + + public override bool PIDActive + { + get { return false; } + set { return; } + } + public override float PIDTau { set { return; } } public override float PIDHoverHeight { set { return; } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 8f37b79353..67503df38f 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -1245,7 +1245,11 @@ namespace OpenSim.Region.Physics.OdePlugin } public override Vector3 PIDTarget { set { return; } } - public override bool PIDActive { set { return; } } + public override bool PIDActive + { + get { return false; } + set { return; } + } public override float PIDTau { set { return; } } public override float PIDHoverHeight { set { return; } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 13c69d6f0f..e347fdc015 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -114,7 +114,6 @@ namespace OpenSim.Region.Physics.OdePlugin private float m_PIDTau; private float PID_D = 35f; private float PID_G = 25f; - private bool m_usePID; // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), // and are for non-VEHICLES only. @@ -1723,7 +1722,7 @@ Console.WriteLine(" JointCreateFixed"); // gravityz multiplier = 1 - m_buoyancy fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; - if (m_usePID) + if (PIDActive) { //Console.WriteLine("PID " + Name); // KF - this is for object move? eg. llSetPos() ? @@ -1792,10 +1791,10 @@ Console.WriteLine(" JointCreateFixed"); fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); } - } // end if (m_usePID) + } // end if (PIDActive) // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller - if (m_useHoverPID && !m_usePID) + if (m_useHoverPID && !PIDActive) { //Console.WriteLine("Hover " + Name); @@ -2866,7 +2865,7 @@ Console.WriteLine(" JointCreateFixed"); // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles // adding these logical exclusion situations to maintain this where I think it was intended to be. - if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) + if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) { m_minvelocity = 0.5f; } @@ -2947,7 +2946,7 @@ Console.WriteLine(" JointCreateFixed"); m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); } } - public override bool PIDActive { set { m_usePID = value; } } + public override bool PIDActive { get; set; } public override float PIDTau { set { m_PIDTau = value; } } public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index ae534eaeef..40ab984dc8 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs @@ -273,9 +273,10 @@ namespace OpenSim.Region.Physics.POSPlugin set { return; } } - public override bool PIDActive - { - set { return; } + public override bool PIDActive + { + get { return false; } + set { return; } } public override float PIDTau diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index e4fd7eb277..7c1e91597d 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs @@ -270,6 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin public override bool PIDActive { + get { return false; } set { return; } } From 3247a7cb3e4369996ed5a644784c7b1d6472a946 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey Date: Wed, 19 Nov 2014 20:12:28 +0000 Subject: [PATCH 6/8] refactor: capitalize SOP.moveToTarget() and stopMoveToTarget() in accordance with code guidelines and the rest of the methods. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++-- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b2b0002383..ec37836ef2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1886,7 +1886,7 @@ namespace OpenSim.Region.Framework.Scenes return Vector3.Zero; } - public void moveToTarget(Vector3 target, float tau) + public void MoveToTarget(Vector3 target, float tau) { if (IsAttachment) { @@ -1908,7 +1908,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void stopMoveToTarget() + public void StopMoveToTarget() { if (IsAttachment) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index fb1372f8a6..c318e53b44 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2229,7 +2229,7 @@ namespace OpenSim.Region.Framework.Scenes { if (tau > 0) { - ParentGroup.moveToTarget(target, tau); + ParentGroup.MoveToTarget(target, tau); } else { @@ -3279,7 +3279,7 @@ namespace OpenSim.Region.Framework.Scenes public void StopMoveToTarget() { - ParentGroup.stopMoveToTarget(); + ParentGroup.StopMoveToTarget(); } public void StoreUndoState() From c155656349ee2865498a756f5f4181065b741b44 Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Sun, 16 Nov 2014 10:26:38 +0000 Subject: [PATCH 7/8] Minor: Include missing EventHost power for group owner role. --- OpenSim/Addons/Groups/Service/GroupsService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs index 7cbc7968e6..4da7233d73 100644 --- a/OpenSim/Addons/Groups/Service/GroupsService.cs +++ b/OpenSim/Addons/Groups/Service/GroupsService.cs @@ -69,6 +69,7 @@ namespace OpenSim.Groups GroupPowers.DeleteRole | GroupPowers.Eject | GroupPowers.FindPlaces | + GroupPowers.HostEvent | GroupPowers.Invite | GroupPowers.JoinChat | GroupPowers.LandChangeIdentity | From cfaf904a3b2ab7a8be062d21b2d16cae88a6876e Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 19 Nov 2014 18:07:03 -0700 Subject: [PATCH 8/8] LSL key should be implicitly cast to a boolean value Signed-off-by: James Hughes --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 7d21a4b4ba..ca81af1838 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -1430,6 +1430,16 @@ namespace OpenSim.Region.ScriptEngine.Shared return false; } } + + public static bool operator true(key k) + { + return (Boolean)k; + } + + public static bool operator false(key k) + { + return !(Boolean)k; + } static public implicit operator key(string s) {