diff options
author | Diva Canto | 2014-11-21 08:54:30 -0800 |
---|---|---|
committer | Diva Canto | 2014-11-21 08:54:30 -0800 |
commit | 8d3cb424a8730a0d0cdea42e513057c2c3fff679 (patch) | |
tree | 611eb8cd3c3526e1f41058ed000e1c3f9f644cf8 /OpenSim/Region | |
parent | Cleanup extraneous comments from viewer support modules (diff) | |
parent | LSL key should be implicitly cast to a boolean value (diff) | |
download | opensim-SC_OLD-8d3cb424a8730a0d0cdea42e513057c2c3fff679.zip opensim-SC_OLD-8d3cb424a8730a0d0cdea42e513057c2c3fff679.tar.gz opensim-SC_OLD-8d3cb424a8730a0d0cdea42e513057c2c3fff679.tar.bz2 opensim-SC_OLD-8d3cb424a8730a0d0cdea42e513057c2c3fff679.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
17 files changed, 430 insertions, 33 deletions
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 0000000..33c3fbe --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Terrain/Features/RectangleFeature.cs | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Region.CoreModules.World.Terrain; | ||
30 | using OpenSim.Region.Framework.Interfaces; | ||
31 | |||
32 | namespace OpenSim.Region.CoreModules.World.Terrain.Features | ||
33 | { | ||
34 | public class RectangleFeature : TerrainFeature | ||
35 | { | ||
36 | public RectangleFeature(ITerrainModule module) : base(module) | ||
37 | { | ||
38 | } | ||
39 | |||
40 | public override string CreateFeature(ITerrainChannel map, string[] args) | ||
41 | { | ||
42 | string val; | ||
43 | string result; | ||
44 | if (args.Length < 7) | ||
45 | { | ||
46 | result = "Usage: " + GetUsage(); | ||
47 | } | ||
48 | else | ||
49 | { | ||
50 | result = String.Empty; | ||
51 | |||
52 | float targetElevation; | ||
53 | val = base.parseFloat(args[3], out targetElevation); | ||
54 | if (val != String.Empty) | ||
55 | { | ||
56 | result = val; | ||
57 | } | ||
58 | |||
59 | int xOrigin; | ||
60 | val = base.parseInt(args[4], out xOrigin); | ||
61 | if (val != String.Empty) | ||
62 | { | ||
63 | result = val; | ||
64 | } | ||
65 | else if (xOrigin < 0 || xOrigin >= map.Width) | ||
66 | { | ||
67 | result = "x-origin must be within the region"; | ||
68 | } | ||
69 | |||
70 | int yOrigin; | ||
71 | val = base.parseInt(args[5], out yOrigin); | ||
72 | if (val != String.Empty) | ||
73 | { | ||
74 | result = val; | ||
75 | } | ||
76 | else if (yOrigin < 0 || yOrigin >= map.Height) | ||
77 | { | ||
78 | result = "y-origin must be within the region"; | ||
79 | } | ||
80 | |||
81 | int xDelta; | ||
82 | val = base.parseInt(args[6], out xDelta); | ||
83 | if (val != String.Empty) | ||
84 | { | ||
85 | result = val; | ||
86 | } | ||
87 | else if (xDelta <= 0) | ||
88 | { | ||
89 | result = "x-size must be greater than zero"; | ||
90 | } | ||
91 | |||
92 | int yDelta; | ||
93 | if (args.Length > 7) | ||
94 | { | ||
95 | val = base.parseInt(args[7], out yDelta); | ||
96 | if (val != String.Empty) | ||
97 | { | ||
98 | result = val; | ||
99 | } | ||
100 | else if (yDelta <= 0) | ||
101 | { | ||
102 | result = "y-size must be greater than zero"; | ||
103 | } | ||
104 | } | ||
105 | else | ||
106 | { | ||
107 | // no y-size.. make it square | ||
108 | yDelta = xDelta; | ||
109 | } | ||
110 | |||
111 | // slightly more complex validation, if required. | ||
112 | if (result == String.Empty) | ||
113 | { | ||
114 | if (xOrigin + xDelta > map.Width) | ||
115 | { | ||
116 | result = "(x-origin + x-size) must be within the region size"; | ||
117 | } | ||
118 | else if (yOrigin + yDelta > map.Height) | ||
119 | { | ||
120 | result = "(y-origin + y-size) must be within the region size"; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | // if it's all good, then do the work | ||
125 | if (result == String.Empty) | ||
126 | { | ||
127 | int yPos = yOrigin + yDelta; | ||
128 | while(--yPos >= yOrigin) | ||
129 | { | ||
130 | int xPos = xOrigin + xDelta; | ||
131 | while(--xPos >= xOrigin) | ||
132 | { | ||
133 | map[xPos, yPos] = (double)targetElevation; | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | |||
139 | return result; | ||
140 | } | ||
141 | |||
142 | public override string GetUsage() | ||
143 | { | ||
144 | return "rectangle <height> <x-origin> <y-origin> <x-size> [<y-size>]"; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | } | ||
149 | |||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs new file mode 100644 index 0000000..78a43db --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Region.Framework.Interfaces; | ||
30 | |||
31 | namespace OpenSim.Region.CoreModules.World.Terrain | ||
32 | { | ||
33 | public interface ITerrainFeature | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Creates the feature. | ||
37 | /// </summary> | ||
38 | /// <returns> | ||
39 | /// Empty string if successful, otherwise error message. | ||
40 | /// </returns> | ||
41 | /// <param name='map'> | ||
42 | /// ITerrainChannel holding terrain data. | ||
43 | /// </param> | ||
44 | /// <param name='args'> | ||
45 | /// command-line arguments from console. | ||
46 | /// </param> | ||
47 | string CreateFeature(ITerrainChannel map, string[] args); | ||
48 | |||
49 | /// <summary> | ||
50 | /// Gets a string describing the usage. | ||
51 | /// </summary> | ||
52 | /// <returns> | ||
53 | /// A string describing parameters for creating the feature. | ||
54 | /// Format is "feature-name <arg1> <arg2> ..." | ||
55 | /// </returns> | ||
56 | string GetUsage(); | ||
57 | } | ||
58 | |||
59 | } | ||
60 | |||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs new file mode 100644 index 0000000..701a729 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Reflection; | ||
29 | |||
30 | using OpenSim.Region.Framework.Interfaces; | ||
31 | |||
32 | namespace OpenSim.Region.CoreModules.World.Terrain | ||
33 | { | ||
34 | public abstract class TerrainFeature : ITerrainFeature | ||
35 | { | ||
36 | protected ITerrainModule m_module; | ||
37 | |||
38 | protected TerrainFeature(ITerrainModule module) | ||
39 | { | ||
40 | m_module = module; | ||
41 | } | ||
42 | |||
43 | public abstract string CreateFeature(ITerrainChannel map, string[] args); | ||
44 | |||
45 | public abstract string GetUsage(); | ||
46 | |||
47 | protected string parseFloat(String s, out float f) | ||
48 | { | ||
49 | string result; | ||
50 | double d; | ||
51 | if (Double.TryParse(s, out d)) | ||
52 | { | ||
53 | try | ||
54 | { | ||
55 | f = (float)d; | ||
56 | result = String.Empty; | ||
57 | } | ||
58 | catch(InvalidCastException) | ||
59 | { | ||
60 | result = String.Format("{0} is invalid", s); | ||
61 | f = -1.0f; | ||
62 | } | ||
63 | } | ||
64 | else | ||
65 | { | ||
66 | f = -1.0f; | ||
67 | result = String.Format("{0} is invalid", s); | ||
68 | } | ||
69 | return result; | ||
70 | } | ||
71 | |||
72 | protected string parseInt(String s, out int i) | ||
73 | { | ||
74 | string result; | ||
75 | if (Int32.TryParse(s, out i)) | ||
76 | { | ||
77 | result = String.Empty; | ||
78 | } | ||
79 | else | ||
80 | { | ||
81 | result = String.Format("{0} is invalid", s); | ||
82 | } | ||
83 | return result; | ||
84 | } | ||
85 | |||
86 | } | ||
87 | |||
88 | } | ||
89 | |||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index cd76693..3bb8040 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Framework; | |||
42 | using OpenSim.Framework.Console; | 42 | using OpenSim.Framework.Console; |
43 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 43 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
44 | using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; | 44 | using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; |
45 | using OpenSim.Region.CoreModules.World.Terrain.Features; | ||
45 | using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes; | 46 | using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes; |
46 | using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; | 47 | using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; |
47 | using OpenSim.Region.Framework.Interfaces; | 48 | using OpenSim.Region.Framework.Interfaces; |
@@ -74,6 +75,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
74 | 75 | ||
75 | #endregion | 76 | #endregion |
76 | 77 | ||
78 | /// <summary> | ||
79 | /// Terrain Features | ||
80 | /// </summary> | ||
81 | public enum TerrainFeatures: byte | ||
82 | { | ||
83 | Rectangle = 1, | ||
84 | } | ||
85 | |||
77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 86 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
78 | 87 | ||
79 | #pragma warning disable 414 | 88 | #pragma warning disable 414 |
@@ -90,8 +99,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
90 | private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = | 99 | private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = |
91 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); | 100 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); |
92 | 101 | ||
93 | private ITerrainChannel m_channel; | ||
94 | private Dictionary<string, ITerrainEffect> m_plugineffects; | 102 | private Dictionary<string, ITerrainEffect> m_plugineffects; |
103 | |||
104 | private Dictionary<string, ITerrainFeature> m_featureEffects = | ||
105 | new Dictionary<string, ITerrainFeature>(); | ||
106 | |||
107 | private ITerrainChannel m_channel; | ||
95 | private ITerrainChannel m_revert; | 108 | private ITerrainChannel m_revert; |
96 | private Scene m_scene; | 109 | private Scene m_scene; |
97 | private volatile bool m_tainted; | 110 | private volatile bool m_tainted; |
@@ -648,6 +661,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
648 | m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea(); | 661 | m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea(); |
649 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_revert); | 662 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_revert); |
650 | 663 | ||
664 | // Terrain Feature effects | ||
665 | m_featureEffects["rectangle"] = new RectangleFeature(this); | ||
666 | |||
651 | // Filesystem load/save loaders | 667 | // Filesystem load/save loaders |
652 | m_loaders[".r32"] = new RAW32(); | 668 | m_loaders[".r32"] = new RAW32(); |
653 | m_loaders[".f32"] = m_loaders[".r32"]; | 669 | m_loaders[".f32"] = m_loaders[".r32"]; |
@@ -1622,7 +1638,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1622 | "Enables experimental brushes which replace the standard terrain brushes. WARNING: This is a debug setting and may be removed at any time."); | 1638 | "Enables experimental brushes which replace the standard terrain brushes. WARNING: This is a debug setting and may be removed at any time."); |
1623 | experimentalBrushesCommand.AddArgument("Enabled?", "true / false - Enable new brushes", "Boolean"); | 1639 | experimentalBrushesCommand.AddArgument("Enabled?", "true / false - Enable new brushes", "Boolean"); |
1624 | 1640 | ||
1625 | //Plugins | 1641 | // Plugins |
1626 | Command pluginRunCommand = | 1642 | Command pluginRunCommand = |
1627 | new Command("effect", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRunPluginEffect, "Runs a specified plugin effect"); | 1643 | new Command("effect", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRunPluginEffect, "Runs a specified plugin effect"); |
1628 | pluginRunCommand.AddArgument("name", "The plugin effect you wish to run, or 'list' to see all plugins", "String"); | 1644 | 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 | |||
1648 | 1664 | ||
1649 | // Add this to our scene so scripts can call these functions | 1665 | // Add this to our scene so scripts can call these functions |
1650 | m_scene.RegisterModuleCommander(m_commander); | 1666 | m_scene.RegisterModuleCommander(m_commander); |
1667 | |||
1668 | // Add Feature command to Scene, since Command object requires fixed-length arglists | ||
1669 | m_scene.AddCommand("Terrain", this, "terrain feature", | ||
1670 | "terrain feature <type> <parameters...>", "Constructs a feature of the requested type.", FeatureCommand); | ||
1671 | |||
1651 | } | 1672 | } |
1652 | 1673 | ||
1674 | public void FeatureCommand(string module, string[] cmd) | ||
1675 | { | ||
1676 | string result; | ||
1677 | if (cmd.Length > 2) | ||
1678 | { | ||
1679 | string featureType = cmd[2]; | ||
1653 | 1680 | ||
1681 | ITerrainFeature feature; | ||
1682 | if (!m_featureEffects.TryGetValue(featureType, out feature)) | ||
1683 | { | ||
1684 | result = String.Format("Terrain Feature \"{0}\" not found.", featureType); | ||
1685 | } | ||
1686 | else if ((cmd.Length > 3) && (cmd[3] == "usage")) | ||
1687 | { | ||
1688 | result = "Usage: " + feature.GetUsage(); | ||
1689 | } | ||
1690 | else | ||
1691 | { | ||
1692 | result = feature.CreateFeature(m_channel, cmd); | ||
1693 | } | ||
1694 | |||
1695 | if(result == String.Empty) | ||
1696 | { | ||
1697 | result = "Created Feature"; | ||
1698 | m_log.DebugFormat("Created terrain feature {0}", featureType); | ||
1699 | } | ||
1700 | } | ||
1701 | else | ||
1702 | { | ||
1703 | result = "Usage: <feature-name> <arg1> <arg2>..."; | ||
1704 | } | ||
1705 | MainConsole.Instance.Output(result); | ||
1706 | } | ||
1654 | #endregion | 1707 | #endregion |
1655 | 1708 | ||
1656 | } | 1709 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8535587..ec37836 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1886,15 +1886,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1886 | return Vector3.Zero; | 1886 | return Vector3.Zero; |
1887 | } | 1887 | } |
1888 | 1888 | ||
1889 | public void moveToTarget(Vector3 target, float tau) | 1889 | public void MoveToTarget(Vector3 target, float tau) |
1890 | { | 1890 | { |
1891 | if (IsAttachment) | 1891 | if (IsAttachment) |
1892 | { | 1892 | { |
1893 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); | 1893 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
1894 | |||
1894 | if (avatar != null) | 1895 | if (avatar != null) |
1895 | { | ||
1896 | avatar.MoveToTarget(target, false, false); | 1896 | avatar.MoveToTarget(target, false, false); |
1897 | } | ||
1898 | } | 1897 | } |
1899 | else | 1898 | else |
1900 | { | 1899 | { |
@@ -1909,12 +1908,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1909 | } | 1908 | } |
1910 | } | 1909 | } |
1911 | 1910 | ||
1912 | public void stopMoveToTarget() | 1911 | public void StopMoveToTarget() |
1913 | { | 1912 | { |
1914 | PhysicsActor pa = RootPart.PhysActor; | 1913 | if (IsAttachment) |
1914 | { | ||
1915 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); | ||
1915 | 1916 | ||
1916 | if (pa != null) | 1917 | if (avatar != null) |
1917 | pa.PIDActive = false; | 1918 | avatar.ResetMoveToTarget(); |
1919 | } | ||
1920 | else | ||
1921 | { | ||
1922 | PhysicsActor pa = RootPart.PhysActor; | ||
1923 | |||
1924 | if (pa != null && pa.PIDActive) | ||
1925 | { | ||
1926 | pa.PIDActive = false; | ||
1927 | |||
1928 | ScheduleGroupForTerseUpdate(); | ||
1929 | } | ||
1930 | } | ||
1918 | } | 1931 | } |
1919 | 1932 | ||
1920 | /// <summary> | 1933 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c587b2a..c318e53 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2229,7 +2229,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2229 | { | 2229 | { |
2230 | if (tau > 0) | 2230 | if (tau > 0) |
2231 | { | 2231 | { |
2232 | ParentGroup.moveToTarget(target, tau); | 2232 | ParentGroup.MoveToTarget(target, tau); |
2233 | } | 2233 | } |
2234 | else | 2234 | else |
2235 | { | 2235 | { |
@@ -3279,10 +3279,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3279 | 3279 | ||
3280 | public void StopMoveToTarget() | 3280 | public void StopMoveToTarget() |
3281 | { | 3281 | { |
3282 | ParentGroup.stopMoveToTarget(); | 3282 | ParentGroup.StopMoveToTarget(); |
3283 | |||
3284 | ParentGroup.ScheduleGroupForTerseUpdate(); | ||
3285 | //ParentGroup.ScheduleGroupForFullUpdate(); | ||
3286 | } | 3283 | } |
3287 | 3284 | ||
3288 | public void StoreUndoState() | 3285 | public void StoreUndoState() |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index c1a37cc..43fba7b 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | |||
@@ -238,6 +238,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
238 | 238 | ||
239 | public override bool PIDActive | 239 | public override bool PIDActive |
240 | { | 240 | { |
241 | get { return false; } | ||
241 | set { return; } | 242 | set { return; } |
242 | } | 243 | } |
243 | 244 | ||
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs index 47d7df3..dfe4c19 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs | |||
@@ -251,6 +251,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
251 | 251 | ||
252 | public override bool PIDActive | 252 | public override bool PIDActive |
253 | { | 253 | { |
254 | get { return false; } | ||
254 | set { return; } | 255 | set { return; } |
255 | } | 256 | } |
256 | 257 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 9b56fb4..a303972 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -614,9 +614,9 @@ public sealed class BSCharacter : BSPhysObject | |||
614 | public override OMV.Vector3 PIDTarget { | 614 | public override OMV.Vector3 PIDTarget { |
615 | set { _PIDTarget = value; } | 615 | set { _PIDTarget = value; } |
616 | } | 616 | } |
617 | public override bool PIDActive { | 617 | |
618 | set { _usePID = value; } | 618 | public override bool PIDActive { get; set; } |
619 | } | 619 | |
620 | public override float PIDTau { | 620 | public override float PIDTau { |
621 | set { _PIDTau = value; } | 621 | set { _PIDTau = value; } |
622 | } | 622 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 75ffeb4..f059322 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -246,7 +246,12 @@ public abstract class BSPhysObject : PhysicsActor | |||
246 | 246 | ||
247 | public virtual bool ForceBodyShapeRebuild(bool inTaintTime) { return false; } | 247 | public virtual bool ForceBodyShapeRebuild(bool inTaintTime) { return false; } |
248 | 248 | ||
249 | public override bool PIDActive { set { MoveToTargetActive = value; } } | 249 | public override bool PIDActive |
250 | { | ||
251 | get { return MoveToTargetActive; } | ||
252 | set { MoveToTargetActive = value; } | ||
253 | } | ||
254 | |||
250 | public override OMV.Vector3 PIDTarget { set { MoveToTargetTarget = value; } } | 255 | public override OMV.Vector3 PIDTarget { set { MoveToTargetTarget = value; } } |
251 | public override float PIDTau { set { MoveToTargetTau = value; } } | 256 | public override float PIDTau { set { MoveToTargetTau = value; } } |
252 | 257 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index edec949..27ee5ac 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -1087,9 +1087,17 @@ public class BSPrim : BSPhysObject | |||
1087 | } | 1087 | } |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | public override bool PIDActive { | 1090 | public override bool PIDActive |
1091 | set { | 1091 | { |
1092 | base.MoveToTargetActive = value; | 1092 | get |
1093 | { | ||
1094 | return MoveToTargetActive; | ||
1095 | } | ||
1096 | |||
1097 | set | ||
1098 | { | ||
1099 | MoveToTargetActive = value; | ||
1100 | |||
1093 | EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate() | 1101 | EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate() |
1094 | { | 1102 | { |
1095 | return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName); | 1103 | return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName); |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 1750853..6bc6e23 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -291,7 +291,7 @@ namespace OpenSim.Region.Physics.Manager | |||
291 | 291 | ||
292 | // Used for MoveTo | 292 | // Used for MoveTo |
293 | public abstract Vector3 PIDTarget { set; } | 293 | public abstract Vector3 PIDTarget { set; } |
294 | public abstract bool PIDActive { set;} | 294 | public abstract bool PIDActive { get; set; } |
295 | public abstract float PIDTau { set; } | 295 | public abstract float PIDTau { set; } |
296 | 296 | ||
297 | // Used for llSetHoverHeight and maybe vehicle height | 297 | // Used for llSetHoverHeight and maybe vehicle height |
@@ -545,7 +545,13 @@ namespace OpenSim.Region.Physics.Manager | |||
545 | } | 545 | } |
546 | 546 | ||
547 | public override Vector3 PIDTarget { set { return; } } | 547 | public override Vector3 PIDTarget { set { return; } } |
548 | public override bool PIDActive { set { return; } } | 548 | |
549 | public override bool PIDActive | ||
550 | { | ||
551 | get { return false; } | ||
552 | set { return; } | ||
553 | } | ||
554 | |||
549 | public override float PIDTau { set { return; } } | 555 | public override float PIDTau { set { return; } } |
550 | 556 | ||
551 | public override float PIDHoverHeight { set { return; } } | 557 | public override float PIDHoverHeight { set { return; } } |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 8f37b79..67503df 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -1245,7 +1245,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | public override Vector3 PIDTarget { set { return; } } | 1247 | public override Vector3 PIDTarget { set { return; } } |
1248 | public override bool PIDActive { set { return; } } | 1248 | public override bool PIDActive |
1249 | { | ||
1250 | get { return false; } | ||
1251 | set { return; } | ||
1252 | } | ||
1249 | public override float PIDTau { set { return; } } | 1253 | public override float PIDTau { set { return; } } |
1250 | 1254 | ||
1251 | public override float PIDHoverHeight { set { return; } } | 1255 | public override float PIDHoverHeight { set { return; } } |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 13c69d6..e347fdc 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -114,7 +114,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
114 | private float m_PIDTau; | 114 | private float m_PIDTau; |
115 | private float PID_D = 35f; | 115 | private float PID_D = 35f; |
116 | private float PID_G = 25f; | 116 | private float PID_G = 25f; |
117 | private bool m_usePID; | ||
118 | 117 | ||
119 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), | 118 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), |
120 | // and are for non-VEHICLES only. | 119 | // and are for non-VEHICLES only. |
@@ -1723,7 +1722,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1723 | // gravityz multiplier = 1 - m_buoyancy | 1722 | // gravityz multiplier = 1 - m_buoyancy |
1724 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; | 1723 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; |
1725 | 1724 | ||
1726 | if (m_usePID) | 1725 | if (PIDActive) |
1727 | { | 1726 | { |
1728 | //Console.WriteLine("PID " + Name); | 1727 | //Console.WriteLine("PID " + Name); |
1729 | // KF - this is for object move? eg. llSetPos() ? | 1728 | // KF - this is for object move? eg. llSetPos() ? |
@@ -1792,10 +1791,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
1792 | 1791 | ||
1793 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); | 1792 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); |
1794 | } | 1793 | } |
1795 | } // end if (m_usePID) | 1794 | } // end if (PIDActive) |
1796 | 1795 | ||
1797 | // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller | 1796 | // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller |
1798 | if (m_useHoverPID && !m_usePID) | 1797 | if (m_useHoverPID && !PIDActive) |
1799 | { | 1798 | { |
1800 | //Console.WriteLine("Hover " + Name); | 1799 | //Console.WriteLine("Hover " + Name); |
1801 | 1800 | ||
@@ -2866,7 +2865,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2866 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. | 2865 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. |
2867 | // 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 | 2866 | // 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 |
2868 | // adding these logical exclusion situations to maintain this where I think it was intended to be. | 2867 | // adding these logical exclusion situations to maintain this where I think it was intended to be. |
2869 | if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) | 2868 | if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) |
2870 | { | 2869 | { |
2871 | m_minvelocity = 0.5f; | 2870 | m_minvelocity = 0.5f; |
2872 | } | 2871 | } |
@@ -2947,7 +2946,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2947 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); | 2946 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); |
2948 | } | 2947 | } |
2949 | } | 2948 | } |
2950 | public override bool PIDActive { set { m_usePID = value; } } | 2949 | public override bool PIDActive { get; set; } |
2951 | public override float PIDTau { set { m_PIDTau = value; } } | 2950 | public override float PIDTau { set { m_PIDTau = value; } } |
2952 | 2951 | ||
2953 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } | 2952 | 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 ae534ea..40ab984 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | |||
@@ -273,9 +273,10 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
273 | set { return; } | 273 | set { return; } |
274 | } | 274 | } |
275 | 275 | ||
276 | public override bool PIDActive | 276 | public override bool PIDActive |
277 | { | 277 | { |
278 | set { return; } | 278 | get { return false; } |
279 | set { return; } | ||
279 | } | 280 | } |
280 | 281 | ||
281 | public override float PIDTau | 282 | public override float PIDTau |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index e4fd7eb..7c1e915 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs | |||
@@ -270,6 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
270 | 270 | ||
271 | public override bool PIDActive | 271 | public override bool PIDActive |
272 | { | 272 | { |
273 | get { return false; } | ||
273 | set { return; } | 274 | set { return; } |
274 | } | 275 | } |
275 | 276 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 7d21a4b..ca81af1 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 | |||
1430 | return false; | 1430 | return false; |
1431 | } | 1431 | } |
1432 | } | 1432 | } |
1433 | |||
1434 | public static bool operator true(key k) | ||
1435 | { | ||
1436 | return (Boolean)k; | ||
1437 | } | ||
1438 | |||
1439 | public static bool operator false(key k) | ||
1440 | { | ||
1441 | return !(Boolean)k; | ||
1442 | } | ||
1433 | 1443 | ||
1434 | static public implicit operator key(string s) | 1444 | static public implicit operator key(string s) |
1435 | { | 1445 | { |