diff options
author | MW | 2007-04-25 13:47:32 +0000 |
---|---|---|
committer | MW | 2007-04-25 13:47:32 +0000 |
commit | 68b33294b1f5f4564252d8b04e69f07b3e326a84 (patch) | |
tree | 99205b020cf17cfdc74e7c59943b808f38b7914d | |
parent | Small clean up of files and directories (diff) | |
download | opensim-SC-68b33294b1f5f4564252d8b04e69f07b3e326a84.zip opensim-SC-68b33294b1f5f4564252d8b04e69f07b3e326a84.tar.gz opensim-SC-68b33294b1f5f4564252d8b04e69f07b3e326a84.tar.bz2 opensim-SC-68b33294b1f5f4564252d8b04e69f07b3e326a84.tar.xz |
Can now use the xml config file for setting up things like sandbox mode, login server, physics engine etc. To use this mode add just -configfile to the startup line (instead of the -sandbox etc)
A example of what to add to the xml is: SandBox="true" LoginServer="true" UserAccounts="false" LocalAssets="false" PhysicsEngine="basicphysics" (add those to config node in simconfig.xml).
The current options for PhysicsEngine are : basicphysics, RealPhysX, OpenDynamicsEngine.
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 93 | ||||
-rw-r--r-- | OpenSim/Application.cs | 7 |
2 files changed, 97 insertions, 3 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index e3e9b98..dc6a363 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -86,12 +86,13 @@ namespace OpenSim | |||
86 | public OpenGridProtocolServer OGSServer; | 86 | public OpenGridProtocolServer OGSServer; |
87 | public bool user_accounts = false; | 87 | public bool user_accounts = false; |
88 | public bool gridLocalAsset = false; | 88 | public bool gridLocalAsset = false; |
89 | 89 | private bool configFileSetup = false; | |
90 | 90 | ||
91 | protected ConsoleBase m_console; | 91 | protected ConsoleBase m_console; |
92 | 92 | ||
93 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine) | 93 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile) |
94 | { | 94 | { |
95 | this.configFileSetup = useConfigFile; | ||
95 | m_sandbox = sandBoxMode; | 96 | m_sandbox = sandBoxMode; |
96 | m_loginserver = startLoginServer; | 97 | m_loginserver = startLoginServer; |
97 | m_physicsEngine = physicsEngine; | 98 | m_physicsEngine = physicsEngine; |
@@ -115,6 +116,10 @@ namespace OpenSim | |||
115 | { | 116 | { |
116 | Console.WriteLine(e.Message); | 117 | Console.WriteLine(e.Message); |
117 | } | 118 | } |
119 | if (this.configFileSetup) | ||
120 | { | ||
121 | this.SetupFromConfigFile(this.localConfig); | ||
122 | } | ||
118 | m_console.WriteLine("Main.cs:Startup() - Loading configuration"); | 123 | m_console.WriteLine("Main.cs:Startup() - Loading configuration"); |
119 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); | 124 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); |
120 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change | 125 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change |
@@ -313,6 +318,90 @@ namespace OpenSim | |||
313 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | 318 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); |
314 | } | 319 | } |
315 | 320 | ||
321 | private void SetupFromConfigFile(IGenericConfig configData) | ||
322 | { | ||
323 | try | ||
324 | { | ||
325 | // SandBoxMode | ||
326 | string attri = ""; | ||
327 | attri = configData.GetAttribute("SandBox"); | ||
328 | if (attri == "") | ||
329 | { | ||
330 | this.m_sandbox = false; | ||
331 | configData.SetAttribute("SandBox", "false"); | ||
332 | } | ||
333 | else | ||
334 | { | ||
335 | this.m_sandbox = Convert.ToBoolean(attri); | ||
336 | } | ||
337 | |||
338 | // LoginServer | ||
339 | attri = ""; | ||
340 | attri = configData.GetAttribute("LoginServer"); | ||
341 | if (attri == "") | ||
342 | { | ||
343 | this.m_loginserver = false; | ||
344 | configData.SetAttribute("LoginServer", "false"); | ||
345 | } | ||
346 | else | ||
347 | { | ||
348 | this.m_loginserver = Convert.ToBoolean(attri); | ||
349 | } | ||
350 | |||
351 | // Sandbox User accounts | ||
352 | attri = ""; | ||
353 | attri = configData.GetAttribute("UserAccount"); | ||
354 | if (attri == "") | ||
355 | { | ||
356 | this.user_accounts = false; | ||
357 | configData.SetAttribute("UserAccounts", "false"); | ||
358 | } | ||
359 | else | ||
360 | { | ||
361 | this.user_accounts = Convert.ToBoolean(attri); | ||
362 | } | ||
363 | |||
364 | // Grid mode hack to use local asset server | ||
365 | attri = ""; | ||
366 | attri = configData.GetAttribute("LocalAssets"); | ||
367 | if (attri == "") | ||
368 | { | ||
369 | this.gridLocalAsset = false; | ||
370 | configData.SetAttribute("LocalAssets", "false"); | ||
371 | } | ||
372 | else | ||
373 | { | ||
374 | this.gridLocalAsset = Convert.ToBoolean(attri); | ||
375 | } | ||
376 | |||
377 | // Grid mode hack to use local asset server | ||
378 | attri = ""; | ||
379 | attri = configData.GetAttribute("PhysicsEngine"); | ||
380 | if (attri == "") | ||
381 | { | ||
382 | this.m_physicsEngine = "basicphysics"; | ||
383 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
384 | } | ||
385 | else | ||
386 | { | ||
387 | this.m_physicsEngine = attri; | ||
388 | if ((attri == "RealPhysX") || (attri == "OpenDynamicsEngine")) | ||
389 | { | ||
390 | OpenSim.world.Avatar.PhysicsEngineFlying = true; | ||
391 | } | ||
392 | else | ||
393 | { | ||
394 | OpenSim.world.Avatar.PhysicsEngineFlying = false; | ||
395 | } | ||
396 | } | ||
397 | configData.Commit(); | ||
398 | } | ||
399 | catch (Exception e) | ||
400 | { | ||
401 | Console.WriteLine(e.Message); | ||
402 | } | ||
403 | } | ||
404 | |||
316 | private SimConfig LoadConfigDll(string dllName) | 405 | private SimConfig LoadConfigDll(string dllName) |
317 | { | 406 | { |
318 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 407 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); |
diff --git a/OpenSim/Application.cs b/OpenSim/Application.cs index 0e3d5a6..56fcf53 100644 --- a/OpenSim/Application.cs +++ b/OpenSim/Application.cs | |||
@@ -20,6 +20,7 @@ namespace OpenSim | |||
20 | bool allowFlying = false; | 20 | bool allowFlying = false; |
21 | bool userAccounts = false; | 21 | bool userAccounts = false; |
22 | bool gridLocalAsset = false; | 22 | bool gridLocalAsset = false; |
23 | bool useConfigFile = false; | ||
23 | 24 | ||
24 | for (int i = 0; i < args.Length; i++) | 25 | for (int i = 0; i < args.Length; i++) |
25 | { | 26 | { |
@@ -50,9 +51,13 @@ namespace OpenSim | |||
50 | { | 51 | { |
51 | gridLocalAsset = true; | 52 | gridLocalAsset = true; |
52 | } | 53 | } |
54 | if (args[i] == "-configfile") | ||
55 | { | ||
56 | useConfigFile = true; | ||
57 | } | ||
53 | } | 58 | } |
54 | 59 | ||
55 | OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine ); | 60 | OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine, useConfigFile); |
56 | // OpenSimRoot.Instance.Application = sim; | 61 | // OpenSimRoot.Instance.Application = sim; |
57 | sim.m_sandbox = sandBoxMode; | 62 | sim.m_sandbox = sandBoxMode; |
58 | sim.user_accounts = userAccounts; | 63 | sim.user_accounts = userAccounts; |