diff options
author | Dev Random | 2015-05-07 13:25:36 -0400 |
---|---|---|
committer | Michael Cerquoni | 2015-05-07 14:07:50 -0400 |
commit | a9dd3028b94b35fb9c504b05466522cd2f9be306 (patch) | |
tree | f9fa49f5887654feec670d1633b265d8a0866c56 /OpenSim | |
parent | 'terrain modify' command for area-of-effect operations (diff) | |
download | opensim-SC_OLD-a9dd3028b94b35fb9c504b05466522cd2f9be306.zip opensim-SC_OLD-a9dd3028b94b35fb9c504b05466522cd2f9be306.tar.gz opensim-SC_OLD-a9dd3028b94b35fb9c504b05466522cd2f9be306.tar.bz2 opensim-SC_OLD-a9dd3028b94b35fb9c504b05466522cd2f9be306.tar.xz |
Add 'terrain modify noise' and code cleanup
Signed-off-by: Michael Cerquoni <nebadon2025@gmail.com>
Diffstat (limited to 'OpenSim')
5 files changed, 113 insertions, 291 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Features/RectangleFeature.cs b/OpenSim/Region/CoreModules/World/Terrain/Features/RectangleFeature.cs deleted file mode 100644 index 33c3fbe..0000000 --- a/OpenSim/Region/CoreModules/World/Terrain/Features/RectangleFeature.cs +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
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/Modifiers/NoiseModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/NoiseModifier.cs new file mode 100644 index 0000000..b31bab1 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/NoiseModifier.cs | |||
@@ -0,0 +1,110 @@ | |||
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 OpenSim.Region.CoreModules.World.Terrain; | ||
29 | using OpenSim.Region.Framework.Interfaces; | ||
30 | using OpenSim.Region.Framework.Scenes; | ||
31 | |||
32 | namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers | ||
33 | { | ||
34 | public class NoiseModifier : TerrainModifier | ||
35 | { | ||
36 | public NoiseModifier(ITerrainModule module) : base(module) | ||
37 | { | ||
38 | } | ||
39 | |||
40 | public override string ModifyTerrain(ITerrainChannel map, string[] args) | ||
41 | { | ||
42 | string val; | ||
43 | string result; | ||
44 | if (args.Length < 3) | ||
45 | { | ||
46 | result = "Usage: " + GetUsage(); | ||
47 | } | ||
48 | else | ||
49 | { | ||
50 | TerrainModifierData data; | ||
51 | result = this.parseParameters(args, out data); | ||
52 | |||
53 | // Context-specific validation | ||
54 | if (result == String.Empty) | ||
55 | { | ||
56 | if (data.bevel == "taper") | ||
57 | { | ||
58 | if (data.bevelevation < 0.0 || data.bevelevation > 1.0) | ||
59 | { | ||
60 | result = String.Format("Taper must be 0.0 to 1.0: {0}", data.bevelevation); | ||
61 | } | ||
62 | } | ||
63 | else | ||
64 | { | ||
65 | data.bevelevation = 1.0f; | ||
66 | } | ||
67 | |||
68 | if (data.elevation < 0.0 || data.elevation > 1.0) | ||
69 | { | ||
70 | result = String.Format("Noise strength must be 0.0 to 1.0: {0}", data.elevation); | ||
71 | } | ||
72 | |||
73 | if (data.shape == String.Empty) | ||
74 | { | ||
75 | data.shape = "rectangle"; | ||
76 | data.x0 = 0; | ||
77 | data.y0 = 0; | ||
78 | data.dx = map.Width; | ||
79 | data.dy = map.Height; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | // if it's all good, then do the work | ||
84 | if (result == String.Empty) | ||
85 | { | ||
86 | this.applyModification(map, data); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | return result; | ||
91 | } | ||
92 | |||
93 | public override string GetUsage() | ||
94 | { | ||
95 | string val = "noise <delta> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<delta2>]" | ||
96 | + "\nAdds noise to all points within the specified range."; | ||
97 | return val; | ||
98 | } | ||
99 | |||
100 | public override double operate(double[,] map, TerrainModifierData data, int x, int y) | ||
101 | { | ||
102 | double factor = this.computeBevel(data, x, y); | ||
103 | double noise = TerrainUtil.PerlinNoise2D((double)x / map.GetLength(0), (double)y / map.GetLength(1), 8, 1.0); | ||
104 | return map[x, y] + (data.elevation - (data.elevation - data.bevelevation) * factor) * (noise - .5); | ||
105 | } | ||
106 | |||
107 | } | ||
108 | |||
109 | } | ||
110 | |||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Modifiers/SmoothModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/SmoothModifier.cs index 1731cd8..72b172c 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Modifiers/SmoothModifier.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/SmoothModifier.cs | |||
@@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers | |||
56 | { | 56 | { |
57 | if (data.bevelevation < 0.01 || data.bevelevation > 0.99) | 57 | if (data.bevelevation < 0.01 || data.bevelevation > 0.99) |
58 | { | 58 | { |
59 | result = String.Format("Taper must be 0.01 to 0.99 {0}", data.bevelevation); | 59 | result = String.Format("Taper must be 0.01 to 0.99: {0}", data.bevelevation); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | else | 62 | else |
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers | |||
66 | 66 | ||
67 | if (data.elevation < 0.0 || data.elevation > 1.0) | 67 | if (data.elevation < 0.0 || data.elevation > 1.0) |
68 | { | 68 | { |
69 | result = String.Format("Scaling factor must be 0.0 to 1.0: {0}", data.elevation); | 69 | result = String.Format("Smoothing strength must be 0.0 to 1.0: {0}", data.elevation); |
70 | } | 70 | } |
71 | 71 | ||
72 | if (data.shape == String.Empty) | 72 | if (data.shape == String.Empty) |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs deleted file mode 100644 index 701a729..0000000 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainFeature.cs +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
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 02f21b9..05c5fca 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -41,7 +41,6 @@ using OpenSim.Framework; | |||
41 | using OpenSim.Framework.Console; | 41 | using OpenSim.Framework.Console; |
42 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 42 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
43 | using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; | 43 | using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; |
44 | using OpenSim.Region.CoreModules.World.Terrain.Features; | ||
45 | using OpenSim.Region.CoreModules.World.Terrain.Modifiers; | 44 | using OpenSim.Region.CoreModules.World.Terrain.Modifiers; |
46 | using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes; | 45 | using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes; |
47 | using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; | 46 | using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; |
@@ -75,14 +74,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
75 | 74 | ||
76 | #endregion | 75 | #endregion |
77 | 76 | ||
78 | /// <summary> | ||
79 | /// Terrain Features | ||
80 | /// </summary> | ||
81 | public enum TerrainFeatures: byte | ||
82 | { | ||
83 | Rectangle = 1, | ||
84 | } | ||
85 | |||
86 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
87 | 78 | ||
88 | #pragma warning disable 414 | 79 | #pragma warning disable 414 |
@@ -96,8 +87,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
96 | private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = | 87 | private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = |
97 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); | 88 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); |
98 | private Dictionary<string, ITerrainEffect> m_plugineffects; | 89 | private Dictionary<string, ITerrainEffect> m_plugineffects; |
99 | private Dictionary<string, ITerrainFeature> m_featureEffects = | ||
100 | new Dictionary<string, ITerrainFeature>(); | ||
101 | private Dictionary<string, ITerrainModifier> m_modifyOperations = | 90 | private Dictionary<string, ITerrainModifier> m_modifyOperations = |
102 | new Dictionary<string, ITerrainModifier>(); | 91 | new Dictionary<string, ITerrainModifier>(); |
103 | private ITerrainChannel m_channel; | 92 | private ITerrainChannel m_channel; |
@@ -657,9 +646,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
657 | m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea(); | 646 | m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea(); |
658 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_revert); | 647 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_revert); |
659 | 648 | ||
660 | // Terrain Feature effects | ||
661 | m_featureEffects["rectangle"] = new RectangleFeature(this); | ||
662 | |||
663 | // Terrain Modifier operations | 649 | // Terrain Modifier operations |
664 | m_modifyOperations["min"] = new MinModifier(this); | 650 | m_modifyOperations["min"] = new MinModifier(this); |
665 | m_modifyOperations["max"] = new MaxModifier(this); | 651 | m_modifyOperations["max"] = new MaxModifier(this); |
@@ -667,6 +653,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
667 | m_modifyOperations["lower"] = new LowerModifier(this); | 653 | m_modifyOperations["lower"] = new LowerModifier(this); |
668 | m_modifyOperations["fill"] = new FillModifier(this); | 654 | m_modifyOperations["fill"] = new FillModifier(this); |
669 | m_modifyOperations["smooth"] = new SmoothModifier(this); | 655 | m_modifyOperations["smooth"] = new SmoothModifier(this); |
656 | m_modifyOperations["noise"] = new NoiseModifier(this); | ||
670 | 657 | ||
671 | // Filesystem load/save loaders | 658 | // Filesystem load/save loaders |
672 | m_loaders[".r32"] = new RAW32(); | 659 | m_loaders[".r32"] = new RAW32(); |
@@ -1671,9 +1658,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1671 | // Add this to our scene so scripts can call these functions | 1658 | // Add this to our scene so scripts can call these functions |
1672 | m_scene.RegisterModuleCommander(m_commander); | 1659 | m_scene.RegisterModuleCommander(m_commander); |
1673 | 1660 | ||
1674 | // Add Feature command to Scene, since Command object requires fixed-length arglists | ||
1675 | m_scene.AddCommand("Terrain", this, "terrain feature", | ||
1676 | "terrain feature <type> <parameters...>", "Constructs a feature of the requested type.", FeatureCommand); | ||
1677 | // Add Modify command to Scene, since Command object requires fixed-length arglists | 1661 | // Add Modify command to Scene, since Command object requires fixed-length arglists |
1678 | m_scene.AddCommand("Terrain", this, "terrain modify", | 1662 | m_scene.AddCommand("Terrain", this, "terrain modify", |
1679 | "terrain modify <operation> <value> [<area>] [<taper>]", | 1663 | "terrain modify <operation> <value> [<area>] [<taper>]", |
@@ -1689,40 +1673,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1689 | 1673 | ||
1690 | } | 1674 | } |
1691 | 1675 | ||
1692 | public void FeatureCommand(string module, string[] cmd) | ||
1693 | { | ||
1694 | string result; | ||
1695 | if (cmd.Length > 2) | ||
1696 | { | ||
1697 | string featureType = cmd[2]; | ||
1698 | |||
1699 | ITerrainFeature feature; | ||
1700 | if (!m_featureEffects.TryGetValue(featureType, out feature)) | ||
1701 | { | ||
1702 | result = String.Format("Terrain Feature \"{0}\" not found.", featureType); | ||
1703 | } | ||
1704 | else if ((cmd.Length > 3) && (cmd[3] == "usage")) | ||
1705 | { | ||
1706 | result = "Usage: " + feature.GetUsage(); | ||
1707 | } | ||
1708 | else | ||
1709 | { | ||
1710 | result = feature.CreateFeature(m_channel, cmd); | ||
1711 | } | ||
1712 | |||
1713 | if (result == String.Empty) | ||
1714 | { | ||
1715 | result = "Created Feature"; | ||
1716 | m_log.DebugFormat("Created terrain feature {0}", featureType); | ||
1717 | } | ||
1718 | } | ||
1719 | else | ||
1720 | { | ||
1721 | result = "Usage: <feature-name> <arg1> <arg2>..."; | ||
1722 | } | ||
1723 | MainConsole.Instance.Output(result); | ||
1724 | } | ||
1725 | |||
1726 | public void ModifyCommand(string module, string[] cmd) | 1676 | public void ModifyCommand(string module, string[] cmd) |
1727 | { | 1677 | { |
1728 | string result; | 1678 | string result; |