* Implement saving of region settings in OAR files
* This means that you can now save terrain textures, water height, etc. * Estate settings are not supported * Older OAR files without these settings can still be loaded0.6.2-post-fixes
parent
c22edf01f7
commit
f0ea8eb534
|
@ -200,8 +200,6 @@ namespace OpenSim.Framework
|
|||
private EstateSettings m_estateSettings;
|
||||
private RegionSettings m_regionSettings;
|
||||
|
||||
// public bool m_allow_alternate_ports;
|
||||
|
||||
public UUID MasterAvatarAssignedUUID = UUID.Zero;
|
||||
public string MasterAvatarFirstName = String.Empty;
|
||||
public string MasterAvatarLastName = String.Empty;
|
||||
|
|
|
@ -39,6 +39,14 @@ namespace OpenSim.Framework
|
|||
|
||||
public event SaveDelegate OnSave;
|
||||
|
||||
/// <value>
|
||||
/// These appear to be terrain textures that are shipped with the client.
|
||||
/// </value>
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_1 = new UUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_2 = new UUID("abb783e6-3e93-26c0-248a-247666855da3");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_3 = new UUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
|
||||
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_4 = new UUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
|
||||
|
||||
public RegionSettings()
|
||||
{
|
||||
if (configMember == null)
|
||||
|
@ -74,19 +82,19 @@ namespace OpenSim.Framework
|
|||
|
||||
configMember.addConfigurationOption("terrain_base_0",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
|
||||
String.Empty, "b8d3965a-ad78-bf43-699b-bff8eca6c975",true);
|
||||
String.Empty, DEFAULT_TERRAIN_TEXTURE_1.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_base_1",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
|
||||
String.Empty, "abb783e6-3e93-26c0-248a-247666855da3",true);
|
||||
String.Empty, DEFAULT_TERRAIN_TEXTURE_2.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_base_2",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
|
||||
String.Empty, "179cdabd-398a-9b6b-1391-4dc333ba321f",true);
|
||||
String.Empty, DEFAULT_TERRAIN_TEXTURE_3.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_base_3",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
|
||||
String.Empty, "beb169c7-11ea-fff2-efe5-0f24dc881df2",true);
|
||||
String.Empty, DEFAULT_TERRAIN_TEXTURE_4.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("terrain_start_height_0",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
|
||||
|
@ -361,7 +369,7 @@ namespace OpenSim.Framework
|
|||
set
|
||||
{
|
||||
if (value == UUID.Zero)
|
||||
m_TerrainTexture1 = new UUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
||||
m_TerrainTexture1 = DEFAULT_TERRAIN_TEXTURE_1;
|
||||
else
|
||||
m_TerrainTexture1 = value;
|
||||
}
|
||||
|
@ -375,7 +383,7 @@ namespace OpenSim.Framework
|
|||
set
|
||||
{
|
||||
if (value == UUID.Zero)
|
||||
m_TerrainTexture2 = new UUID("abb783e6-3e93-26c0-248a-247666855da3");
|
||||
m_TerrainTexture2 = DEFAULT_TERRAIN_TEXTURE_2;
|
||||
else
|
||||
m_TerrainTexture2 = value;
|
||||
}
|
||||
|
@ -389,7 +397,7 @@ namespace OpenSim.Framework
|
|||
set
|
||||
{
|
||||
if (value == UUID.Zero)
|
||||
m_TerrainTexture3 = new UUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
|
||||
m_TerrainTexture3 = DEFAULT_TERRAIN_TEXTURE_3;
|
||||
else
|
||||
m_TerrainTexture3 = value;
|
||||
}
|
||||
|
@ -403,7 +411,7 @@ namespace OpenSim.Framework
|
|||
set
|
||||
{
|
||||
if (value == UUID.Zero)
|
||||
m_TerrainTexture4 = new UUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
|
||||
m_TerrainTexture4 = DEFAULT_TERRAIN_TEXTURE_4;
|
||||
else
|
||||
m_TerrainTexture4 = value;
|
||||
}
|
||||
|
|
|
@ -35,5 +35,10 @@ namespace OpenSim.Region.Environment.Interfaces
|
|||
{
|
||||
uint GetRegionFlags();
|
||||
bool IsManager(UUID avatarID);
|
||||
|
||||
/// <summary>
|
||||
/// Tell all clients about the current state of the region (terrain textures, water height, etc.)
|
||||
/// </summary>
|
||||
void sendRegionHandshakeToAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
/// </summary>
|
||||
public static readonly string TERRAINS_PATH = "terrains/";
|
||||
|
||||
/// <summary>
|
||||
/// Path for region settings.
|
||||
/// </summary>
|
||||
public static readonly string SETTINGS_PATH = "settings/";
|
||||
|
||||
/// <summary>
|
||||
/// The character the separates the uuid from extension information in an archived asset filename
|
||||
/// </summary>
|
||||
|
|
|
@ -68,6 +68,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
}
|
||||
|
||||
private void DearchiveRegion()
|
||||
{
|
||||
// The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions
|
||||
DearchiveRegion0DotStar();
|
||||
}
|
||||
|
||||
private void DearchiveRegion0DotStar()
|
||||
{
|
||||
TarArchiveReader archive
|
||||
= new TarArchiveReader(
|
||||
|
@ -107,6 +113,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
{
|
||||
LoadTerrain(filePath, data);
|
||||
}
|
||||
else if (filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
|
||||
{
|
||||
LoadRegionSettings(filePath, data);
|
||||
}
|
||||
}
|
||||
|
||||
//m_log.Debug("[ARCHIVER]: Reached end of archive");
|
||||
|
@ -268,6 +278,68 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load region settings data
|
||||
/// </summary>
|
||||
/// <param name="settingsPath"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>
|
||||
/// true if settings were loaded successfully, false otherwise
|
||||
/// </returns>
|
||||
private bool LoadRegionSettings(string settingsPath, byte[] data)
|
||||
{
|
||||
RegionSettings loadedRegionSettings;
|
||||
|
||||
try
|
||||
{
|
||||
loadedRegionSettings = RegionSettingsSerializer.Deserialize(data);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}",
|
||||
settingsPath, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
|
||||
|
||||
currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit;
|
||||
currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage;
|
||||
currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide;
|
||||
currentRegionSettings.AllowLandResell = loadedRegionSettings.AllowLandResell;
|
||||
currentRegionSettings.BlockFly = loadedRegionSettings.BlockFly;
|
||||
currentRegionSettings.BlockShowInSearch = loadedRegionSettings.BlockShowInSearch;
|
||||
currentRegionSettings.BlockTerraform = loadedRegionSettings.BlockTerraform;
|
||||
currentRegionSettings.DisableCollisions = loadedRegionSettings.DisableCollisions;
|
||||
currentRegionSettings.DisablePhysics = loadedRegionSettings.DisablePhysics;
|
||||
currentRegionSettings.DisableScripts = loadedRegionSettings.DisableScripts;
|
||||
currentRegionSettings.Elevation1NE = loadedRegionSettings.Elevation1NE;
|
||||
currentRegionSettings.Elevation1NW = loadedRegionSettings.Elevation1NW;
|
||||
currentRegionSettings.Elevation1SE = loadedRegionSettings.Elevation1SE;
|
||||
currentRegionSettings.Elevation1SW = loadedRegionSettings.Elevation1SW;
|
||||
currentRegionSettings.Elevation2NE = loadedRegionSettings.Elevation2NE;
|
||||
currentRegionSettings.Elevation2NW = loadedRegionSettings.Elevation2NW;
|
||||
currentRegionSettings.Elevation2SE = loadedRegionSettings.Elevation2SE;
|
||||
currentRegionSettings.Elevation2SW = loadedRegionSettings.Elevation2SW;
|
||||
currentRegionSettings.FixedSun = loadedRegionSettings.FixedSun;
|
||||
currentRegionSettings.ObjectBonus = loadedRegionSettings.ObjectBonus;
|
||||
currentRegionSettings.RestrictPushing = loadedRegionSettings.RestrictPushing;
|
||||
currentRegionSettings.TerrainLowerLimit = loadedRegionSettings.TerrainLowerLimit;
|
||||
currentRegionSettings.TerrainRaiseLimit = loadedRegionSettings.TerrainRaiseLimit;
|
||||
currentRegionSettings.TerrainTexture1 = loadedRegionSettings.TerrainTexture1;
|
||||
currentRegionSettings.TerrainTexture2 = loadedRegionSettings.TerrainTexture2;
|
||||
currentRegionSettings.TerrainTexture3 = loadedRegionSettings.TerrainTexture3;
|
||||
currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
|
||||
currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
|
||||
currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
|
||||
|
||||
IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
|
||||
estateModule.sendRegionHandshakeToAll();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load terrain data
|
||||
/// </summary>
|
||||
|
|
|
@ -56,20 +56,20 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
protected ITerrainModule m_terrainModule;
|
||||
protected IRegionSerialiserModule m_serialiser;
|
||||
protected List<SceneObjectGroup> m_sceneObjects;
|
||||
protected string m_sceneName;
|
||||
protected RegionInfo m_regionInfo;
|
||||
protected string m_savePath;
|
||||
|
||||
public ArchiveWriteRequestExecution(
|
||||
List<SceneObjectGroup> sceneObjects,
|
||||
ITerrainModule terrainModule,
|
||||
IRegionSerialiserModule serialiser,
|
||||
string sceneName,
|
||||
RegionInfo regionInfo,
|
||||
string savePath)
|
||||
{
|
||||
m_sceneObjects = sceneObjects;
|
||||
m_terrainModule = terrainModule;
|
||||
m_serialiser = serialiser;
|
||||
m_sceneName = sceneName;
|
||||
m_regionInfo = regionInfo;
|
||||
m_savePath = savePath;
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
// Write out control file
|
||||
archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile());
|
||||
|
||||
// Write out region settings
|
||||
string settingsPath = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_regionInfo.RegionName);
|
||||
archive.AddFile(settingsPath, RegionSettingsSerializer.Serialize(m_regionInfo.RegionSettings));
|
||||
|
||||
// Write out terrain
|
||||
string terrainPath = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_sceneName);
|
||||
string terrainPath = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_regionInfo.RegionName);
|
||||
MemoryStream ms = new MemoryStream();
|
||||
m_terrainModule.SaveToStream(terrainPath, ms);
|
||||
archive.AddFile(terrainPath, ms.ToArray());
|
||||
|
@ -137,7 +141,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
xtw.WriteStartDocument();
|
||||
xtw.WriteStartElement("archive");
|
||||
xtw.WriteAttributeString("major_version", "0");
|
||||
xtw.WriteAttributeString("minor_version", "1");
|
||||
xtw.WriteAttributeString("minor_version", "2");
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.Flush();
|
||||
|
|
|
@ -205,8 +205,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
// Get the prim's default texture. This will be used for faces which don't have their own texture
|
||||
assetUuids[textureEntry.DefaultTexture.TextureID] = 1;
|
||||
|
||||
if (part.Shape.SculptTexture != UUID.Zero)
|
||||
assetUuids[part.Shape.SculptTexture] = 1;
|
||||
// XXX: Not a great way to iterate through face textures, but there's no
|
||||
// other method available to tell how many faces there actually are
|
||||
//int i = 0;
|
||||
|
@ -219,6 +217,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
}
|
||||
}
|
||||
|
||||
// If the prim is a sculpt then preserve this information too
|
||||
if (part.Shape.SculptTexture != UUID.Zero)
|
||||
assetUuids[part.Shape.SculptTexture] = 1;
|
||||
|
||||
// Now analyze this prim's inventory items to preserve all the uuids that they reference
|
||||
foreach (TaskInventoryItem tii in part.TaskInventory.Values)
|
||||
{
|
||||
//m_log.DebugFormat("[ARCHIVER]: Analysing item asset type {0}", tii.Type);
|
||||
|
@ -239,10 +242,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
{
|
||||
GetSceneObjectAssetUuids(tii.AssetID, assetUuids);
|
||||
}
|
||||
else
|
||||
{
|
||||
//else
|
||||
//{
|
||||
//m_log.DebugFormat("[ARCHIVER]: Recording asset {0} in object {1}", tii.AssetID, part.UUID);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,14 +287,30 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
"[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets",
|
||||
sceneObjects.Count, assetUuids.Count);
|
||||
|
||||
// Make sure that we also request terrain texture assets
|
||||
RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings;
|
||||
|
||||
if (regionSettings.TerrainTexture1 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_1)
|
||||
assetUuids[regionSettings.TerrainTexture1] = 1;
|
||||
|
||||
if (regionSettings.TerrainTexture2 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_2)
|
||||
assetUuids[regionSettings.TerrainTexture2] = 1;
|
||||
|
||||
if (regionSettings.TerrainTexture3 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_3)
|
||||
assetUuids[regionSettings.TerrainTexture3] = 1;
|
||||
|
||||
if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4)
|
||||
assetUuids[regionSettings.TerrainTexture4] = 1;
|
||||
|
||||
// Asynchronously request all the assets required to perform this archive operation
|
||||
ArchiveWriteRequestExecution awre
|
||||
= new ArchiveWriteRequestExecution(
|
||||
sceneObjects,
|
||||
m_scene.RequestModuleInterface<ITerrainModule>(),
|
||||
m_scene.RequestModuleInterface<IRegionSerialiserModule>(),
|
||||
m_scene.RegionInfo.RegionName,
|
||||
m_scene.RegionInfo,
|
||||
m_savePath);
|
||||
|
||||
new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,258 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize and deserialize region settings for an archive file format.
|
||||
/// </summary>
|
||||
/// We didn't simply use automatic .NET serializagion for OpenSim.Framework.RegionSettings since this is really
|
||||
/// a file format rather than an object serialization.
|
||||
/// TODO: However, we could still have used separate non-framework classes here to read and write the xml
|
||||
/// automatically rather than laboriously doing it by hand using XmlTextReader and Writer. Should switch to this
|
||||
/// in the future.
|
||||
public class RegionSettingsSerializer
|
||||
{
|
||||
protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize region settings
|
||||
/// </summary>
|
||||
/// <param name="serializedSettings"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Xml.XmlException"></exception>
|
||||
public static RegionSettings Deserialize(byte[] serializedSettings)
|
||||
{
|
||||
return Deserialize(m_asciiEncoding.GetString(serializedSettings, 0, serializedSettings.Length));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize region settings
|
||||
/// </summary>
|
||||
/// <param name="serializedSettings"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Xml.XmlException"></exception>
|
||||
public static RegionSettings Deserialize(string serializedSettings)
|
||||
{
|
||||
RegionSettings settings = new RegionSettings();
|
||||
|
||||
StringReader sr = new StringReader(serializedSettings);
|
||||
XmlTextReader xtr = new XmlTextReader(sr);
|
||||
|
||||
xtr.ReadStartElement("RegionSettings");
|
||||
|
||||
xtr.ReadStartElement("General");
|
||||
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
switch (xtr.Name)
|
||||
{
|
||||
case "AllowDamage":
|
||||
settings.AllowDamage = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "AllowLandResell":
|
||||
settings.AllowLandResell = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "AllowLandJoinDivide":
|
||||
settings.AllowLandJoinDivide = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "BlockFly":
|
||||
settings.BlockFly = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "BlockLandShowInSearch":
|
||||
settings.BlockShowInSearch = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "BlockTerraform":
|
||||
settings.BlockTerraform = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "DisableCollisions":
|
||||
settings.DisableCollisions = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "DisablePhysics":
|
||||
settings.DisablePhysics = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "DisableScripts":
|
||||
settings.DisableScripts = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "MaturityRating":
|
||||
settings.Maturity = int.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "RestrictPushing":
|
||||
settings.RestrictPushing = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "AgentLimit":
|
||||
settings.AgentLimit = int.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "ObjectBonus":
|
||||
settings.ObjectBonus = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xtr.ReadEndElement();
|
||||
xtr.ReadStartElement("GroundTextures");
|
||||
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
switch (xtr.Name)
|
||||
{
|
||||
case "Texture1":
|
||||
settings.TerrainTexture1 = UUID.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "Texture2":
|
||||
settings.TerrainTexture2 = UUID.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "Texture3":
|
||||
settings.TerrainTexture3 = UUID.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "Texture4":
|
||||
settings.TerrainTexture4 = UUID.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "ElevationLowSW":
|
||||
settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "ElevationLowNW":
|
||||
settings.Elevation1NW = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "ElevationLowSE":
|
||||
settings.Elevation1SE = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "ElevationLowNE":
|
||||
settings.Elevation1NE = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "ElevationHighSW":
|
||||
settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "ElevationHighNW":
|
||||
settings.Elevation2NW = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "ElevationHighSE":
|
||||
settings.Elevation2SE = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "ElevationHighNE":
|
||||
settings.Elevation2NE = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xtr.ReadEndElement();
|
||||
xtr.ReadStartElement("Terrain");
|
||||
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
switch (xtr.Name)
|
||||
{
|
||||
case "WaterHeight":
|
||||
settings.WaterHeight = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "TerrainRaiseLimit":
|
||||
settings.TerrainRaiseLimit = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "TerrainLowerLimit":
|
||||
settings.TerrainLowerLimit = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "UseEstateSun":
|
||||
settings.UseEstateSun = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "FixedSun":
|
||||
settings.FixedSun = bool.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xtr.Close();
|
||||
sr.Close();
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
public static string Serialize(RegionSettings settings)
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||
xtw.Formatting = Formatting.Indented;
|
||||
xtw.WriteStartDocument();
|
||||
|
||||
xtw.WriteStartElement("RegionSettings");
|
||||
|
||||
xtw.WriteStartElement("General");
|
||||
xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString());
|
||||
xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString());
|
||||
xtw.WriteElementString("AllowLandJoinDivide", settings.AllowLandJoinDivide.ToString());
|
||||
xtw.WriteElementString("BlockFly", settings.BlockFly.ToString());
|
||||
xtw.WriteElementString("BlockLandShowInSearch", settings.BlockShowInSearch.ToString());
|
||||
xtw.WriteElementString("BlockTerraform", settings.BlockTerraform.ToString());
|
||||
xtw.WriteElementString("DisableCollisions", settings.DisableCollisions.ToString());
|
||||
xtw.WriteElementString("DisablePhysics", settings.DisablePhysics.ToString());
|
||||
xtw.WriteElementString("DisableScripts", settings.DisableScripts.ToString());
|
||||
xtw.WriteElementString("MaturityRating", settings.Maturity.ToString());
|
||||
xtw.WriteElementString("RestrictPushing", settings.RestrictPushing.ToString());
|
||||
xtw.WriteElementString("AgentLimit", settings.AgentLimit.ToString());
|
||||
xtw.WriteElementString("ObjectBonus", settings.ObjectBonus.ToString());
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.WriteStartElement("GroundTextures");
|
||||
xtw.WriteElementString("Texture1", settings.TerrainTexture1.ToString());
|
||||
xtw.WriteElementString("Texture2", settings.TerrainTexture2.ToString());
|
||||
xtw.WriteElementString("Texture3", settings.TerrainTexture3.ToString());
|
||||
xtw.WriteElementString("Texture4", settings.TerrainTexture4.ToString());
|
||||
xtw.WriteElementString("ElevationLowSW", settings.Elevation1SW.ToString());
|
||||
xtw.WriteElementString("ElevationLowNW", settings.Elevation1NW.ToString());
|
||||
xtw.WriteElementString("ElevationLowSE", settings.Elevation1SE.ToString());
|
||||
xtw.WriteElementString("ElevationLowNE", settings.Elevation1NE.ToString());
|
||||
xtw.WriteElementString("ElevationHighSW", settings.Elevation2SW.ToString());
|
||||
xtw.WriteElementString("ElevationHighNW", settings.Elevation2NW.ToString());
|
||||
xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString());
|
||||
xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString());
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.WriteStartElement("Terrain");
|
||||
xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString());
|
||||
xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString());
|
||||
xtw.WriteElementString("TerrainLowerLimit", settings.TerrainLowerLimit.ToString());
|
||||
xtw.WriteElementString("UseEstateSun", settings.UseEstateSun.ToString());
|
||||
xtw.WriteElementString("FixedSun", settings.FixedSun.ToString());
|
||||
// XXX: Need to expose interface to get sun phase information from sun module
|
||||
// xtw.WriteStartElement("SunPhase",
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.Close();
|
||||
sw.Close();
|
||||
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@ namespace OpenSim.Region.Environment
|
|||
|
||||
protected Dictionary<string, byte[]> m_files = new Dictionary<string, byte[]>();
|
||||
|
||||
protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding();
|
||||
protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
|
||||
|
||||
/// <summary>
|
||||
/// Add a directory to the tar archive. We can only handle one path level right now!
|
||||
|
|
|
@ -562,7 +562,6 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
|
|||
|
||||
private void HandleRegionInfoRequest(IClientAPI remote_client)
|
||||
{
|
||||
|
||||
RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs();
|
||||
args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor;
|
||||
args.estateID = m_scene.RegionInfo.EstateSettings.EstateID;
|
||||
|
@ -754,9 +753,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
|
|||
|
||||
public void sendRegionHandshakeToAll()
|
||||
{
|
||||
m_scene.Broadcast(
|
||||
sendRegionHandshake
|
||||
);
|
||||
m_scene.Broadcast(sendRegionHandshake);
|
||||
}
|
||||
|
||||
public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2)
|
||||
|
|
|
@ -223,7 +223,6 @@ namespace OpenSim.Region.Environment.Modules
|
|||
// Insert our event handling hooks
|
||||
|
||||
scene.EventManager.OnFrame += SunUpdate;
|
||||
//scene.EventManager.OnNewClient += SunToClient;
|
||||
scene.EventManager.OnMakeChildAgent += MakeChildAgent;
|
||||
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
|
||||
scene.EventManager.OnClientClosed += ClientLoggedOut;
|
||||
|
@ -248,9 +247,9 @@ namespace OpenSim.Region.Environment.Modules
|
|||
public void Close()
|
||||
{
|
||||
ready = false;
|
||||
|
||||
// Remove our hooks
|
||||
m_scene.EventManager.OnFrame -= SunUpdate;
|
||||
// m_scene.EventManager.OnNewClient -= SunToClient;
|
||||
m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent;
|
||||
m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
|
||||
m_scene.EventManager.OnClientClosed -= ClientLoggedOut;
|
||||
|
|
Loading…
Reference in New Issue