public void CopyFrom(AgentData cAgent)
{
// DEBUG ON
m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM");
// DEBUG OFF
m_originRegionID = cAgent.RegionID;
m_callbackURI = cAgent.CallbackURI;
m_pos = cAgent.Position;
m_velocity = cAgent.Velocity;
m_CameraCenter = cAgent.Center;
m_CameraAtAxis = cAgent.AtAxis;
m_CameraLeftAxis = cAgent.LeftAxis;
m_CameraUpAxis = cAgent.UpAxis;
m_DrawDistance = cAgent.Far;
if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
ControllingClient.SetChildAgentThrottle(cAgent.Throttles);
m_headrotation = cAgent.HeadRotation;
m_bodyRot = cAgent.BodyRotation;
m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags;
if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
m_godLevel = cAgent.GodLevel;
m_setAlwaysRun = cAgent.AlwaysRun;
m_appearance = new AvatarAppearance(cAgent.Appearance);
if (m_physicsActor != null)
{
bool isFlying = m_physicsActor.Flying;
RemoveFromPhysicalScene();
AddToPhysicalScene(isFlying);
}
/*
uint i = 0;
try
{
if (cAgent.Wearables == null)
cAgent.Wearables = new UUID[0];
AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
{
UUID itemId = cAgent.Wearables[n];
UUID assetId = cAgent.Wearables[n + 1];
wears[i++] = new AvatarWearable(itemId, assetId);
}
// m_appearance.Wearables = wears;
Primitive.TextureEntry textures = null;
if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
byte[] visuals = null;
if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
visuals = (byte[])cAgent.VisualParams.Clone();
m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
}
catch (Exception e)
{
m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
}
// Attachments
try
{
if (cAgent.Attachments != null)
{
m_appearance.ClearAttachments();
foreach (AvatarAttachment att in cAgent.Attachments)
{
m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
}
}
}
catch { }
*/
try
{
lock (scriptedcontrols)
{
if (cAgent.Controllers != null)
{
scriptedcontrols.Clear();
foreach (ControllerData c in cAgent.Controllers)
{
ScriptControllers sc = new ScriptControllers();
sc.itemID = c.ItemID;
sc.ignoreControls = (ScriptControlled)c.IgnoreControls;
sc.eventControls = (ScriptControlled)c.EventControls;
scriptedcontrols[sc.itemID] = sc;
}
}
}
}
catch { }
// Animations
try
{
Animator.ResetAnimations();
Animator.Animations.FromArray(cAgent.Anims);
}
catch { }
//cAgent.GroupID = ??
//Groups???
}