From 1fb01a009925f6c5d55f9f485a6d151b3b981f40 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 5 Jan 2017 21:21:15 +0000 Subject: add config option automatic_gods. With this option true, users that can be Gods will have that level automaticly without the need request on viewer; Propagate current god level to nearby regions (with local checks) --- .../EntityTransfer/EntityTransferModule.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.cs | 4 +++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 42 +++++++++++++++++----- 3 files changed, 38 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 6b1eb54..ebebfd0 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2077,6 +2077,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agentpos.Position = sp.AbsolutePosition; agentpos.Velocity = sp.Velocity; agentpos.RegionHandle = currentRegionHandler; + agentpos.GodLevel = sp.GodLevel; agentpos.Throttles = spClient.GetThrottlesPacked(1); // agentpos.ChildrenCapSeeds = seeds; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 352bc05..a293c92 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -316,6 +316,8 @@ namespace OpenSim.Region.Framework.Scenes public bool m_seeIntoBannedRegion = false; public int MaxUndoCount = 5; + public bool AutomaticGodsOption {get; private set; } + public bool SeeIntoRegion { get; set; } // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; @@ -1207,6 +1209,8 @@ namespace OpenSim.Region.Framework.Scenes #endregion Interest Management + AutomaticGodsOption = Util.GetConfigVarFromSections(config, "automatic_gods", + new string[] { "Startup", "Permissions" }, true); StatsReporter = new SimStatsReporter(this); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 29e139b..c8d28f9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1087,6 +1087,14 @@ namespace OpenSim.Region.Framework.Scenes if (account != null) UserLevel = account.UserLevel; + if(!isNPC && m_scene.AutomaticGodsOption && m_scene.Permissions != null) + { + if(m_scene.Permissions.IsGod(m_uuid)) + m_godLevel = 200; + if(m_godLevel < UserLevel) + m_godLevel = UserLevel; + } + // IGroupsModule gm = m_scene.RequestModuleInterface(); // if (gm != null) // Grouptitle = gm.GetGroupTitle(m_uuid); @@ -4262,6 +4270,7 @@ namespace OpenSim.Region.Framework.Scenes agentpos.Position = AbsolutePosition; agentpos.Velocity = Velocity; agentpos.RegionHandle = RegionHandle; + agentpos.GodLevel = GodLevel; agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); // Let's get this out of the update loop @@ -4510,6 +4519,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void GrantGodlikePowers(UUID token, bool godStatus) { + if(m_scene.AutomaticGodsOption) + return; + int oldgodlevel = GodLevel; if (godStatus && !isNPC && m_scene.Permissions.IsGod(UUID)) @@ -4568,6 +4580,13 @@ namespace OpenSim.Region.Framework.Scenes m_pos = cAgentData.Position + offset; CameraPosition = cAgentData.Center + offset; + if(!m_scene.AutomaticGodsOption) + { + if(cAgentData.GodLevel >= 200 && m_scene.Permissions.IsGod(m_uuid)) + GodLevel = cAgentData.GodLevel; + else + GodLevel = 0; + } if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) { @@ -4627,11 +4646,13 @@ namespace OpenSim.Region.Framework.Scenes cAgent.HeadRotation = m_headrotation; cAgent.BodyRotation = Rotation; cAgent.ControlFlags = (uint)m_AgentControlFlags; - - if (GodLevel > 200 && m_scene.Permissions.IsGod(cAgent.AgentID)) - cAgent.GodLevel = (byte)GodLevel; - else - cAgent.GodLevel = (byte) 0; + if(!m_scene.AutomaticGodsOption) + { + if (GodLevel >= 200 && m_scene.Permissions.IsGod(cAgent.AgentID)) + cAgent.GodLevel = (byte)GodLevel; + else + cAgent.GodLevel = (byte) 0; + } cAgent.AlwaysRun = SetAlwaysRun; @@ -4729,10 +4750,13 @@ namespace OpenSim.Region.Framework.Scenes Rotation = cAgent.BodyRotation; m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; - if (cAgent.GodLevel >200 && m_scene.Permissions.IsGod(cAgent.AgentID)) - GodLevel = cAgent.GodLevel; - else - GodLevel = 0; + if(!m_scene.AutomaticGodsOption) + { + if (cAgent.GodLevel >= 200 && m_scene.Permissions.IsGod(cAgent.AgentID)) + GodLevel = cAgent.GodLevel; + else + GodLevel = 0; + } SetAlwaysRun = cAgent.AlwaysRun; -- cgit v1.1