Restructure god level and permissions

Create a class GodController which controls all aspects of god level,
viewer modes and user levels at ScenePresence level.
This commit is contained in:
Melanie Thielker
2017-01-06 00:55:14 +00:00
parent 46bffad558
commit ad8915f154
22 changed files with 105 additions and 150 deletions

View File

@@ -89,7 +89,8 @@ namespace OpenSim.Framework
public Vector3 AtAxis;
public Vector3 LeftAxis;
public Vector3 UpAxis;
public int GodLevel;
//public int GodLevel;
public OSD GodData = new OSDMap();
public bool ChangedGrid;
// This probably shouldn't be here
@@ -117,7 +118,13 @@ namespace OpenSim.Framework
args["far"] = OSD.FromReal(Far);
args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
args["god_level"] = OSD.FromString(GodLevel.ToString());
//args["god_level"] = OSD.FromString(GodLevel.ToString());
args["god_data"] = GodData;
OSDMap g = (OSDMap)GodData;
// Set legacy value
// TODO: remove after 0.9 is superseded
if (g.ContainsKey("ViewerUiIsGod"))
args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
if ((Throttles != null) && (Throttles.Length > 0))
args["throttles"] = OSD.FromBinary(Throttles);
@@ -176,8 +183,10 @@ 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["god_level"] != null)
// Int32.TryParse(args["god_level"].AsString(), out GodLevel);
if (args["god_data"] != null)
GodData = args["god_data"];
if (args["far"] != null)
Far = (float)(args["far"].AsReal());
@@ -353,7 +362,8 @@ namespace OpenSim.Framework
public Quaternion BodyRotation;
public uint ControlFlags;
public float EnergyLevel;
public Byte GodLevel;
public OSD GodData = new OSDMap();
//public Byte GodLevel;
public bool AlwaysRun;
public UUID PreyAgent;
public Byte AgentAccess;
@@ -427,7 +437,11 @@ namespace OpenSim.Framework
args["control_flags"] = OSD.FromString(ControlFlags.ToString());
args["energy_level"] = OSD.FromReal(EnergyLevel);
args["god_level"] = OSD.FromString(GodLevel.ToString());
//args["god_level"] = OSD.FromString(GodLevel.ToString());
args["god_data"] = GodData;
OSDMap g = (OSDMap)GodData;
if (g.ContainsKey("ViewerUiIsGod"))
args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
args["always_run"] = OSD.FromBoolean(AlwaysRun);
args["prey_agent"] = OSD.FromUUID(PreyAgent);
args["agent_access"] = OSD.FromString(AgentAccess.ToString());
@@ -605,8 +619,11 @@ namespace OpenSim.Framework
if (args["energy_level"] != null)
EnergyLevel = (float)(args["energy_level"].AsReal());
if (args["god_level"] != null)
Byte.TryParse(args["god_level"].AsString(), out GodLevel);
//if (args["god_level"] != null)
// Byte.TryParse(args["god_level"].AsString(), out GodLevel);
if (args["god_data"] != null)
GodData = args["god_data"];
if (args["always_run"] != null)
AlwaysRun = args["always_run"].AsBoolean();