diff options
author | Justin Clark-Casey (justincc) | 2011-02-11 23:32:38 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-02-11 23:32:38 +0000 |
commit | 26727ee044f0be22abf070c7d320bce2da2c0d9a (patch) | |
tree | be16ad01ed868b3b48d4c5c0c16c5fde060d8ecc /OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs | |
parent | In SQLiteSimulationData.RemoveLandObject(), don't manually remove the row fro... (diff) | |
download | opensim-SC_OLD-26727ee044f0be22abf070c7d320bce2da2c0d9a.zip opensim-SC_OLD-26727ee044f0be22abf070c7d320bce2da2c0d9a.tar.gz opensim-SC_OLD-26727ee044f0be22abf070c7d320bce2da2c0d9a.tar.bz2 opensim-SC_OLD-26727ee044f0be22abf070c7d320bce2da2c0d9a.tar.xz |
refactor: split out estate management commands into separate class
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs new file mode 100644 index 0000000..14f5b1e --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs | |||
@@ -0,0 +1,156 @@ | |||
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 System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Security; | ||
33 | using log4net; | ||
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | |||
40 | namespace OpenSim.Region.CoreModules.World.Estate | ||
41 | { | ||
42 | public class EstateManagementCommands | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | protected EstateManagementModule m_module; | ||
47 | |||
48 | public EstateManagementCommands(EstateManagementModule module) | ||
49 | { | ||
50 | m_module = module; | ||
51 | } | ||
52 | |||
53 | public void Initialise() | ||
54 | { | ||
55 | m_module.Scene.AddCommand(this, "set terrain texture", | ||
56 | "set terrain texture <number> <uuid> [<x>] [<y>]", | ||
57 | "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " + | ||
58 | "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + | ||
59 | " that coordinate.", | ||
60 | consoleSetTerrainTexture); | ||
61 | |||
62 | m_module.Scene.AddCommand(this, "set terrain heights", | ||
63 | "set terrain heights <corner> <min> <max> [<x>] [<y>]", | ||
64 | "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " + | ||
65 | "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + | ||
66 | " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", | ||
67 | consoleSetTerrainHeights); | ||
68 | } | ||
69 | |||
70 | protected void consoleSetTerrainTexture(string module, string[] args) | ||
71 | { | ||
72 | string num = args[3]; | ||
73 | string uuid = args[4]; | ||
74 | int x = (args.Length > 5 ? int.Parse(args[5]) : -1); | ||
75 | int y = (args.Length > 6 ? int.Parse(args[6]) : -1); | ||
76 | |||
77 | if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x) | ||
78 | { | ||
79 | if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y) | ||
80 | { | ||
81 | int corner = int.Parse(num); | ||
82 | UUID texture = UUID.Parse(uuid); | ||
83 | |||
84 | m_log.Debug("[ESTATEMODULE]: Setting terrain textures for " + m_module.Scene.RegionInfo.RegionName + | ||
85 | string.Format(" (C#{0} = {1})", corner, texture)); | ||
86 | |||
87 | switch (corner) | ||
88 | { | ||
89 | case 0: | ||
90 | m_module.Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; | ||
91 | break; | ||
92 | case 1: | ||
93 | m_module.Scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; | ||
94 | break; | ||
95 | case 2: | ||
96 | m_module.Scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; | ||
97 | break; | ||
98 | case 3: | ||
99 | m_module.Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; | ||
100 | break; | ||
101 | } | ||
102 | |||
103 | m_module.Scene.RegionInfo.RegionSettings.Save(); | ||
104 | m_module.TriggerRegionInfoChange(); | ||
105 | m_module.sendRegionInfoPacketToAll(); | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | |||
110 | protected void consoleSetTerrainHeights(string module, string[] args) | ||
111 | { | ||
112 | string num = args[3]; | ||
113 | string min = args[4]; | ||
114 | string max = args[5]; | ||
115 | int x = (args.Length > 6 ? int.Parse(args[6]) : -1); | ||
116 | int y = (args.Length > 7 ? int.Parse(args[7]) : -1); | ||
117 | |||
118 | if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x) | ||
119 | { | ||
120 | if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y) | ||
121 | { | ||
122 | int corner = int.Parse(num); | ||
123 | float lowValue = float.Parse(min, Culture.NumberFormatInfo); | ||
124 | float highValue = float.Parse(max, Culture.NumberFormatInfo); | ||
125 | |||
126 | m_log.Debug("[ESTATEMODULE]: Setting terrain heights " + m_module.Scene.RegionInfo.RegionName + | ||
127 | string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); | ||
128 | |||
129 | switch (corner) | ||
130 | { | ||
131 | case 0: | ||
132 | m_module.Scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; | ||
133 | m_module.Scene.RegionInfo.RegionSettings.Elevation2SW = highValue; | ||
134 | break; | ||
135 | case 1: | ||
136 | m_module.Scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; | ||
137 | m_module.Scene.RegionInfo.RegionSettings.Elevation2NW = highValue; | ||
138 | break; | ||
139 | case 2: | ||
140 | m_module.Scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; | ||
141 | m_module.Scene.RegionInfo.RegionSettings.Elevation2SE = highValue; | ||
142 | break; | ||
143 | case 3: | ||
144 | m_module.Scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; | ||
145 | m_module.Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; | ||
146 | break; | ||
147 | } | ||
148 | |||
149 | m_module.Scene.RegionInfo.RegionSettings.Save(); | ||
150 | m_module.TriggerRegionInfoChange(); | ||
151 | m_module.sendRegionHandshakeToAll(); | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | } | ||
156 | } \ No newline at end of file | ||