aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLDataStore.cs9
-rw-r--r--OpenSim/Framework/RegionSettings.cs201
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
3 files changed, 213 insertions, 5 deletions
diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs
index f1a252d..69f9a16 100644
--- a/OpenSim/Data/MySQL/MySQLDataStore.cs
+++ b/OpenSim/Data/MySQL/MySQLDataStore.cs
@@ -736,7 +736,14 @@ namespace OpenSim.Data.MySQL
736 string searchExp = "regionUUID = '" + regionUUID.ToString() + "'"; 736 string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
737 DataRow[] rawsettings = regionsettings.Select(searchExp); 737 DataRow[] rawsettings = regionsettings.Select(searchExp);
738 if(rawsettings.Length == 0) 738 if(rawsettings.Length == 0)
739 return null; 739 {
740 RegionSettings rs = new RegionSettings();
741 rs.RegionUUID = regionUUID;
742
743 StoreRegionSettings(rs);
744
745 return rs;
746 }
740 DataRow row = rawsettings[0]; 747 DataRow row = rawsettings[0];
741 748
742 return buildRegionSettings(row); 749 return buildRegionSettings(row);
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index ac853b5..79185e4 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -26,6 +26,8 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO;
30using System.Reflection;
29using libsecondlife; 31using libsecondlife;
30using log4net; 32using log4net;
31 33
@@ -33,6 +35,205 @@ namespace OpenSim.Framework
33{ 35{
34 public class RegionSettings 36 public class RegionSettings
35 { 37 {
38 private ConfigurationMember configMember;
39
40 public delegate void SaveDelegate(RegionSettings rs);
41
42 public event SaveDelegate OnSave;
43
44 public RegionSettings()
45 {
46 if (configMember == null)
47 {
48 configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", LoadConfigurationOptions, HandleIncomingConfiguration, true);
49 configMember.performConfigurationRetrieve();
50 }
51 }
52
53 public void LoadConfigurationOptions()
54 {
55 configMember.addConfigurationOption("region_flags",
56 ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
57 String.Empty, "336723974", true);
58
59 configMember.addConfigurationOption("max_agents",
60 ConfigurationOption.ConfigurationTypes.TYPE_INT32,
61 String.Empty, "40", true);
62
63 configMember.addConfigurationOption("object_bonus_factor",
64 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
65 String.Empty, "1.0", true);
66
67 configMember.addConfigurationOption("sim_access",
68 ConfigurationOption.ConfigurationTypes.TYPE_INT32,
69 String.Empty, "21", true);
70
71 configMember.addConfigurationOption("terrain_detail_0",
72 ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
73 String.Empty, "00000000-0000-0000-0000-000000000000",true);
74
75 configMember.addConfigurationOption("terrain_detail_1",
76 ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
77 String.Empty, "00000000-0000-0000-0000-000000000000",true);
78
79 configMember.addConfigurationOption("terrain_detail_2",
80 ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
81 String.Empty, "00000000-0000-0000-0000-000000000000",true);
82
83 configMember.addConfigurationOption("terrain_detail_3",
84 ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
85 String.Empty, "00000000-0000-0000-0000-000000000000",true);
86
87 configMember.addConfigurationOption("terrain_start_height_0",
88 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
89 String.Empty, "10.0", true);
90
91 configMember.addConfigurationOption("terrain_start_height_1",
92 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
93 String.Empty, "10.0", true);
94
95 configMember.addConfigurationOption("terrain_start_height_2",
96 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
97 String.Empty, "10.0", true);
98
99 configMember.addConfigurationOption("terrain_start_height_3",
100 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
101 String.Empty, "10.0", true);
102
103 configMember.addConfigurationOption("terrain_height_range_0",
104 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
105 String.Empty, "60.0", true);
106
107 configMember.addConfigurationOption("terrain_height_range_1",
108 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
109 String.Empty, "60.0", true);
110
111 configMember.addConfigurationOption("terrain_height_range_2",
112 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
113 String.Empty, "60.0", true);
114
115 configMember.addConfigurationOption("terrain_height_range_3",
116 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
117 String.Empty, "60.0", true);
118
119 configMember.addConfigurationOption("region_water_height",
120 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
121 String.Empty, "20.0", true);
122
123 configMember.addConfigurationOption("terrain_raise_limit",
124 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
125 String.Empty, "100.0", true);
126
127 configMember.addConfigurationOption("terrain_lower_limit",
128 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
129 String.Empty, "100.0", true);
130
131 configMember.addConfigurationOption("sun_hour",
132 ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
133 String.Empty, "0.0", true);
134 }
135
136 public bool HandleIncomingConfiguration(string key, object value)
137 {
138 switch(key)
139 {
140 case "region_flags":
141 Simulator.RegionFlags flags = (Simulator.RegionFlags)(uint)value;
142
143 m_BlockTerraform =
144 (flags & Simulator.RegionFlags.BlockTerraform) != 0;
145 m_BlockFly =
146 (flags & Simulator.RegionFlags.NoFly) != 0;
147 m_AllowDamage =
148 (flags & Simulator.RegionFlags.AllowDamage) != 0;
149 m_RestrictPushing =
150 (flags & Simulator.RegionFlags.RestrictPushObject) != 0;
151 m_AllowLandResell =
152 (flags & Simulator.RegionFlags.BlockLandResell) == 0;
153 m_AllowLandJoinDivide =
154 (flags & Simulator.RegionFlags.AllowParcelChanges) != 0;
155 m_BlockShowInSearch =
156 ((uint)flags & (1 << 29)) != 0;
157 m_DisableScripts =
158 (flags & Simulator.RegionFlags.SkipScripts) != 0;
159 m_DisableCollisions =
160 (flags & Simulator.RegionFlags.SkipCollisions) != 0;
161 m_DisablePhysics =
162 (flags & Simulator.RegionFlags.SkipPhysics) != 0;
163 m_FixedSun =
164 (flags & Simulator.RegionFlags.SunFixed) != 0;
165 break;
166 case "max_agents":
167 m_AgentLimit = (int)value;
168 break;
169 case "object_bonus_factor":
170 m_ObjectBonus = (double)value;
171 break;
172 case "sim_access":
173 int access = (int)value;
174 if(access <= 13)
175 m_Maturity = 0;
176 else
177 m_Maturity = 1;
178 break;
179 case "terrain_detail_0":
180 m_TerrainTexture1 = (LLUUID)value;
181 break;
182 case "terrain_detail_1":
183 m_TerrainTexture1 = (LLUUID)value;
184 break;
185 case "terrain_detail_2":
186 m_TerrainTexture1 = (LLUUID)value;
187 break;
188 case "terrain_detail_3":
189 m_TerrainTexture1 = (LLUUID)value;
190 break;
191 case "terrain_start_height_0":
192 m_Elevation1SW = (double)value;
193 break;
194 case "terrain_start_height_1":
195 m_Elevation1NW = (double)value;
196 break;
197 case "terrain_start_height_2":
198 m_Elevation1SE = (double)value;
199 break;
200 case "terrain_start_height_3":
201 m_Elevation1NE = (double)value;
202 break;
203 case "terrain_height_range_0":
204 m_Elevation2SW = (double)value;
205 break;
206 case "terrain_height_range_1":
207 m_Elevation2NW = (double)value;
208 break;
209 case "terrain_height_range_2":
210 m_Elevation2SE = (double)value;
211 break;
212 case "terrain_height_range_3":
213 m_Elevation2NE = (double)value;
214 break;
215 case "region_water_height":
216 m_WaterHeight = (double)value;
217 break;
218 case "terrain_raise_limit":
219 m_TerrainRaiseLimit = (double)value;
220 break;
221 case "terrain_lower_limit":
222 m_TerrainLowerLimit = (double)value;
223 break;
224 case "sun_hour":
225 m_SunPosition = (double)value;
226 break;
227 }
228
229 return true;
230 }
231
232 public void Save()
233 {
234 OnSave(this);
235 }
236
36 private LLUUID m_RegionUUID = LLUUID.Zero; 237 private LLUUID m_RegionUUID = LLUUID.Zero;
37 238
38 public LLUUID RegionUUID 239 public LLUUID RegionUUID
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 12c909b..12d7bcd 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -267,10 +267,10 @@ namespace OpenSim.Region.Environment.Scenes
267 // Load region settings 267 // Load region settings
268 // First try database 268 // First try database
269 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); 269 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
270 // If the database access failed, this will create defaults 270
271 m_regInfo.RegionSettings.RegionUUID = m_regInfo.RegionID; 271 // Hook up save event
272 // Finally, save the defaults 272 m_regInfo.RegionSettings.OnSave += m_storageManager.DataStore.StoreRegionSettings;
273 m_storageManager.DataStore.StoreRegionSettings(m_regInfo.RegionSettings); 273
274 274
275 //Bind Storage Manager functions to some land manager functions for this scene 275 //Bind Storage Manager functions to some land manager functions for this scene
276 EventManager.OnLandObjectAdded += 276 EventManager.OnLandObjectAdded +=