From 918c46688189cc0e6f237f9f2d2ee8892506d56d Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 6 Apr 2009 04:17:55 +0000 Subject: * Adds AutoOAR module, this will automatically OAR your regions every 20 minutes to a directory called "autooar", if enabled. Default disabled. Use [autooar] Enabled=true in OpenSim.ini to enable. * Adds some MRM XMLDOC --- .../OptionalModules/Autooar/AutooarModule.cs | 72 ++++++++++++++++++++++ .../Scripting/Minimodule/Object/IObjectPhysics.cs | 5 ++ 2 files changed, 77 insertions(+) create mode 100644 OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs diff --git a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs new file mode 100644 index 0000000..6c10928 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Timers; +using Nini.Config; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.OptionalModules.Autooar +{ + public class AutooarModule : IRegionModule + { + private readonly Timer m_timer = new Timer(60000*20); + private readonly List m_scenes = new List(); + private IConfigSource config; + private bool m_enabled = false; + + + public void Initialise(Scene scene, IConfigSource source) + { + m_scenes.Add(scene); + config = source; + } + + public void PostInitialise() + { + if(config.Configs["autooar"] != null) + { + m_enabled = config.Configs["autooar"].GetBoolean("Enabled", m_enabled); + } + + if(m_enabled) + { + m_timer.Elapsed += m_timer_Elapsed; + m_timer.AutoReset = true; + m_timer.Start(); + } + } + + void m_timer_Elapsed(object sender, ElapsedEventArgs e) + { + if (!Directory.Exists("autooars")) + Directory.CreateDirectory("autooars"); + + foreach (Scene scene in m_scenes) + { + IRegionArchiverModule archiver = scene.RequestModuleInterface(); + + archiver.ArchiveRegion(Path.Combine("autooars", + scene.RegionInfo.RegionName + "_" + scene.RegionInfo.RegionLocX + + "x" + scene.RegionInfo.RegionLocY + ".oar.tar.gz")); + } + } + + public void Close() + { + if (m_timer.Enabled) + m_timer.Stop(); + } + + public string Name + { + get { return "Automatic OAR Module"; } + } + + public bool IsSharedModule + { + get { return true; } + } + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs index 9035db9..6ca4e5f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs @@ -5,6 +5,11 @@ using OpenMetaverse; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object { + /// + /// This implements an interface similar to that provided by physics engines to OpenSim internally. + /// Eg, PhysicsActor. It is capable of setting and getting properties related to the current + /// physics scene representation of this object. + /// public interface IObjectPhysics { bool Enabled { get; set; } -- cgit v1.1