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)

melanie
UbitUmarov 2017-01-05 21:21:15 +00:00
parent 1a35af229c
commit 1fb01a0099
4 changed files with 43 additions and 9 deletions

View File

@ -89,6 +89,7 @@ namespace OpenSim.Framework
public Vector3 AtAxis;
public Vector3 LeftAxis;
public Vector3 UpAxis;
public int GodLevel;
public bool ChangedGrid;
// This probably shouldn't be here
@ -116,6 +117,7 @@ namespace OpenSim.Framework
args["far"] = OSD.FromReal(Far);
args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
args["god_level"] = OSD.FromString(GodLevel.ToString());
if ((Throttles != null) && (Throttles.Length > 0))
args["throttles"] = OSD.FromBinary(Throttles);
@ -174,6 +176,9 @@ namespace OpenSim.Framework
if (args["changed_grid"] != null)
ChangedGrid = args["changed_grid"].AsBoolean();
if (args["god_level"] != null)
Int32.TryParse(args["god_level"].AsString(), out GodLevel);
if (args["far"] != null)
Far = (float)(args["far"].AsReal());

View File

@ -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;

View File

@ -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<bool>(config, "automatic_gods",
new string[] { "Startup", "Permissions" }, true);
StatsReporter = new SimStatsReporter(this);

View File

@ -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<IGroupsModule>();
// 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
/// </summary>
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))
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))
if(!m_scene.AutomaticGodsOption)
{
if (cAgent.GodLevel >= 200 && m_scene.Permissions.IsGod(cAgent.AgentID))
GodLevel = cAgent.GodLevel;
else
GodLevel = 0;
}
SetAlwaysRun = cAgent.AlwaysRun;