diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 57 |
1 files changed, 55 insertions, 2 deletions
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 | } |