diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 6f4a07a293..2117e2da52 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs @@ -99,5 +99,6 @@ namespace OpenSim.Region.Framework.Interfaces void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay); + void ClearAllEnviroments(); } } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index eb4c96d432..21243dc1b4 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -1095,8 +1095,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver currentRegionSettings.CacheID = UUID.Random(); currentRegionSettings.Save(); - scene.TriggerEstateSunUpdate(); - IEstateModule estateModule = scene.RequestModuleInterface(); if (estateModule != null) estateModule.sendRegionHandshakeToAll(); diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 002f18ceb7..f0c5e453f7 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -119,10 +119,6 @@ namespace OpenSim.Region.CoreModules.World.Estate public void RegionLoaded(Scene scene) { - // Sets up the sun module based no the saved Estate and Region Settings - // DO NOT REMOVE or the sun will stop working - scene.TriggerEstateSunUpdate(); - UserManager = scene.RequestModuleInterface(); scene.RegionInfo.EstateSettings.DoDenyMinors = !m_ignoreEstateMinorAccessControl; @@ -605,8 +601,6 @@ namespace OpenSim.Region.CoreModules.World.Estate if (Scene.PhysicsEnabled && Scene.PhysicsScene != null && lastwaterlevel != WaterHeight) Scene.PhysicsScene.SetWaterLevel(WaterHeight); - Scene.TriggerEstateSunUpdate(); - //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); @@ -1529,6 +1523,8 @@ namespace OpenSim.Region.CoreModules.World.Estate public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) { + bool lastallowEnvOvr = Scene.RegionInfo.EstateSettings.AllowEnviromentOverride; + if ((parms1 & 0x00008000) != 0) Scene.RegionInfo.EstateSettings.PublicAccess = true; else @@ -1578,6 +1574,12 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.EstateSettings.DenyMinors = false; Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); + + if (lastallowEnvOvr && Scene.LandChannel != null && !Scene.RegionInfo.EstateSettings.AllowEnviromentOverride) + { + Scene.ClearAllParcelEnviroments(); + } + TriggerEstateInfoChange(); sendDetailedEstateData(remoteClient, invoice); @@ -1590,6 +1592,7 @@ namespace OpenSim.Region.CoreModules.World.Estate bool alloVoiceChat, bool overridePublicAccess, bool allowEnviromentOverride) { + bool lastallowEnvOvr = Scene.RegionInfo.EstateSettings.AllowEnviromentOverride; Scene.RegionInfo.EstateSettings.PublicAccess = externallyVisible; Scene.RegionInfo.EstateSettings.AllowDirectTeleport = allowDirectTeleport; @@ -1603,6 +1606,9 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.EstateSettings.AllowEnviromentOverride = allowEnviromentOverride; Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings); + if(lastallowEnvOvr && !allowEnviromentOverride) + Scene.ClearAllParcelEnviroments(); + TriggerEstateInfoChange(); return true; diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 9e687eb0aa..a71a126590 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -254,6 +254,13 @@ namespace OpenSim.Region.CoreModules.World.Land m_landManagementModule.sendClientInitialLandInfo(remoteClient, overlay); } } + + public void ClearAllEnviroments() + { + List parcels = AllParcels(); + for(int i=0; i< parcels.Count; ++i) + parcels[i].StoreEnviroment(null); + } #endregion } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index b0076f6745..574edc569a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -1984,6 +1984,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void StoreEnviroment(ViewerEnviroment VEnv) { + int lastVersion = LandData.EnviromentVersion; LandData.Enviroment = VEnv; if (VEnv == null) LandData.EnviromentVersion = -1; @@ -1992,8 +1993,11 @@ namespace OpenSim.Region.CoreModules.World.Land ++LandData.EnviromentVersion; VEnv.version = LandData.EnviromentVersion; } - m_scene.LandChannel.UpdateLandObject(LandData.LocalID, LandData); - SendLandUpdateToAvatarsOverMe(); + if(lastVersion != LandData.EnviromentVersion) + { + m_scene.LandChannel.UpdateLandObject(LandData.LocalID, LandData); + SendLandUpdateToAvatarsOverMe(); + } } } } diff --git a/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs b/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs index 3be3e538a9..60a7c0d489 100644 --- a/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs @@ -36,6 +36,7 @@ namespace OpenSim.Region.Framework.Interfaces void FromLightShare(RegionLightShareData wl); RegionLightShareData ToLightShare(); byte[] GetDefaultAssetData(int type); + void WindlightRefresh(int interpolate, bool notforparcel = true); float GetRegionDayFractionTime(); int GetRegionDayLength(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 21a2a20123..f500a152a6 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5884,16 +5884,22 @@ Environment.Exit(1); IEstateDataService estateDataService = EstateDataService; if (estateDataService != null) { + bool parcelEnvOvr = RegionInfo.EstateSettings.AllowEnviromentOverride; RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false); - TriggerEstateSunUpdate(); + if(parcelEnvOvr && !RegionInfo.EstateSettings.AllowEnviromentOverride) + ClearAllParcelEnviroments(); } } - public void TriggerEstateSunUpdate() + public void ClearAllParcelEnviroments() { - EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle); + IEnvironmentModule envM = RequestModuleInterface(); + if(LandChannel != null && envM != null) + { + LandChannel.ClearAllEnviroments(); + envM.WindlightRefresh(1,false); + } } - private void HandleReloadEstate(string module, string[] cmd) { if (MainConsole.Instance.ConsoleScene == null || diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index b5227aa5df..fc0e513e05 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -120,5 +120,6 @@ namespace OpenSim.Tests.Common public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} public void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay) { } + public void ClearAllEnviroments(){ } } } \ No newline at end of file