mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
This commit is contained in:
@@ -52,31 +52,44 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <summary>
|
||||
/// Archive the region to the given path
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// This method occurs asynchronously. If you want notification of when it has completed then subscribe to
|
||||
/// the EventManager.OnOarFileSaved event.
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="savePath"></param>
|
||||
/// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
|
||||
/// <param name="options">Options for the save</param>
|
||||
void ArchiveRegion(string savePath, Guid requestId, Dictionary<string, object> options);
|
||||
|
||||
/// <summary>
|
||||
/// Archive the region to a stream.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// This method occurs asynchronously. If you want notification of when it has completed then subscribe to
|
||||
/// the EventManager.OnOarFileSaved event.
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="saveStream"></param>
|
||||
/// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
|
||||
void ArchiveRegion(Stream saveStream, Guid requestId);
|
||||
|
||||
/// <summary>
|
||||
/// Archive the region to a stream.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method occurs asynchronously. If you want notification of when it has completed then subscribe to
|
||||
/// the EventManager.OnOarFileSaved event.
|
||||
/// </remarks>
|
||||
/// <param name="saveStream"></param>
|
||||
/// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
|
||||
/// <param name="options">Options for the save</param>
|
||||
void ArchiveRegion(Stream saveStream, Guid requestId, Dictionary<string, object> options);
|
||||
|
||||
/// <summary>
|
||||
/// Dearchive the given region archive. This replaces the existing scene.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// If you want notification of when it has completed then subscribe to the EventManager.OnOarFileLoaded event.
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="loadPath"></param>
|
||||
void DearchiveRegion(string loadPath);
|
||||
|
||||
|
||||
@@ -50,5 +50,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
void ResumeScript(UUID itemID);
|
||||
|
||||
ArrayList GetScriptErrors(UUID itemID);
|
||||
|
||||
void SaveAllState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +111,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
|
||||
|
||||
public delegate void SceneShuttingDownDelegate(Scene scene);
|
||||
|
||||
public event SceneShuttingDownDelegate OnSceneShuttingDown;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when an object is touched/grabbed.
|
||||
/// </summary>
|
||||
@@ -2193,5 +2197,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerSceneShuttingDown(Scene s)
|
||||
{
|
||||
SceneShuttingDownDelegate handler = OnSceneShuttingDown;
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (SceneShuttingDownDelegate d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(s);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private Timer m_mapGenerationTimer = new Timer();
|
||||
private bool m_generateMaptiles;
|
||||
private bool m_useBackup = true;
|
||||
|
||||
// private Dictionary<UUID, string[]> m_UserNamesCache = new Dictionary<UUID, string[]>();
|
||||
|
||||
@@ -459,6 +460,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
get { return m_sceneGraph; }
|
||||
}
|
||||
|
||||
public bool UseBackup
|
||||
{
|
||||
get { return m_useBackup; }
|
||||
}
|
||||
|
||||
// an instance to the physics plugin's Scene object.
|
||||
public PhysicsScene PhysicsScene
|
||||
{
|
||||
@@ -647,6 +653,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
IConfig startupConfig = m_config.Configs["Startup"];
|
||||
|
||||
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
|
||||
m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
|
||||
if (!m_useBackup)
|
||||
m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
|
||||
|
||||
//Animation states
|
||||
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
||||
@@ -1064,6 +1073,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
shuttingdown = true;
|
||||
|
||||
m_log.Debug("[SCENE]: Persisting changed objects");
|
||||
EventManager.TriggerSceneShuttingDown(this);
|
||||
|
||||
EntityBase[] entities = GetEntities();
|
||||
foreach (EntityBase entity in entities)
|
||||
{
|
||||
|
||||
@@ -1335,7 +1335,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
if (HasGroupChanged)
|
||||
if (m_scene.UseBackup && HasGroupChanged)
|
||||
{
|
||||
// don't backup while it's selected or you're asking for changes mid stream.
|
||||
if (isTimeToPersist() || forcedBackup)
|
||||
|
||||
@@ -144,11 +144,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public Vector3 StatusSandboxPos;
|
||||
|
||||
// TODO: This needs to be persisted in next XML version update!
|
||||
|
||||
public readonly int[] PayPrice = {-2,-2,-2,-2,-2};
|
||||
|
||||
|
||||
[XmlIgnore]
|
||||
public int[] PayPrice = {-2,-2,-2,-2,-2};
|
||||
|
||||
[XmlIgnore]
|
||||
public PhysicsActor PhysActor
|
||||
{
|
||||
get { return m_physActor; }
|
||||
|
||||
@@ -341,6 +341,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
|
||||
m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
|
||||
m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
|
||||
m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0);
|
||||
m_SOPXmlProcessors.Add("PayPrice1", ProcessPayPrice1);
|
||||
m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
|
||||
m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
|
||||
m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
|
||||
#endregion
|
||||
|
||||
#region TaskInventoryXmlProcessors initialization
|
||||
@@ -698,6 +703,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
{
|
||||
obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty));
|
||||
}
|
||||
|
||||
private static void ProcessPayPrice0(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessPayPrice1(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessPayPrice2(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessPayPrice3(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessPayPrice4(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TaskInventoryXmlProcessors
|
||||
@@ -1069,7 +1100,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
////////// Write /////////
|
||||
@@ -1175,6 +1205,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
|
||||
WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
|
||||
WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
|
||||
writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString());
|
||||
writer.WriteElementString("PayPrice1", sop.PayPrice[1].ToString());
|
||||
writer.WriteElementString("PayPrice2", sop.PayPrice[2].ToString());
|
||||
writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
|
||||
writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user