From c7079555174bf34fc7df9622a3601f8a305cd2b7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 6 Jan 2017 10:28:10 +0000 Subject: [PATCH] restore parcels avatars visibility god level change correct handling; try to reduced the increased change of user error on config options setting --- .../Region/Framework/Scenes/GodController.cs | 44 ++++++++++--------- .../Region/Framework/Scenes/ScenePresence.cs | 8 ++-- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/GodController.cs b/OpenSim/Region/Framework/Scenes/GodController.cs index f51e8c990c..f8b576cc74 100644 --- a/OpenSim/Region/Framework/Scenes/GodController.cs +++ b/OpenSim/Region/Framework/Scenes/GodController.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence m_scenePresence; Scene m_scene; protected bool m_allowGridGods; - protected bool m_forceGridGods; + protected bool m_forceGridGodsOnly; protected bool m_regionOwnerIsGod; protected bool m_regionManagerIsGod; protected bool m_parcelOwnerIsGod; @@ -78,25 +78,30 @@ namespace OpenSim.Region.Framework.Scenes "allow_grid_gods", sections, false); // If grid gods are active, dont allow any other gods - m_forceGridGods = + m_forceGridGodsOnly = Util.GetConfigVarFromSections(config, - "force_grid_gods", sections, false); + "force_grid_gods_only", sections, false); - // The owner of a region is a god in his region only. - m_regionOwnerIsGod = + if(!m_forceGridGodsOnly) // damm redundant and error prone option + { + // The owner of a region is a god in his region only. + m_regionOwnerIsGod = Util.GetConfigVarFromSections(config, "region_owner_is_god", sections, true); - // Region managers are gods in the regions they manage. - m_regionManagerIsGod = + // Region managers are gods in the regions they manage. + m_regionManagerIsGod = Util.GetConfigVarFromSections(config, "region_manager_is_god", sections, false); - // Parcel owners are gods in their own parcels only. - m_parcelOwnerIsGod = + // Parcel owners are gods in their own parcels only. + m_parcelOwnerIsGod = Util.GetConfigVarFromSections(config, "parcel_owner_is_god", sections, false); - + } + else + m_allowGridGods = true; // reduce user mistakes increased by this over complex options set + // God mode should be turned on in the viewer whenever // the user has god rights somewhere. They may choose // to turn it off again, though. @@ -110,13 +115,12 @@ namespace OpenSim.Region.Framework.Scenes m_allowGodActionsWithoutGodMode = Util.GetConfigVarFromSections(config, "implicit_gods", sections, false); - } protected int PotentialGodLevel() { int godLevel = m_allowGridGods ? m_userLevel : 200; - if ((!m_forceGridGods) && m_userLevel < 200) + if ((!m_forceGridGodsOnly) && m_userLevel < 200) godLevel = 200; return godLevel; @@ -127,6 +131,9 @@ namespace OpenSim.Region.Framework.Scenes if (m_allowGridGods && m_userLevel > 0) return true; + if(m_forceGridGodsOnly) + return false; + if (m_regionOwnerIsGod && m_scene.RegionInfo.EstateSettings.IsEstateOwner(m_scenePresence.UUID)) return true; @@ -164,13 +171,12 @@ namespace OpenSim.Region.Framework.Scenes public bool RequestGodMode(bool god) { + // this is used by viewer protocol + // and they may want a answer if (!god) { - if (m_viewerUiIsGod) - m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, 0); - + m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, 0); m_viewerUiIsGod = false; - return true; } @@ -178,12 +184,8 @@ namespace OpenSim.Region.Framework.Scenes return false; int godLevel = PotentialGodLevel(); - - if (!m_viewerUiIsGod) - m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)godLevel); - + m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)godLevel); m_viewerUiIsGod = true; - return true; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 36d0e40638..01e0aac608 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4509,9 +4509,11 @@ namespace OpenSim.Region.Framework.Scenes if (isNPC) return; - bool success = GodController.RequestGodMode(godStatus); - if (success && godStatus) - parcelGodCheck(m_currentParcelUUID, GodController.GodLevel >= 200); + bool wasgod = (GodController.GodLevel >= 200); + GodController.RequestGodMode(godStatus); + bool isgod = GodController.GodLevel >= 200; + if (wasgod != isgod) + parcelGodCheck(m_currentParcelUUID, isgod); } #region Child Agent Updates