From 77b8fb0f86cd0342fa7331f04f56c0b5980290c2 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 5 Oct 2011 22:01:12 -0400 Subject: Added back UserAccount that creates random UUID for new account. This should fix recent issues with 3rd party apps that use the old interface w/o breaking the new one. --- OpenSim/Services/Interfaces/IUserAccountService.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index 20414f6..cadf297 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs @@ -44,6 +44,17 @@ namespace OpenSim.Services.Interfaces PrincipalID = principalID; } + public UserAccount(UUID scopeID, string firstName, string lastName, string email) + { + PrincipalID = UUID.Random(); + ScopeID = scopeID; + FirstName = firstName; + LastName = lastName; + Email = email; + ServiceURLs = new Dictionary(); + Created = Util.UnixTimeSinceEpoch(); + } + public UserAccount(UUID scopeID, UUID principalID, string firstName, string lastName, string email) { PrincipalID = principalID; -- cgit v1.1 From bd9ba904c3e4d9c2c626a7749f19f124b4ddcf15 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Thu, 6 Oct 2011 12:19:31 -0700 Subject: Refactor ScenePresence so gets and sets are through properties. Added private sets when needed. Removed redundant code when methods replicated what the set already does --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 575 ++++++++++++----------- 1 file changed, 288 insertions(+), 287 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b3e04be..0290576 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -100,16 +100,15 @@ namespace OpenSim.Region.Framework.Scenes public UUID currentParcelUUID = UUID.Zero; - private ISceneViewer m_sceneViewer; - + protected ScenePresenceAnimator m_animator; /// /// The animator for this avatar /// public ScenePresenceAnimator Animator { get { return m_animator; } + private set { m_animator = value; } } - protected ScenePresenceAnimator m_animator; /// /// Attachments recorded on this avatar. @@ -137,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes private Vector3 m_lastVelocity; //private int m_lastTerseSent; - private bool m_updateflag; - private byte m_movementflag; private Vector3? m_forceToApply; private TeleportFlags m_teleportFlags; public TeleportFlags TeleportFlags @@ -159,25 +156,11 @@ namespace OpenSim.Region.Framework.Scenes private float m_sitAvatarHeight = 2.0f; - private int m_godLevel; - private int m_userLevel; - - private bool m_invulnerable = true; - private Vector3 m_lastChildAgentUpdatePosition; private Vector3 m_lastChildAgentUpdateCamPosition; private int m_perfMonMS; - private bool m_setAlwaysRun; - - private bool m_forceFly; - private bool m_flyDisabled; - - private float m_speedModifier = 1.0f; - - private Quaternion m_bodyRot = Quaternion.Identity; - private const int LAND_VELOCITYMAG_MAX = 12; public bool IsRestrictedToRegion; @@ -190,22 +173,12 @@ namespace OpenSim.Region.Framework.Scenes private readonly Vector3[] Dir_Vectors = new Vector3[9]; - // Position of agent's camera in world (region cordinates) - protected Vector3 m_CameraCenter; - protected Vector3 m_lastCameraCenter; protected Timer m_reprioritization_timer; protected bool m_reprioritizing; protected bool m_reprioritization_called; - // 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; - private AgentManager.ControlFlags m_AgentControlFlags; private Quaternion m_headrotation = Quaternion.Identity; - private byte m_state; //Reuse the Vector3 instead of creating a new one on the UpdateMovement method // private Vector3 movementvector; @@ -234,11 +207,19 @@ namespace OpenSim.Region.Framework.Scenes //private int m_moveToPositionStateStatus; //***************************************************** - // Agent's Draw distance. - protected float m_DrawDistance; - protected AvatarAppearance m_appearance; + public AvatarAppearance Appearance + { + get { return m_appearance; } + set + { + m_appearance = value; +// m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value); + } + } + + // neighbouring regions we have enabled a child agent in // holds the seed cap for the child agent in that region private Dictionary m_knownChildRegions = new Dictionary(); @@ -250,6 +231,7 @@ namespace OpenSim.Region.Framework.Scenes public List InTransitScriptStates { get { return m_InTransitScriptStates; } + private set { m_InTransitScriptStates = value; } } private List m_InTransitScriptStates = new List(); @@ -278,8 +260,6 @@ namespace OpenSim.Region.Framework.Scenes string m_callbackURI; UUID m_originRegionID; - ulong m_rootRegionHandle; - /// /// Script engines present in the scene /// @@ -287,6 +267,8 @@ namespace OpenSim.Region.Framework.Scenes #region Properties + protected PhysicsActor m_physicsActor; + /// /// Physical scene representation of this Avatar. /// @@ -296,69 +278,102 @@ namespace OpenSim.Region.Framework.Scenes get { return m_physicsActor; } } + private byte m_movementflag; + public byte MovementFlag { set { m_movementflag = value; } get { return m_movementflag; } } + private bool m_updateflag; + public bool Updated { set { m_updateflag = value; } get { return m_updateflag; } } + private bool m_invulnerable = true; + public bool Invulnerable { set { m_invulnerable = value; } get { return m_invulnerable; } } + private int m_userLevel; + public int UserLevel { get { return m_userLevel; } + private set { m_userLevel = value; } } + private int m_godLevel; + public int GodLevel { get { return m_godLevel; } + private set { m_godLevel = value; } } + private ulong m_rootRegionHandle; + public ulong RegionHandle { get { return m_rootRegionHandle; } + private set { m_rootRegionHandle = value; } } + #region Client Camera + // Position of agent's camera in world (region cordinates) + protected Vector3 m_lastCameraPosition; + + protected Vector3 m_CameraPosition; + public Vector3 CameraPosition { - get { return m_CameraCenter; } + get { return m_CameraPosition; } + private set { m_CameraPosition = value; } } public Quaternion CameraRotation { - get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); } + get { return Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); } } + // 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 Lookat { get { - Vector3 a = new Vector3(m_CameraAtAxis.X, m_CameraAtAxis.Y, 0); + Vector3 a = new Vector3(CameraAtAxis.X, CameraAtAxis.Y, 0); if (a == Vector3.Zero) return a; @@ -366,20 +381,10 @@ namespace OpenSim.Region.Framework.Scenes return Util.GetNormalizedVector(a); } } + #endregion - private readonly string m_firstname; - - public string Firstname - { - get { return m_firstname; } - } - - private readonly string m_lastname; - - public string Lastname - { - get { return m_lastname; } - } + public readonly string Firstname; + public readonly string Lastname; private string m_grouptitle; @@ -389,9 +394,13 @@ namespace OpenSim.Region.Framework.Scenes 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; @@ -402,6 +411,8 @@ namespace OpenSim.Region.Framework.Scenes set { m_allowMovement = value; } } + private bool m_setAlwaysRun; + public bool SetAlwaysRun { get @@ -425,12 +436,16 @@ namespace OpenSim.Region.Framework.Scenes } } + private byte m_state; + public byte State { get { return m_state; } set { m_state = value; } } + private AgentManager.ControlFlags m_AgentControlFlags; + public uint AgentControlFlags { get { return (uint)m_AgentControlFlags; } @@ -442,11 +457,10 @@ namespace OpenSim.Region.Framework.Scenes /// private IClientAPI m_controllingClient; - protected PhysicsActor m_physicsActor; - public IClientAPI ControllingClient { get { return m_controllingClient; } + private set { m_controllingClient = value; } } public IClientCore ClientView @@ -455,6 +469,7 @@ namespace OpenSim.Region.Framework.Scenes } protected Vector3 m_parentPosition; + public Vector3 ParentPosition { get { return m_parentPosition; } @@ -468,10 +483,9 @@ namespace OpenSim.Region.Framework.Scenes { get { - PhysicsActor actor = m_physicsActor; - if (actor != null) + if (PhysicsActor != null) { - m_pos = actor.Position; + m_pos = PhysicsActor.Position; // m_log.DebugFormat( // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", @@ -484,7 +498,7 @@ namespace OpenSim.Region.Framework.Scenes // the avatar is seated, this value will also // be used as the location to unsit to. // - // If m_parentID is not 0, assume we are a seated avatar + // If ParentID is not 0, assume we are a seated avatar // and we should return the position based on the sittarget // offset and rotation of the prim we are seated on. // @@ -492,16 +506,16 @@ namespace OpenSim.Region.Framework.Scenes // in the sim unless the avatar is on a sit target. While // on a sit target, m_pos will contain the desired offset // without the parent rotation applied. - if (m_parentID != 0) + if (ParentID != 0) { - SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); + SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); if (part != null) { - return m_parentPosition + (m_pos * part.GetWorldRotation()); + return ParentPosition + (m_pos * part.GetWorldRotation()); } else { - return m_parentPosition + m_pos; + return ParentPosition + m_pos; } } } @@ -510,13 +524,12 @@ namespace OpenSim.Region.Framework.Scenes } set { - PhysicsActor actor = m_physicsActor; - if (actor != null) + if (PhysicsActor != null) { try { lock (m_scene.SyncRoot) - m_physicsActor.Position = value; + PhysicsActor.Position = value; } catch (Exception e) { @@ -525,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes } m_pos = value; - m_parentPosition = Vector3.Zero; + ParentPosition = Vector3.Zero; // m_log.DebugFormat( // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", @@ -549,10 +562,9 @@ namespace OpenSim.Region.Framework.Scenes { get { - PhysicsActor actor = m_physicsActor; - if (actor != null) + if (PhysicsActor != null) { - m_velocity = actor.Velocity; + m_velocity = PhysicsActor.Velocity; // m_log.DebugFormat( // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", @@ -563,13 +575,12 @@ namespace OpenSim.Region.Framework.Scenes } set { - PhysicsActor actor = m_physicsActor; - if (actor != null) + if (PhysicsActor != null) { try { lock (m_scene.SyncRoot) - actor.Velocity = value; + PhysicsActor.Velocity = value; } catch (Exception e) { @@ -585,6 +596,8 @@ namespace OpenSim.Region.Framework.Scenes } } + private Quaternion m_bodyRot = Quaternion.Identity; + public Quaternion Rotation { get { return m_bodyRot; } @@ -645,9 +658,12 @@ namespace OpenSim.Region.Framework.Scenes } } + private ISceneViewer m_sceneViewer; + public ISceneViewer SceneViewer { get { return m_sceneViewer; } + private set { m_sceneViewer = value; } } public void AdjustKnownSeeds() @@ -694,28 +710,35 @@ namespace OpenSim.Region.Framework.Scenes } } - private bool m_inTransit; private bool m_mouseLook; private bool m_leftButtonDown; + private bool m_inTransit; + public bool IsInTransit { get { return m_inTransit; } - set { m_inTransit = value; } + private set { m_inTransit = value; } } + private float m_speedModifier = 1.0f; + public float SpeedModifier { get { return m_speedModifier; } set { m_speedModifier = value; } } + private bool m_forceFly; + public bool ForceFly { get { return m_forceFly; } set { m_forceFly = value; } } + private bool m_flyDisabled; + public bool FlyDisabled { get { return m_flyDisabled; } @@ -737,15 +760,15 @@ namespace OpenSim.Region.Framework.Scenes AttachmentsSyncLock = new Object(); m_sendCourseLocationsMethod = SendCoarseLocationsDefault; - m_sceneViewer = new SceneViewer(this); - m_animator = new ScenePresenceAnimator(this); + SceneViewer = new SceneViewer(this); + Animator = new ScenePresenceAnimator(this); PresenceType = type; - m_DrawDistance = world.DefaultDrawDistance; - m_rootRegionHandle = world.RegionInfo.RegionHandle; - m_controllingClient = client; - m_firstname = m_controllingClient.FirstName; - m_lastname = m_controllingClient.LastName; - m_name = String.Format("{0} {1}", m_firstname, m_lastname); + DrawDistance = world.DefaultDrawDistance; + RegionHandle = world.RegionInfo.RegionHandle; + ControllingClient = client; + Firstname = ControllingClient.FirstName; + Lastname = ControllingClient.LastName; + m_name = String.Format("{0} {1}", Firstname, Lastname); m_scene = world; m_uuid = client.AgentId; m_localId = m_scene.AllocateLocalId(); @@ -753,16 +776,16 @@ namespace OpenSim.Region.Framework.Scenes UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); if (account != null) - m_userLevel = account.UserLevel; + UserLevel = account.UserLevel; IGroupsModule gm = m_scene.RequestModuleInterface(); if (gm != null) - m_grouptitle = gm.GetGroupTitle(m_uuid); + Grouptitle = gm.GetGroupTitle(m_uuid); m_scriptEngines = m_scene.RequestModuleInterfaces(); - AbsolutePosition = posLastSignificantMove = m_CameraCenter = - m_lastCameraCenter = m_controllingClient.StartPos; + AbsolutePosition = posLastSignificantMove = CameraPosition = + m_lastCameraPosition = ControllingClient.StartPos; m_reprioritization_timer = new Timer(world.ReprioritizationInterval); m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); @@ -785,21 +808,21 @@ namespace OpenSim.Region.Framework.Scenes RegisterToEvents(); SetDirectionVectors(); - m_appearance = appearance; + Appearance = appearance; } public void RegisterToEvents() { - m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; - //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; - m_controllingClient.OnAgentUpdate += HandleAgentUpdate; - m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; - m_controllingClient.OnAgentSit += HandleAgentSit; - m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; - m_controllingClient.OnStartAnim += HandleStartAnim; - m_controllingClient.OnStopAnim += HandleStopAnim; - m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; - m_controllingClient.OnAutoPilotGo += MoveToTarget; + ControllingClient.OnCompleteMovementToRegion += CompleteMovement; + //ControllingClient.OnCompleteMovementToRegion += SendInitialData; + ControllingClient.OnAgentUpdate += HandleAgentUpdate; + ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; + ControllingClient.OnAgentSit += HandleAgentSit; + ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; + ControllingClient.OnStartAnim += HandleStartAnim; + ControllingClient.OnStopAnim += HandleStopAnim; + ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; + ControllingClient.OnAutoPilotGo += MoveToTarget; // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); @@ -821,15 +844,15 @@ namespace OpenSim.Region.Framework.Scenes private Vector3[] GetWalkDirectionVectors() { Vector3[] vector = new Vector3[9]; - vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD - vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK + vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD + vector[1] = new Vector3(-m_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[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge - vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z) * 2); //FORWARD Nudge - vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK Nudge + vector[4] = new Vector3(CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP + vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN + vector[8] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge + vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z) * 2); //FORWARD Nudge + vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK Nudge return vector; } @@ -849,7 +872,7 @@ namespace OpenSim.Region.Framework.Scenes { m_perfMonMS = Util.EnvironmentTickCount(); - m_sceneViewer.SendPrimUpdates(); + SceneViewer.SendPrimUpdates(); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } @@ -869,21 +892,21 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); - bool wasChild = m_isChildAgent; - m_isChildAgent = false; + bool wasChild = IsChildAgent; + IsChildAgent = false; IGroupsModule gm = m_scene.RequestModuleInterface(); if (gm != null) - m_grouptitle = gm.GetGroupTitle(m_uuid); + Grouptitle = gm.GetGroupTitle(m_uuid); - m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; + RegionHandle = m_scene.RegionInfo.RegionHandle; m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); - // Moved this from SendInitialData to ensure that m_appearance is initialized + // Moved this from SendInitialData to ensure that Appearance is initialized // before the inventory is processed in MakeRootAgent. This fixes a race condition // related to the handling of attachments - //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); + //m_scene.GetAvatarAppearance(ControllingClient, out Appearance); if (m_scene.TestBorderCross(pos, Cardinals.E)) { Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); @@ -908,8 +931,8 @@ namespace OpenSim.Region.Framework.Scenes } float localAVHeight = 1.56f; - if (m_appearance.AvatarHeight > 0) - localAVHeight = m_appearance.AvatarHeight; + if (Appearance.AvatarHeight > 0) + localAVHeight = Appearance.AvatarHeight; float posZLimit = 0; @@ -925,13 +948,13 @@ namespace OpenSim.Region.Framework.Scenes AddToPhysicalScene(isFlying); - if (m_forceFly) + if (ForceFly) { - m_physicsActor.Flying = true; + PhysicsActor.Flying = true; } - else if (m_flyDisabled) + else if (FlyDisabled) { - m_physicsActor.Flying = false; + PhysicsActor.Flying = false; } // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying @@ -969,7 +992,7 @@ namespace OpenSim.Region.Framework.Scenes // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will // stall on the border crossing since the existing child agent will still have the last movement // recorded, which stops the input from being processed. - m_movementflag = 0; + MovementFlag = 0; m_scene.EventManager.TriggerOnMakeRootAgent(this); } @@ -999,12 +1022,12 @@ namespace OpenSim.Region.Framework.Scenes { // Reset these so that teleporting in and walking out isn't seen // as teleporting back - m_teleportFlags = TeleportFlags.Default; + TeleportFlags = TeleportFlags.Default; - // It looks like m_animator is set to null somewhere, and MakeChild + // It looks like Animator is set to null somewhere, and MakeChild // is called after that. Probably in aborted teleports. - if (m_animator == null) - m_animator = new ScenePresenceAnimator(this); + if (Animator == null) + Animator = new ScenePresenceAnimator(this); else Animator.ResetAnimations(); @@ -1016,11 +1039,11 @@ namespace OpenSim.Region.Framework.Scenes // depending on the exact timing. This shouldn't matter anyway since child agent positions are not updated. //Velocity = new Vector3(0, 0, 0); - m_isChildAgent = true; + IsChildAgent = true; m_scene.SwapRootAgentCount(true); RemoveFromPhysicalScene(); - // FIXME: Set m_rootRegionHandle to the region handle of the scene this agent is moving into + // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into m_scene.EventManager.TriggerOnMakeChildAgent(this); } @@ -1032,11 +1055,11 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysicsActor != null) { - m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; - m_physicsActor.OnOutOfBounds -= OutOfBoundsCall; + PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; + PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); - m_physicsActor.UnSubscribeEvents(); - m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; + PhysicsActor.UnSubscribeEvents(); + PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; PhysicsActor = null; } } @@ -1048,8 +1071,8 @@ namespace OpenSim.Region.Framework.Scenes public void Teleport(Vector3 pos) { bool isFlying = false; - if (m_physicsActor != null) - isFlying = m_physicsActor.Flying; + if (PhysicsActor != null) + isFlying = PhysicsActor.Flying; RemoveFromPhysicalScene(); Velocity = Vector3.Zero; @@ -1062,8 +1085,8 @@ namespace OpenSim.Region.Framework.Scenes public void TeleportWithMomentum(Vector3 pos) { bool isFlying = false; - if (m_physicsActor != null) - isFlying = m_physicsActor.Flying; + if (PhysicsActor != null) + isFlying = PhysicsActor.Flying; RemoveFromPhysicalScene(); AbsolutePosition = pos; @@ -1178,11 +1201,11 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); - m_controllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); + ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); SendInitialData(); // Create child agents in neighbouring regions - if (openChildAgents && !m_isChildAgent) + if (openChildAgents && !IsChildAgent) { IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) @@ -1226,7 +1249,7 @@ namespace OpenSim.Region.Framework.Scenes { if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || - !m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) + !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) { if (CameraConstraintActive) { @@ -1247,7 +1270,7 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: In {0} received agent update from {1}", // Scene.RegionInfo.RegionName, remoteClient.Name); - //if (m_isChildAgent) + //if (IsChildAgent) //{ // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); // return; @@ -1291,28 +1314,28 @@ namespace OpenSim.Region.Framework.Scenes // Camera location in world. We'll need to raytrace // from this location from time to time. - m_CameraCenter = agentData.CameraCenter; - if (Vector3.Distance(m_lastCameraCenter, m_CameraCenter) >= Scene.RootReprioritizationDistance) + CameraPosition = agentData.CameraCenter; + if (Vector3.Distance(m_lastCameraPosition, CameraPosition) >= Scene.RootReprioritizationDistance) { ReprioritizeUpdates(); - m_lastCameraCenter = m_CameraCenter; + m_lastCameraPosition = CameraPosition; } // Use these three vectors to figure out what the agent is looking at // Convert it to a Matrix and/or Quaternion - m_CameraAtAxis = agentData.CameraAtAxis; - m_CameraLeftAxis = agentData.CameraLeftAxis; + CameraAtAxis = agentData.CameraAtAxis; + CameraLeftAxis = agentData.CameraLeftAxis; m_CameraUpAxis = agentData.CameraUpAxis; // The Agent's Draw distance setting // When we get to the point of re-computing neighbors everytime this // changes, then start using the agent's drawdistance rather than the // region's draw distance. - // m_DrawDistance = agentData.Far; - m_DrawDistance = Scene.DefaultDrawDistance; + // DrawDistance = agentData.Far; + DrawDistance = Scene.DefaultDrawDistance; // Check if Client has camera in 'follow cam' or 'build' mode. - Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); + Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; @@ -1334,7 +1357,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_followCamAuto) { Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; - m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback); + m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); } } @@ -1363,7 +1386,7 @@ namespace OpenSim.Region.Framework.Scenes // Here's where you get them. m_AgentControlFlags = flags; m_headrotation = agentData.HeadRotation; - m_state = agentData.State; + State = agentData.State; PhysicsActor actor = PhysicsActor; if (actor == null) @@ -1371,12 +1394,12 @@ namespace OpenSim.Region.Framework.Scenes return; } - if (m_allowMovement && !SitGround) + if (AllowMovement && !SitGround) { Quaternion bodyRotation = agentData.BodyRotation; bool update_rotation = false; - if (bodyRotation != m_bodyRot) + if (bodyRotation != Rotation) { Rotation = bodyRotation; update_rotation = true; @@ -1396,9 +1419,9 @@ namespace OpenSim.Region.Framework.Scenes bool oldflying = PhysicsActor.Flying; - if (m_forceFly) + if (ForceFly) actor.Flying = true; - else if (m_flyDisabled) + else if (FlyDisabled) actor.Flying = false; else actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); @@ -1406,7 +1429,7 @@ namespace OpenSim.Region.Framework.Scenes if (actor.Flying != oldflying) update_movementflag = true; - if (m_parentID == 0) + if (ParentID == 0) { bool bAllowUpdateMoveToPosition = false; @@ -1414,12 +1437,12 @@ namespace OpenSim.Region.Framework.Scenes // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying // this prevents 'jumping' in inappropriate situations. - if ((m_mouseLook && !m_physicsActor.Flying) || (m_leftButtonDown && !m_physicsActor.Flying)) + if ((m_mouseLook && !PhysicsActor.Flying) || (m_leftButtonDown && !PhysicsActor.Flying)) dirVectors = GetWalkDirectionVectors(); else dirVectors = Dir_Vectors; - // The fact that m_movementflag is a byte needs to be fixed + // The fact that MovementFlag is a byte needs to be fixed // it really should be a uint // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. uint nudgehack = 250; @@ -1439,32 +1462,32 @@ namespace OpenSim.Region.Framework.Scenes // Why did I get this? } - if ((m_movementflag & (byte)(uint)DCF) == 0) + if ((MovementFlag & (byte)(uint)DCF) == 0) { if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) { - m_movementflag |= (byte)nudgehack; + MovementFlag |= (byte)nudgehack; } -// m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with {1}", Name, DCF); - m_movementflag += (byte)(uint)DCF; +// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); + MovementFlag += (byte)(uint)DCF; update_movementflag = true; } } else { - if ((m_movementflag & (byte)(uint)DCF) != 0 || + if ((MovementFlag & (byte)(uint)DCF) != 0 || ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) - && ((m_movementflag & (byte)nudgehack) == nudgehack)) + && ((MovementFlag & (byte)nudgehack) == nudgehack)) ) // This or is for Nudge forward { -// m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with lack of {1}", Name, DCF); - m_movementflag -= ((byte)(uint)DCF); +// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); + MovementFlag -= ((byte)(uint)DCF); update_movementflag = true; /* if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) - && ((m_movementflag & (byte)nudgehack) == nudgehack)) + && ((MovementFlag & (byte)nudgehack) == nudgehack)) { m_log.Debug("Removed Hack flag"); } @@ -1499,7 +1522,7 @@ namespace OpenSim.Region.Framework.Scenes // with something with the down arrow pressed. // Only do this if we're flying - if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) + if (PhysicsActor != null && PhysicsActor.Flying && !ForceFly) { // Landing detection code @@ -1507,10 +1530,7 @@ namespace OpenSim.Region.Framework.Scenes bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); - // Are the collision requirements fulfilled? - bool colliding = (m_physicsActor.IsColliding == true); - - if (m_physicsActor.Flying && colliding && controlland) + if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) { // nesting this check because LengthSquared() is expensive and we don't // want to do it every step when flying. @@ -1539,7 +1559,7 @@ namespace OpenSim.Region.Framework.Scenes // } // } - if (update_movementflag && m_parentID == 0) + if (update_movementflag && ParentID == 0) Animator.UpdateMovementAnimations(); } @@ -1620,26 +1640,26 @@ namespace OpenSim.Region.Framework.Scenes // one of left/right/back/forward. if (LocalVectorToTarget3D.X < 0) //MoveBack { - m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; + MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; updated = true; } else if (LocalVectorToTarget3D.X > 0) //Move Forward { - m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; + MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; updated = true; } if (LocalVectorToTarget3D.Y > 0) //MoveLeft { - m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; + MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; updated = true; } else if (LocalVectorToTarget3D.Y < 0) //MoveRight { - m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; + MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; updated = true; } @@ -1648,14 +1668,14 @@ namespace OpenSim.Region.Framework.Scenes { // Don't set these flags for up or down - doing so will make the avatar crouch or // keep trying to jump even if walking along level ground - //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; + //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; //AgentControlFlags //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; updated = true; } else if (LocalVectorToTarget3D.Z < 0) //Down { - //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; + //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; updated = true; } @@ -1818,10 +1838,10 @@ namespace OpenSim.Region.Framework.Scenes { SitGround = false; - if (m_parentID != 0) + if (ParentID != 0) { m_log.Debug("StandupCode Executed"); - SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); + SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); if (part != null) { TaskInventoryDictionary taskIDict = part.TaskInventory; @@ -1844,19 +1864,19 @@ namespace OpenSim.Region.Framework.Scenes part.SitTargetAvatar = UUID.Zero; part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); - m_parentPosition = part.GetWorldPosition(); + ParentPosition = part.GetWorldPosition(); ControllingClient.SendClearFollowCamProperties(part.ParentUUID); } - if (m_physicsActor == null) + if (PhysicsActor == null) { AddToPhysicalScene(false); } - m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); - m_parentPosition = Vector3.Zero; + m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); + ParentPosition = Vector3.Zero; - m_parentID = 0; + ParentID = 0; SendAvatarDataToAllAgents(); m_requestedSitTargetID = 0; } @@ -1954,11 +1974,11 @@ namespace OpenSim.Region.Framework.Scenes // offset = pos; //autopilot = false; //} - if (m_physicsActor != null) + if (PhysicsActor != null) { // If we're not using the client autopilot, we're immediately warping the avatar to the location // We can remove the physicsActor until they stand up. - m_sitAvatarHeight = m_physicsActor.Size.Z; + m_sitAvatarHeight = PhysicsActor.Size.Z; if (autopilot) { @@ -1997,7 +2017,7 @@ namespace OpenSim.Region.Framework.Scenes // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) { - if (m_parentID != 0) + if (ParentID != 0) { StandUp(); } @@ -2266,16 +2286,16 @@ namespace OpenSim.Region.Framework.Scenes m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); m_pos += SIT_TARGET_ADJUSTMENT; - m_bodyRot = sitTargetOrient; + Rotation = sitTargetOrient; //Rotation = sitTargetOrient; - m_parentPosition = part.AbsolutePosition; + ParentPosition = part.AbsolutePosition; //SendTerseUpdateToAllClients(); } else { m_pos -= part.AbsolutePosition; - m_parentPosition = part.AbsolutePosition; + ParentPosition = part.AbsolutePosition; } } else @@ -2283,7 +2303,7 @@ namespace OpenSim.Region.Framework.Scenes return; } } - m_parentID = m_requestedSitTargetID; + ParentID = m_requestedSitTargetID; Velocity = Vector3.Zero; RemoveFromPhysicalScene(); @@ -2302,11 +2322,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void HandleSetAlwaysRun(IClientAPI remoteClient, bool pSetAlwaysRun) { - m_setAlwaysRun = pSetAlwaysRun; - if (PhysicsActor != null) - { - PhysicsActor.SetAlwaysRun = pSetAlwaysRun; - } + SetAlwaysRun = pSetAlwaysRun; } public void HandleStartAnim(IClientAPI remoteClient, UUID animID) @@ -2330,27 +2346,25 @@ namespace OpenSim.Region.Framework.Scenes Vector3 direc = vec * Rotation; direc.Normalize(); - direc *= 0.03f * 128f * m_speedModifier; + direc *= 0.03f * 128f * SpeedModifier; - PhysicsActor actor = m_physicsActor; - if (actor != null) + if (PhysicsActor != null) { - if (actor.Flying) + if (PhysicsActor.Flying) { direc *= 4.0f; //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); - //bool colliding = (m_physicsActor.IsColliding==true); //if (controlland) // m_log.Info("[AGENT]: landCommand"); - //if (colliding) + //if (PhysicsActor.IsColliding) // m_log.Info("[AGENT]: colliding"); - //if (m_physicsActor.Flying && colliding && controlland) + //if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) //{ // StopFlying(); - // m_log.Info("[AGENT]: Stop FLying"); + // m_log.Info("[AGENT]: Stop Flying"); //} } - else if (!actor.Flying && actor.IsColliding) + else if (!PhysicsActor.Flying && PhysicsActor.IsColliding) { if (direc.Z > 2.0f) { @@ -2385,16 +2399,14 @@ namespace OpenSim.Region.Framework.Scenes if (!sendingPrims) Util.FireAndForget(delegate { sendingPrims = true; SendPrimUpdates(); sendingPrims = false; }); - if (m_isChildAgent == false) + if (IsChildAgent == false) { -// PhysicsActor actor = m_physicsActor; - // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to // grab the latest PhysicsActor velocity, whereas m_velocity is often // storing a requested force instead of an actual traveling velocity // Throw away duplicate or insignificant updates - if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || + if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) //Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) @@ -2403,13 +2415,13 @@ namespace OpenSim.Region.Framework.Scenes // Update the "last" values m_lastPosition = m_pos; - m_lastRotation = m_bodyRot; + m_lastRotation = Rotation; m_lastVelocity = Velocity; //m_lastTerseSent = Environment.TickCount; } // followed suggestion from mic bowman. reversed the two lines below. - if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something + if (ParentID == 0 && PhysicsActor != null || ParentID != 0) // Check that we have a physics actor or we're sitting on something CheckForBorderCrossing(); CheckForSignificantMovement(); // sends update to the modules. @@ -2434,9 +2446,9 @@ namespace OpenSim.Region.Framework.Scenes m_perfMonMS = Util.EnvironmentTickCount(); Vector3 pos = m_pos; - pos.Z += m_appearance.HipOffset; + pos.Z += Appearance.HipOffset; - //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); + //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); remoteClient.SendPrimUpdate( this, @@ -2513,7 +2525,7 @@ namespace OpenSim.Region.Framework.Scenes public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List coarseLocations, List avatarUUIDs) { m_perfMonMS = Util.EnvironmentTickCount(); - m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); + ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } @@ -2524,21 +2536,21 @@ namespace OpenSim.Region.Framework.Scenes private void SendInitialData() { //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); - // Moved this into CompleteMovement to ensure that m_appearance is initialized before + // Moved this into CompleteMovement to ensure that Appearance is initialized before // the inventory arrives - // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); + // m_scene.GetAvatarAppearance(ControllingClient, out Appearance); bool cachedappearance = false; // We have an appearance but we may not have the baked textures. Check the asset cache // to see if all the baked textures are already here. if (m_scene.AvatarFactory != null) - cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); + cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(ControllingClient); // If we aren't using a cached appearance, then clear out the baked textures if (!cachedappearance) { - m_appearance.ResetAppearance(); + Appearance.ResetAppearance(); if (m_scene.AvatarFactory != null) m_scene.AvatarFactory.QueueAppearanceSave(UUID); } @@ -2697,17 +2709,7 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); avatar.ControllingClient.SendAppearance( - UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); - } - - public AvatarAppearance Appearance - { - get { return m_appearance; } - set - { - m_appearance = value; -// m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value); - } + UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); } #endregion @@ -2735,14 +2737,13 @@ namespace OpenSim.Region.Framework.Scenes ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); cadu.ActiveGroupID = UUID.Zero.Guid; cadu.AgentID = UUID.Guid; - cadu.alwaysrun = m_setAlwaysRun; - cadu.AVHeight = m_appearance.AvatarHeight; - Vector3 tempCameraCenter = m_CameraCenter; - cadu.cameraPosition = tempCameraCenter; - cadu.drawdistance = m_DrawDistance; + cadu.alwaysrun = SetAlwaysRun; + cadu.AVHeight = Appearance.AvatarHeight; + cadu.cameraPosition = CameraPosition; + cadu.drawdistance = DrawDistance; cadu.GroupAccess = 0; cadu.Position = AbsolutePosition; - cadu.regionHandle = m_rootRegionHandle; + cadu.regionHandle = RegionHandle; // Throttles float multiplier = 1; @@ -2848,7 +2849,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_requestedSitTargetUUID == UUID.Zero) { - bool isFlying = m_physicsActor.Flying; + bool isFlying = PhysicsActor.Flying; RemoveFromPhysicalScene(); Vector3 pos = AbsolutePosition; @@ -2873,7 +2874,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_requestedSitTargetUUID == UUID.Zero) { - bool isFlying = m_physicsActor.Flying; + bool isFlying = PhysicsActor.Flying; RemoveFromPhysicalScene(); Vector3 pos = AbsolutePosition; @@ -2963,7 +2964,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - return m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); + return m_scene.CrossAgentToNewRegion(this, PhysicsActor.Flying); } catch { @@ -2973,9 +2974,9 @@ namespace OpenSim.Region.Framework.Scenes public void InTransit() { - m_inTransit = true; + IsInTransit = true; - if ((m_physicsActor != null) && m_physicsActor.Flying) + if ((PhysicsActor != null) && PhysicsActor.Flying) m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; @@ -2983,7 +2984,7 @@ namespace OpenSim.Region.Framework.Scenes public void NotInTransit() { - m_inTransit = false; + IsInTransit = false; } public void RestoreInCurrentScene() @@ -3039,7 +3040,7 @@ namespace OpenSim.Region.Framework.Scenes if (byebyeRegions.Count > 0) { m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); - m_scene.SceneGridService.SendCloseChildAgentConnections(m_controllingClient.AgentId, byebyeRegions); + m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); } foreach (ulong handle in byebyeRegions) @@ -3065,17 +3066,17 @@ namespace OpenSim.Region.Framework.Scenes if (account != null) { if (account.UserLevel > 0) - m_godLevel = account.UserLevel; + GodLevel = account.UserLevel; else - m_godLevel = 200; + GodLevel = 200; } } else { - m_godLevel = 0; + GodLevel = 0; } - ControllingClient.SendAdminResponse(token, (uint)m_godLevel); + ControllingClient.SendAdminResponse(token, (uint)GodLevel); } #region Child Agent Updates @@ -3107,8 +3108,8 @@ namespace OpenSim.Region.Framework.Scenes // When we get to the point of re-computing neighbors everytime this // changes, then start using the agent's drawdistance rather than the // region's draw distance. - // m_DrawDistance = cAgentData.Far; - m_DrawDistance = Scene.DefaultDrawDistance; + // DrawDistance = cAgentData.Far; + DrawDistance = Scene.DefaultDrawDistance; if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! m_pos = cAgentData.Position + offset; @@ -3119,7 +3120,7 @@ namespace OpenSim.Region.Framework.Scenes ReprioritizeUpdates(); } - m_CameraCenter = cAgentData.Center + offset; + CameraPosition = cAgentData.Center + offset; //SetHeight(cAgentData.AVHeight); @@ -3127,7 +3128,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); //cAgentData.AVHeight; - m_rootRegionHandle = cAgentData.RegionHandle; + RegionHandle = cAgentData.RegionHandle; //m_velocity = cAgentData.Velocity; } @@ -3140,12 +3141,12 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Position = AbsolutePosition; cAgent.Velocity = m_velocity; - cAgent.Center = m_CameraCenter; - cAgent.AtAxis = m_CameraAtAxis; - cAgent.LeftAxis = m_CameraLeftAxis; + cAgent.Center = CameraPosition; + cAgent.AtAxis = CameraAtAxis; + cAgent.LeftAxis = CameraLeftAxis; cAgent.UpAxis = m_CameraUpAxis; - cAgent.Far = m_DrawDistance; + cAgent.Far = DrawDistance; // Throttles float multiplier = 1; @@ -3160,17 +3161,17 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); cAgent.HeadRotation = m_headrotation; - cAgent.BodyRotation = m_bodyRot; + cAgent.BodyRotation = Rotation; cAgent.ControlFlags = (uint)m_AgentControlFlags; if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) - cAgent.GodLevel = (byte)m_godLevel; + cAgent.GodLevel = (byte)GodLevel; else cAgent.GodLevel = (byte) 0; - cAgent.AlwaysRun = m_setAlwaysRun; + cAgent.AlwaysRun = SetAlwaysRun; - cAgent.Appearance = new AvatarAppearance(m_appearance); + cAgent.Appearance = new AvatarAppearance(Appearance); lock (scriptedcontrols) { @@ -3199,7 +3200,7 @@ namespace OpenSim.Region.Framework.Scenes cAgent.AttachmentObjects = new List(); cAgent.AttachmentObjectStates = new List(); // IScriptModule se = m_scene.RequestModuleInterface(); - m_InTransitScriptStates.Clear(); + InTransitScriptStates.Clear(); foreach (SceneObjectGroup sog in m_attachments) { @@ -3212,7 +3213,7 @@ namespace OpenSim.Region.Framework.Scenes cAgent.AttachmentObjects.Add(clone); string state = sog.GetStateSnapshot(); cAgent.AttachmentObjectStates.Add(state); - m_InTransitScriptStates.Add(state); + InTransitScriptStates.Add(state); // Let's remove the scripts of the original object here sog.RemoveScriptInstances(true); } @@ -3228,32 +3229,32 @@ namespace OpenSim.Region.Framework.Scenes m_pos = cAgent.Position; m_velocity = cAgent.Velocity; - m_CameraCenter = cAgent.Center; - m_CameraAtAxis = cAgent.AtAxis; - m_CameraLeftAxis = cAgent.LeftAxis; + CameraPosition = cAgent.Center; + CameraAtAxis = cAgent.AtAxis; + CameraLeftAxis = cAgent.LeftAxis; m_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 // region's draw distance. - // m_DrawDistance = cAgent.Far; - m_DrawDistance = Scene.DefaultDrawDistance; + // DrawDistance = cAgent.Far; + DrawDistance = Scene.DefaultDrawDistance; if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) ControllingClient.SetChildAgentThrottle(cAgent.Throttles); m_headrotation = cAgent.HeadRotation; - m_bodyRot = cAgent.BodyRotation; + Rotation = 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; + GodLevel = cAgent.GodLevel; + SetAlwaysRun = cAgent.AlwaysRun; - m_appearance = new AvatarAppearance(cAgent.Appearance); - if (m_physicsActor != null) + Appearance = new AvatarAppearance(cAgent.Appearance); + if (PhysicsActor != null) { - bool isFlying = m_physicsActor.Flying; + bool isFlying = PhysicsActor.Flying; RemoveFromPhysicalScene(); AddToPhysicalScene(isFlying); } @@ -3319,7 +3320,7 @@ namespace OpenSim.Region.Framework.Scenes { Vector3 force = m_forceToApply.Value; - m_updateflag = true; + Updated = true; Velocity = force; @@ -3336,30 +3337,30 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", // Name, isFlying, Scene.RegionInfo.RegionName); - if (m_appearance.AvatarHeight == 0) - m_appearance.SetHeight(); + if (Appearance.AvatarHeight == 0) + Appearance.SetHeight(); PhysicsScene scene = m_scene.PhysicsScene; Vector3 pVec = AbsolutePosition; // Old bug where the height was in centimeters instead of meters - m_physicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, - new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying); + PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, + new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); - scene.AddPhysicsActorTaint(m_physicsActor); - //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; - m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; - m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong - m_physicsActor.SubscribeEvents(500); - m_physicsActor.LocalID = LocalId; + scene.AddPhysicsActorTaint(PhysicsActor); + //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; + PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; + PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong + PhysicsActor.SubscribeEvents(500); + PhysicsActor.LocalID = LocalId; - SetHeight(m_appearance.AvatarHeight); + SetHeight(Appearance.AvatarHeight); } private void OutOfBoundsCall(Vector3 pos) { - //bool flying = m_physicsActor.Flying; + //bool flying = PhysicsActor.Flying; //RemoveFromPhysicalScene(); //AddToPhysicalScene(flying); @@ -3374,7 +3375,7 @@ namespace OpenSim.Region.Framework.Scenes return; //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) - // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( + // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( // as of this comment the interval is set in AddToPhysicalScene if (Animator != null) Animator.UpdateMovementAnimations(); @@ -3413,7 +3414,7 @@ namespace OpenSim.Region.Framework.Scenes } } - if (m_invulnerable) + if (Invulnerable) return; float starthealth = Health; @@ -3438,13 +3439,13 @@ namespace OpenSim.Region.Framework.Scenes //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString()); } //Health = 100; - if (!m_invulnerable) + if (!Invulnerable) { if (starthealth != Health) { ControllingClient.SendHealth(Health); } - if (m_health <= 0) + if (Health <= 0) m_scene.EventManager.TriggerAvatarKill(killerObj, this); } } @@ -3475,11 +3476,11 @@ namespace OpenSim.Region.Framework.Scenes // unsetting the elapsed callback should be enough to allow for cleanup however. // m_reprioritizationTimer.Dispose(); - m_sceneViewer.Close(); + SceneViewer.Close(); RemoveFromPhysicalScene(); - m_animator.Close(); - m_animator = null; + Animator.Close(); + Animator = null; } public void AddAttachment(SceneObjectGroup gobj) @@ -3841,7 +3842,7 @@ namespace OpenSim.Region.Framework.Scenes private void Reprioritize(object sender, ElapsedEventArgs e) { - m_controllingClient.ReprioritizeUpdates(); + ControllingClient.ReprioritizeUpdates(); lock (m_reprioritization_timer) { -- cgit v1.1 From 9a16e76f5151c11fbf76e41b89f8eb03b1731828 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Thu, 6 Oct 2011 12:39:19 -0700 Subject: Simplified IsInTransit property on ScenePresence and removed InTransit() which called IsInTransit=true which called m_inTransit=true. Also removed NotInTransit(). --- .../EntityTransfer/EntityTransferModule.cs | 12 ++++++------ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 8924c0a..083ee33 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -699,7 +699,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } else { - agent.InTransit(); + agent.IsInTransit = true; neighboury = b.TriggerRegionY; neighbourx = b.TriggerRegionX; @@ -722,7 +722,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } else { - agent.InTransit(); + agent.IsInTransit = true; neighboury = ba.TriggerRegionY; neighbourx = ba.TriggerRegionX; @@ -756,7 +756,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } else { - agent.InTransit(); + agent.IsInTransit = true; neighboury = ba.TriggerRegionY; neighbourx = ba.TriggerRegionX; @@ -788,7 +788,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } else { - agent.InTransit(); + agent.IsInTransit = true; neighboury = b.TriggerRegionY; neighbourx = b.TriggerRegionX; @@ -876,7 +876,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return false; } - agent.InTransit(); + agent.IsInTransit = true; CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); @@ -1066,7 +1066,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.RestoreInCurrentScene(); // In any case - agent.NotInTransit(); + agent.IsInTransit = false; //m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ce63946..e4e5f17 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -718,7 +718,16 @@ namespace OpenSim.Region.Framework.Scenes public bool IsInTransit { get { return m_inTransit; } - private set { m_inTransit = value; } + set { + if(value) + { + if ((PhysicsActor != null) && PhysicsActor.Flying) + m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; + else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) + m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; + } + m_inTransit = value; + } } private float m_speedModifier = 1.0f; @@ -2946,16 +2955,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void InTransit() - { - IsInTransit = true; - - if ((PhysicsActor != null) && PhysicsActor.Flying) - m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; - else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) - m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; - } - public void NotInTransit() { IsInTransit = false; -- cgit v1.1