fix/simplify validation of god_data update field
parent
7ac74fcf73
commit
e5a3d85bc7
|
@ -90,7 +90,7 @@ namespace OpenSim.Framework
|
||||||
public Vector3 LeftAxis;
|
public Vector3 LeftAxis;
|
||||||
public Vector3 UpAxis;
|
public Vector3 UpAxis;
|
||||||
//public int GodLevel;
|
//public int GodLevel;
|
||||||
public OSD GodData = new OSDMap();
|
public OSD GodData = null;
|
||||||
public bool ChangedGrid;
|
public bool ChangedGrid;
|
||||||
|
|
||||||
// This probably shouldn't be here
|
// This probably shouldn't be here
|
||||||
|
@ -119,12 +119,15 @@ namespace OpenSim.Framework
|
||||||
args["far"] = OSD.FromReal(Far);
|
args["far"] = OSD.FromReal(Far);
|
||||||
args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
|
args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
|
||||||
//args["god_level"] = OSD.FromString(GodLevel.ToString());
|
//args["god_level"] = OSD.FromString(GodLevel.ToString());
|
||||||
args["god_data"] = GodData;
|
if(GodData != null)
|
||||||
OSDMap g = (OSDMap)GodData;
|
{
|
||||||
// Set legacy value
|
args["god_data"] = GodData;
|
||||||
// TODO: remove after 0.9 is superseded
|
OSDMap g = (OSDMap)GodData;
|
||||||
if (g.ContainsKey("ViewerUiIsGod"))
|
// Set legacy value
|
||||||
args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
|
// 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))
|
if ((Throttles != null) && (Throttles.Length > 0))
|
||||||
args["throttles"] = OSD.FromBinary(Throttles);
|
args["throttles"] = OSD.FromBinary(Throttles);
|
||||||
|
@ -185,7 +188,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
//if (args["god_level"] != null)
|
//if (args["god_level"] != null)
|
||||||
// Int32.TryParse(args["god_level"].AsString(), out GodLevel);
|
// Int32.TryParse(args["god_level"].AsString(), out GodLevel);
|
||||||
if (args["god_data"] != null)
|
if (args.ContainsKey("god_data") && args["god_data"] != null)
|
||||||
GodData = args["god_data"];
|
GodData = args["god_data"];
|
||||||
|
|
||||||
if (args["far"] != null)
|
if (args["far"] != null)
|
||||||
|
@ -362,7 +365,7 @@ namespace OpenSim.Framework
|
||||||
public Quaternion BodyRotation;
|
public Quaternion BodyRotation;
|
||||||
public uint ControlFlags;
|
public uint ControlFlags;
|
||||||
public float EnergyLevel;
|
public float EnergyLevel;
|
||||||
public OSD GodData = new OSDMap();
|
public OSD GodData = null;
|
||||||
//public Byte GodLevel;
|
//public Byte GodLevel;
|
||||||
public bool AlwaysRun;
|
public bool AlwaysRun;
|
||||||
public UUID PreyAgent;
|
public UUID PreyAgent;
|
||||||
|
@ -438,10 +441,13 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
args["energy_level"] = OSD.FromReal(EnergyLevel);
|
args["energy_level"] = OSD.FromReal(EnergyLevel);
|
||||||
//args["god_level"] = OSD.FromString(GodLevel.ToString());
|
//args["god_level"] = OSD.FromString(GodLevel.ToString());
|
||||||
args["god_data"] = GodData;
|
if(GodData != null)
|
||||||
OSDMap g = (OSDMap)GodData;
|
{
|
||||||
if (g.ContainsKey("ViewerUiIsGod"))
|
args["god_data"] = GodData;
|
||||||
args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
|
OSDMap g = (OSDMap)GodData;
|
||||||
|
if (g.ContainsKey("ViewerUiIsGod"))
|
||||||
|
args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
|
||||||
|
}
|
||||||
args["always_run"] = OSD.FromBoolean(AlwaysRun);
|
args["always_run"] = OSD.FromBoolean(AlwaysRun);
|
||||||
args["prey_agent"] = OSD.FromUUID(PreyAgent);
|
args["prey_agent"] = OSD.FromUUID(PreyAgent);
|
||||||
args["agent_access"] = OSD.FromString(AgentAccess.ToString());
|
args["agent_access"] = OSD.FromString(AgentAccess.ToString());
|
||||||
|
@ -622,7 +628,7 @@ namespace OpenSim.Framework
|
||||||
//if (args["god_level"] != null)
|
//if (args["god_level"] != null)
|
||||||
// Byte.TryParse(args["god_level"].AsString(), out GodLevel);
|
// Byte.TryParse(args["god_level"].AsString(), out GodLevel);
|
||||||
|
|
||||||
if (args["god_data"] != null)
|
if (args.ContainsKey("god_data") && args["god_data"] != null)
|
||||||
GodData = args["god_data"];
|
GodData = args["god_data"];
|
||||||
|
|
||||||
if (args["always_run"] != null)
|
if (args["always_run"] != null)
|
||||||
|
|
|
@ -198,12 +198,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void SetState(OSD state)
|
public void SetState(OSD state)
|
||||||
{
|
{
|
||||||
|
if(state == null)
|
||||||
|
return;
|
||||||
|
|
||||||
OSDMap s = (OSDMap)state;
|
OSDMap s = (OSDMap)state;
|
||||||
|
|
||||||
if (s.ContainsKey("ViewerUiIsGod"))
|
if (s.ContainsKey("ViewerUiIsGod"))
|
||||||
m_viewerUiIsGod = s["ViewerUiIsGod"].AsBoolean();
|
m_viewerUiIsGod = s["ViewerUiIsGod"].AsBoolean();
|
||||||
|
|
||||||
SyncViewerState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int UserLevel
|
public int UserLevel
|
||||||
|
|
Loading…
Reference in New Issue