From f0ea8eb53463fe7e228537779f3f700bc6ecb74d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 30 Dec 2008 19:00:19 +0000 Subject: * 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 loaded --- .../Modules/World/Archiver/ArchiveReadRequest.cs | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs') diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index e04662f..a5b5917 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs @@ -69,6 +69,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( new GZipStream(GetStream(m_loadPath), CompressionMode.Decompress)); @@ -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"); @@ -267,6 +277,68 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver return false; } } + + /// + /// Load region settings data + /// + /// + /// + /// + /// true if settings were loaded successfully, false otherwise + /// + 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(); + estateModule.sendRegionHandshakeToAll(); + + return true; + } /// /// Load terrain data -- cgit v1.1