cosmetics
parent
dc5a0244fc
commit
9ce52ed2fc
|
@ -571,111 +571,107 @@ namespace OpenSim.Framework
|
||||||
public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx)
|
public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx)
|
||||||
{
|
{
|
||||||
//m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
|
//m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
|
||||||
|
OSD tmp;
|
||||||
|
if (args.TryGetValue("region_id", out tmp) && tmp != null)
|
||||||
|
UUID.TryParse(tmp.AsString(), out RegionID);
|
||||||
|
|
||||||
if (args.ContainsKey("region_id"))
|
if (args.TryGetValue("circuit_code", out tmp) && tmp != null)
|
||||||
UUID.TryParse(args["region_id"].AsString(), out RegionID);
|
UInt32.TryParse(tmp.AsString(), out CircuitCode);
|
||||||
|
|
||||||
if (args["circuit_code"] != null)
|
if (args.TryGetValue("agent_uuid", out tmp) && tmp != null)
|
||||||
UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
|
AgentID = tmp.AsUUID();
|
||||||
|
|
||||||
if (args["agent_uuid"] != null)
|
if (args.TryGetValue("session_uuid", out tmp) && tmp != null)
|
||||||
AgentID = args["agent_uuid"].AsUUID();
|
SessionID = tmp.AsUUID();
|
||||||
|
|
||||||
if (args["session_uuid"] != null)
|
if (args.TryGetValue("position", out tmp) && tmp != null)
|
||||||
SessionID = args["session_uuid"].AsUUID();
|
Vector3.TryParse(tmp.AsString(), out Position);
|
||||||
|
|
||||||
if (args["position"] != null)
|
if (args.TryGetValue("velocity", out tmp) && tmp != null)
|
||||||
Vector3.TryParse(args["position"].AsString(), out Position);
|
Vector3.TryParse(tmp.AsString(), out Velocity);
|
||||||
|
|
||||||
if (args["velocity"] != null)
|
if (args.TryGetValue("center", out tmp) && tmp != null)
|
||||||
Vector3.TryParse(args["velocity"].AsString(), out Velocity);
|
Vector3.TryParse(tmp.AsString(), out Center);
|
||||||
|
|
||||||
if (args["center"] != null)
|
if (args.TryGetValue("size", out tmp) && tmp != null)
|
||||||
Vector3.TryParse(args["center"].AsString(), out Center);
|
Vector3.TryParse(tmp.AsString(), out Size);
|
||||||
|
|
||||||
if (args["size"] != null)
|
if (args.TryGetValue("at_axis", out tmp) && tmp != null)
|
||||||
Vector3.TryParse(args["size"].AsString(), out Size);
|
Vector3.TryParse(tmp.AsString(), out AtAxis);
|
||||||
|
|
||||||
if (args["at_axis"] != null)
|
if (args.TryGetValue("left_axis", out tmp) && tmp != null)
|
||||||
Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
|
Vector3.TryParse(tmp.AsString(), out AtAxis);
|
||||||
|
|
||||||
if (args["left_axis"] != null)
|
if (args.TryGetValue("up_axis", out tmp) && tmp != null)
|
||||||
Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
|
Vector3.TryParse(tmp.AsString(), out AtAxis);
|
||||||
|
|
||||||
if (args["up_axis"] != null)
|
if (args.TryGetValue("wait_for_root", out tmp) && tmp != null)
|
||||||
Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
|
SenderWantsToWaitForRoot = tmp.AsBoolean();
|
||||||
|
|
||||||
if (args.ContainsKey("wait_for_root") && args["wait_for_root"] != null)
|
if (args.TryGetValue("far", out tmp) && tmp != null)
|
||||||
SenderWantsToWaitForRoot = args["wait_for_root"].AsBoolean();
|
Far = (float)(tmp.AsReal());
|
||||||
|
|
||||||
if (args["far"] != null)
|
if (args.TryGetValue("aspect", out tmp) && tmp != null)
|
||||||
Far = (float)(args["far"].AsReal());
|
Aspect = (float)tmp.AsReal();
|
||||||
|
|
||||||
if (args["aspect"] != null)
|
if (args.TryGetValue("throttles", out tmp) && tmp != null)
|
||||||
Aspect = (float)args["aspect"].AsReal();
|
Throttles = tmp.AsBinary();
|
||||||
|
|
||||||
if (args["throttles"] != null)
|
if (args.TryGetValue("locomotion_state", out tmp) && tmp != null)
|
||||||
Throttles = args["throttles"].AsBinary();
|
UInt32.TryParse(tmp.AsString(), out LocomotionState);
|
||||||
|
|
||||||
if (args["locomotion_state"] != null)
|
if (args.TryGetValue("head_rotation", out tmp) && tmp != null)
|
||||||
UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState);
|
Quaternion.TryParse(tmp.AsString(), out HeadRotation);
|
||||||
|
|
||||||
if (args["head_rotation"] != null)
|
if (args.TryGetValue("body_rotation", out tmp) && tmp != null)
|
||||||
Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation);
|
Quaternion.TryParse(tmp.AsString(), out BodyRotation);
|
||||||
|
|
||||||
if (args["body_rotation"] != null)
|
if (args.TryGetValue("control_flags", out tmp) && tmp != null)
|
||||||
Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation);
|
UInt32.TryParse(tmp.AsString(), out ControlFlags);
|
||||||
|
|
||||||
if (args["control_flags"] != null)
|
if (args.TryGetValue("energy_level", out tmp) && tmp != null)
|
||||||
UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags);
|
EnergyLevel = (float)(tmp.AsReal());
|
||||||
|
|
||||||
if (args["energy_level"] != null)
|
if (args.TryGetValue("god_data", out tmp) && tmp != null)
|
||||||
EnergyLevel = (float)(args["energy_level"].AsReal());
|
GodData = tmp;
|
||||||
|
|
||||||
//if (args["god_level"] != null)
|
if (args.TryGetValue("always_run", out tmp) && tmp != null)
|
||||||
// Byte.TryParse(args["god_level"].AsString(), out GodLevel);
|
AlwaysRun = tmp.AsBoolean();
|
||||||
|
|
||||||
if (args.ContainsKey("god_data") && args["god_data"] != null)
|
if (args.TryGetValue("prey_agent", out tmp) && tmp != null)
|
||||||
GodData = args["god_data"];
|
PreyAgent = tmp.AsUUID();
|
||||||
|
|
||||||
if (args["always_run"] != null)
|
if (args.TryGetValue("agent_access", out tmp) && tmp != null)
|
||||||
AlwaysRun = args["always_run"].AsBoolean();
|
Byte.TryParse(tmp.AsString(), out AgentAccess);
|
||||||
|
|
||||||
if (args["prey_agent"] != null)
|
if (args.TryGetValue("agent_cof", out tmp) && tmp != null)
|
||||||
PreyAgent = args["prey_agent"].AsUUID();
|
agentCOF = tmp.AsUUID();
|
||||||
|
|
||||||
if (args["agent_access"] != null)
|
if (args.TryGetValue("crossingflags", out tmp) && tmp != null)
|
||||||
Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
|
CrossingFlags = (byte)tmp.AsInteger();
|
||||||
|
|
||||||
if (args.ContainsKey("agent_cof") && args["agent_cof"] != null)
|
|
||||||
agentCOF = args["agent_cof"].AsUUID();
|
|
||||||
|
|
||||||
if (args.ContainsKey("crossingflags") && args["crossingflags"] != null)
|
|
||||||
CrossingFlags = (byte)args["crossingflags"].AsInteger();
|
|
||||||
|
|
||||||
if(CrossingFlags != 0)
|
if(CrossingFlags != 0)
|
||||||
{
|
{
|
||||||
if (args.ContainsKey("crossExtraFlags") && args["crossExtraFlags"] != null)
|
if (args.TryGetValue("crossExtraFlags", out tmp) && tmp != null)
|
||||||
CrossExtraFlags = (byte)args["crossExtraFlags"].AsInteger();
|
CrossExtraFlags = (byte)tmp.AsInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.ContainsKey("active_group_id") && args["active_group_id"] != null)
|
if (args.TryGetValue("active_group_id", out tmp) && tmp != null)
|
||||||
ActiveGroupID = args["active_group_id"].AsUUID();
|
ActiveGroupID = tmp.AsUUID();
|
||||||
|
|
||||||
if (args.ContainsKey("active_group_name") && args["active_group_name"] != null)
|
if (args.TryGetValue("active_group_name", out tmp) && tmp != null)
|
||||||
ActiveGroupName = args["active_group_name"].AsString();
|
ActiveGroupName = tmp.AsString();
|
||||||
|
|
||||||
if(args.ContainsKey("active_group_title") && args["active_group_title"] != null)
|
if(args.TryGetValue("active_group_title", out tmp) && tmp != null)
|
||||||
ActiveGroupTitle = args["active_group_title"].AsString();
|
ActiveGroupTitle = tmp.AsString();
|
||||||
|
|
||||||
if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) &&
|
if (args.TryGetValue("children_seeds", out tmp) && tmp is OSDArray)
|
||||||
(args["children_seeds"].Type == OSDType.Array))
|
|
||||||
{
|
{
|
||||||
OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
|
OSDArray childrenSeeds = (OSDArray)tmp;
|
||||||
ChildrenCapSeeds = new Dictionary<ulong, string>();
|
ChildrenCapSeeds = new Dictionary<ulong, string>();
|
||||||
foreach (OSD o in childrenSeeds)
|
foreach (OSD o in childrenSeeds)
|
||||||
{
|
{
|
||||||
if (o.Type == OSDType.Map)
|
if (o is OSDMap)
|
||||||
{
|
{
|
||||||
ulong handle = 0;
|
ulong handle = 0;
|
||||||
string seed = "";
|
string seed = "";
|
||||||
|
@ -691,25 +687,25 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
|
if (args.TryGetValue("animations", out tmp) && tmp is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray anims = (OSDArray)(args["animations"]);
|
OSDArray anims = (OSDArray)tmp;
|
||||||
Anims = new Animation[anims.Count];
|
Anims = new Animation[anims.Count];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (OSD o in anims)
|
foreach (OSD o in anims)
|
||||||
{
|
{
|
||||||
if (o.Type == OSDType.Map)
|
if (o is OSDMap)
|
||||||
{
|
{
|
||||||
Anims[i++] = new Animation((OSDMap)o);
|
Anims[i++] = new Animation((OSDMap)o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args["default_animation"] != null)
|
if (args.TryGetValue("default_animation", out tmp) && tmp is OSDMap)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DefaultAnim = new Animation((OSDMap)args["default_animation"]);
|
DefaultAnim = new Animation((OSDMap)tmp);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -717,11 +713,11 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args["animation_state"] != null)
|
if (args.TryGetValue("animation_state", out tmp) && tmp is OSDMap)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AnimState = new Animation((OSDMap)args["animation_state"]);
|
AnimState = new Animation((OSDMap)tmp);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -731,9 +727,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
MovementAnimationOverRides.Clear();
|
MovementAnimationOverRides.Clear();
|
||||||
|
|
||||||
if (args["movementAO"] != null && args["movementAO"].Type == OSDType.Array)
|
if (args.TryGetValue("movementAO", out tmp) && tmp is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray AOs = (OSDArray)(args["movementAO"]);
|
OSDArray AOs = (OSDArray)tmp;
|
||||||
int count = AOs.Count;
|
int count = AOs.Count;
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
|
@ -748,8 +744,8 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.ContainsKey("motion_state"))
|
if (args.TryGetValue("motion_state", out tmp) && tmp != null)
|
||||||
MotionState = (byte)args["motion_state"].AsInteger();
|
MotionState = (byte)tmp.AsInteger();
|
||||||
|
|
||||||
//if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
|
//if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
|
||||||
//{
|
//{
|
||||||
|
@ -762,10 +758,10 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
|
|
||||||
// packed_appearence should contain all appearance information
|
// packed_appearence should contain all appearance information
|
||||||
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
|
if (args.TryGetValue("packed_appearance", out tmp) && tmp is OSDMap)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance");
|
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance");
|
||||||
Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
|
Appearance = new AvatarAppearance((OSDMap)tmp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -777,19 +773,19 @@ namespace OpenSim.Framework
|
||||||
// The code to unpack textures, visuals, wearables and attachments
|
// The code to unpack textures, visuals, wearables and attachments
|
||||||
// should be removed; packed appearance contains the full appearance
|
// should be removed; packed appearance contains the full appearance
|
||||||
// This is retained for backward compatibility only
|
// This is retained for backward compatibility only
|
||||||
if (args["texture_entry"] != null)
|
if (args.TryGetValue("texture_entry", out tmp) && tmp != null)
|
||||||
{
|
{
|
||||||
byte[] rawtextures = args["texture_entry"].AsBinary();
|
byte[] rawtextures = tmp.AsBinary();
|
||||||
Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
|
Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
|
||||||
Appearance.SetTextureEntries(textures);
|
Appearance.SetTextureEntries(textures);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args["visual_params"] != null)
|
if (args.TryGetValue("visual_params", out tmp) && tmp != null)
|
||||||
Appearance.SetVisualParams(args["visual_params"].AsBinary());
|
Appearance.SetVisualParams(tmp.AsBinary());
|
||||||
|
|
||||||
if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
|
if (args.TryGetValue("wearables", out tmp) && tmp is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray wears = (OSDArray)(args["wearables"]);
|
OSDArray wears = (OSDArray)tmp;
|
||||||
|
|
||||||
for (int i = 0; i < wears.Count / 2; i++)
|
for (int i = 0; i < wears.Count / 2; i++)
|
||||||
{
|
{
|
||||||
|
@ -798,12 +794,12 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
|
if (args.TryGetValue("attachments", out tmp) && tmp is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray attachs = (OSDArray)(args["attachments"]);
|
OSDArray attachs = (OSDArray)tmp;
|
||||||
foreach (OSD o in attachs)
|
foreach (OSD o in attachs)
|
||||||
{
|
{
|
||||||
if (o.Type == OSDType.Map)
|
if (o is OSDMap)
|
||||||
{
|
{
|
||||||
// We know all of these must end up as attachments so we
|
// We know all of these must end up as attachments so we
|
||||||
// append rather than replace to ensure multiple attachments
|
// append rather than replace to ensure multiple attachments
|
||||||
|
@ -816,35 +812,35 @@ namespace OpenSim.Framework
|
||||||
// end of code to remove
|
// end of code to remove
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
|
if (args.TryGetValue("controllers", out tmp) && tmp is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray controls = (OSDArray)(args["controllers"]);
|
OSDArray controls = (OSDArray)tmp;
|
||||||
Controllers = new ControllerData[controls.Count];
|
Controllers = new ControllerData[controls.Count];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (OSD o in controls)
|
foreach (OSD o in controls)
|
||||||
{
|
{
|
||||||
if (o.Type == OSDType.Map)
|
if (o is OSDMap)
|
||||||
{
|
{
|
||||||
Controllers[i++] = new ControllerData((OSDMap)o);
|
Controllers[i++] = new ControllerData((OSDMap)o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args["callback_uri"] != null)
|
if (args.TryGetValue("callback_uri", out tmp) && tmp != null)
|
||||||
CallbackURI = args["callback_uri"].AsString();
|
CallbackURI = tmp.AsString();
|
||||||
|
|
||||||
if (args["cb_uri"] != null)
|
if (args.TryGetValue("cb_uri", out tmp) && tmp != null)
|
||||||
NewCallbackURI = args["cb_uri"].AsString();
|
NewCallbackURI = tmp.AsString();
|
||||||
|
|
||||||
// Attachment objects
|
// Attachment objects
|
||||||
if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array)
|
if (args.TryGetValue("attach_objects", out tmp) && tmp is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray attObjs = (OSDArray)(args["attach_objects"]);
|
OSDArray attObjs = (OSDArray)tmp;
|
||||||
AttachmentObjects = new List<ISceneObject>();
|
AttachmentObjects = new List<ISceneObject>();
|
||||||
AttachmentObjectStates = new List<string>();
|
AttachmentObjectStates = new List<string>();
|
||||||
foreach (OSD o in attObjs)
|
foreach (OSD o in attObjs)
|
||||||
{
|
{
|
||||||
if (o.Type == OSDType.Map)
|
if (o is OSDMap)
|
||||||
{
|
{
|
||||||
OSDMap info = (OSDMap)o;
|
OSDMap info = (OSDMap)o;
|
||||||
ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
|
ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
|
||||||
|
@ -856,10 +852,10 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args["parent_part"] != null)
|
if (args.TryGetValue("parent_part", out tmp) && tmp != null)
|
||||||
ParentPart = args["parent_part"].AsUUID();
|
ParentPart = tmp.AsUUID();
|
||||||
if (args["sit_offset"] != null)
|
if (args.TryGetValue("sit_offset", out tmp) && tmp != null)
|
||||||
Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset);
|
Vector3.TryParse(tmp.AsString(), out SitOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AgentData()
|
public AgentData()
|
||||||
|
|
Loading…
Reference in New Issue