From 68b33294b1f5f4564252d8b04e69f07b3e326a84 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 25 Apr 2007 13:47:32 +0000 Subject: 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. --- OpenSim.RegionServer/OpenSimMain.cs | 93 ++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 2 deletions(-) (limited to 'OpenSim.RegionServer') 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 public OpenGridProtocolServer OGSServer; public bool user_accounts = false; public bool gridLocalAsset = false; - + private bool configFileSetup = false; protected ConsoleBase m_console; - public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine) + public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile) { + this.configFileSetup = useConfigFile; m_sandbox = sandBoxMode; m_loginserver = startLoginServer; m_physicsEngine = physicsEngine; @@ -115,6 +116,10 @@ namespace OpenSim { Console.WriteLine(e.Message); } + if (this.configFileSetup) + { + this.SetupFromConfigFile(this.localConfig); + } m_console.WriteLine("Main.cs:Startup() - Loading configuration"); this.regionData.InitConfig(this.m_sandbox, this.localConfig); 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 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); } + private void SetupFromConfigFile(IGenericConfig configData) + { + try + { + // SandBoxMode + string attri = ""; + attri = configData.GetAttribute("SandBox"); + if (attri == "") + { + this.m_sandbox = false; + configData.SetAttribute("SandBox", "false"); + } + else + { + this.m_sandbox = Convert.ToBoolean(attri); + } + + // LoginServer + attri = ""; + attri = configData.GetAttribute("LoginServer"); + if (attri == "") + { + this.m_loginserver = false; + configData.SetAttribute("LoginServer", "false"); + } + else + { + this.m_loginserver = Convert.ToBoolean(attri); + } + + // Sandbox User accounts + attri = ""; + attri = configData.GetAttribute("UserAccount"); + if (attri == "") + { + this.user_accounts = false; + configData.SetAttribute("UserAccounts", "false"); + } + else + { + this.user_accounts = Convert.ToBoolean(attri); + } + + // Grid mode hack to use local asset server + attri = ""; + attri = configData.GetAttribute("LocalAssets"); + if (attri == "") + { + this.gridLocalAsset = false; + configData.SetAttribute("LocalAssets", "false"); + } + else + { + this.gridLocalAsset = Convert.ToBoolean(attri); + } + + // Grid mode hack to use local asset server + attri = ""; + attri = configData.GetAttribute("PhysicsEngine"); + if (attri == "") + { + this.m_physicsEngine = "basicphysics"; + configData.SetAttribute("PhysicsEngine", "basicphysics"); + } + else + { + this.m_physicsEngine = attri; + if ((attri == "RealPhysX") || (attri == "OpenDynamicsEngine")) + { + OpenSim.world.Avatar.PhysicsEngineFlying = true; + } + else + { + OpenSim.world.Avatar.PhysicsEngineFlying = false; + } + } + configData.Commit(); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + private SimConfig LoadConfigDll(string dllName) { Assembly pluginAssembly = Assembly.LoadFrom(dllName); -- cgit v1.1