From e8779cd9e54416349e67d9e5c48b35bab43b69e9 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Thu, 1 Mar 2012 19:22:05 -0800 Subject: In ScenePresence, removed several private variables used to store public parameters. They were only used by the get/set and make code harder to refactor. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 152 +++++++---------------- 1 file changed, 44 insertions(+), 108 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 40c8d06..e982bfe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -341,15 +341,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// Position of agent's camera in world (region cordinates) /// - protected Vector3 m_lastCameraPosition; - - protected Vector3 m_CameraPosition; - - public Vector3 CameraPosition - { - get { return m_CameraPosition; } - private set { m_CameraPosition = value; } - } + protected Vector3 m_lastCameraPosition; + + public Vector3 CameraPosition { get; set; } public Quaternion CameraRotation { @@ -358,29 +352,10 @@ namespace OpenSim.Region.Framework.Scenes // Use these three vectors to figure out what the agent is looking at // Convert it to a Matrix and/or Quaternion - // - protected Vector3 m_CameraAtAxis; - protected Vector3 m_CameraLeftAxis; - protected Vector3 m_CameraUpAxis; - - public Vector3 CameraAtAxis - { - get { return m_CameraAtAxis; } - private set { m_CameraAtAxis = value; } - } - - - public Vector3 CameraLeftAxis - { - get { return m_CameraLeftAxis; } - private set { m_CameraLeftAxis = value; } - } - - public Vector3 CameraUpAxis - { - get { return m_CameraUpAxis; } - private set { m_CameraUpAxis = value; } - } + // + public Vector3 CameraAtAxis { get; set; } + public Vector3 CameraLeftAxis { get; set; } + public Vector3 CameraUpAxis { get; set; } public Vector3 Lookat { @@ -396,33 +371,15 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - public readonly string Firstname; - public readonly string Lastname; - - private string m_grouptitle; - - public string Grouptitle - { - get { return m_grouptitle; } - set { m_grouptitle = value; } - } - - // Agent's Draw distance. - protected float m_DrawDistance; - - public float DrawDistance - { - get { return m_DrawDistance; } - private set { m_DrawDistance = value; } - } - - protected bool m_allowMovement = true; + public string Firstname { get; private set; } + public string Lastname { get; private set; } + + public string Grouptitle { get; set; } - public bool AllowMovement - { - get { return m_allowMovement; } - set { m_allowMovement = value; } - } + // Agent's Draw distance. + public float DrawDistance { get; set; } + + public bool AllowMovement { get; set; } private bool m_setAlwaysRun; @@ -447,15 +404,9 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor.SetAlwaysRun = value; } } - } - - private byte m_state; - - public byte State - { - get { return m_state; } - set { m_state = value; } - } + } + + public byte State { get; set; } private AgentManager.ControlFlags m_AgentControlFlags; @@ -463,31 +414,16 @@ namespace OpenSim.Region.Framework.Scenes { get { return (uint)m_AgentControlFlags; } set { m_AgentControlFlags = (AgentManager.ControlFlags)value; } - } - - /// - /// This works out to be the ClientView object associated with this avatar, or it's client connection manager - /// - private IClientAPI m_controllingClient; - - public IClientAPI ControllingClient - { - get { return m_controllingClient; } - private set { m_controllingClient = value; } - } + } + + public IClientAPI ControllingClient { get; set; } public IClientCore ClientView - { - get { return (IClientCore) m_controllingClient; } - } - - protected Vector3 m_parentPosition; - - public Vector3 ParentPosition - { - get { return m_parentPosition; } - set { m_parentPosition = value; } - } + { + get { return (IClientCore)ControllingClient; } + } + + public Vector3 ParentPosition { get; set; } /// /// Position of this avatar relative to the region the avatar is in @@ -825,18 +761,18 @@ namespace OpenSim.Region.Framework.Scenes private Vector3[] GetWalkDirectionVectors() { - Vector3[] vector = new Vector3[11]; - vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD - vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK + Vector3[] vector = new Vector3[11]; + vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD + vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK vector[2] = Vector3.UnitY; //LEFT - vector[3] = -Vector3.UnitY; //RIGHT - vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP - vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN - vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE - vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE + vector[3] = -Vector3.UnitY; //RIGHT + vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP + vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN + vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE + vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE vector[8] = Vector3.UnitY; //LEFT_NUDGE - vector[9] = -Vector3.UnitY; //RIGHT_NUDGE - vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE + vector[9] = -Vector3.UnitY; //RIGHT_NUDGE + vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE return vector; } @@ -1333,7 +1269,7 @@ namespace OpenSim.Region.Framework.Scenes // Convert it to a Matrix and/or Quaternion CameraAtAxis = agentData.CameraAtAxis; CameraLeftAxis = agentData.CameraLeftAxis; - m_CameraUpAxis = agentData.CameraUpAxis; + CameraUpAxis = agentData.CameraUpAxis; // The Agent's Draw distance setting // When we get to the point of re-computing neighbors everytime this @@ -1343,9 +1279,9 @@ namespace OpenSim.Region.Framework.Scenes DrawDistance = Scene.DefaultDrawDistance; // Check if Client has camera in 'follow cam' or 'build' mode. - Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); - - m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) + Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); + + m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; @@ -3077,8 +3013,8 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Velocity = m_velocity; cAgent.Center = CameraPosition; cAgent.AtAxis = CameraAtAxis; - cAgent.LeftAxis = CameraLeftAxis; - cAgent.UpAxis = m_CameraUpAxis; + cAgent.LeftAxis = CameraLeftAxis; + cAgent.UpAxis = CameraUpAxis; cAgent.Far = DrawDistance; @@ -3163,8 +3099,8 @@ namespace OpenSim.Region.Framework.Scenes m_velocity = cAgent.Velocity; CameraPosition = cAgent.Center; CameraAtAxis = cAgent.AtAxis; - CameraLeftAxis = cAgent.LeftAxis; - m_CameraUpAxis = cAgent.UpAxis; + CameraLeftAxis = cAgent.LeftAxis; + CameraUpAxis = cAgent.UpAxis; // When we get to the point of re-computing neighbors everytime this // changes, then start using the agent's drawdistance rather than the -- cgit v1.1 From 8fccd2b55514a373bf127b49a729d047240c9701 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 1 Mar 2012 19:55:51 -0800 Subject: Send the right name and creation date on the BasicProfileModule. --- .../Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index eb1e4b5..8101ca2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs @@ -150,7 +150,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile string skillsText = String.Empty; string languages = String.Empty; - Byte[] charterMember = Utils.StringToBytes("Avatar"); + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID); + + string name = "Avatar"; + int created = 0; + if (account != null) + { + name = account.FirstName + " " + account.LastName; + created = account.Created; + } + Byte[] charterMember = Utils.StringToBytes(name); profileUrl = "No profile data"; aboutText = string.Empty; @@ -160,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile partner = UUID.Zero; remoteClient.SendAvatarProperties(avatarID, aboutText, - Util.ToDateTime(0).ToString( + Util.ToDateTime(created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture), charterMember, firstLifeAboutText, (uint)(0 & 0xff), -- cgit v1.1