diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 35f5566335..882f4d4dd6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -103,16 +103,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. @@ -144,8 +143,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 int m_userFlags; public int UserFlags @@ -171,26 +168,14 @@ 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 bool m_flyingOld; // add for fly velocity control public bool m_wasFlying; // add for fly velocity control - private float m_speedModifier = 1.0f; - - private Quaternion m_bodyRot = Quaternion.Identity; - private const int LAND_VELOCITYMAG_MAX = 12; public bool IsRestrictedToRegion; @@ -204,22 +189,12 @@ namespace OpenSim.Region.Framework.Scenes private readonly Vector3[] Dir_Vectors = new Vector3[11]; private bool m_isNudging = false; - // 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; @@ -256,11 +231,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(); @@ -272,6 +255,7 @@ namespace OpenSim.Region.Framework.Scenes public List InTransitScriptStates { get { return m_InTransitScriptStates; } + private set { m_InTransitScriptStates = value; } } private List m_InTransitScriptStates = new List(); @@ -302,8 +286,6 @@ namespace OpenSim.Region.Framework.Scenes string m_callbackURI; UUID m_originRegionID; - ulong m_rootRegionHandle; - /// /// Script engines present in the scene /// @@ -311,6 +293,8 @@ namespace OpenSim.Region.Framework.Scenes #region Properties + protected PhysicsActor m_physicsActor; + /// /// Physical scene representation of this Avatar. /// @@ -320,69 +304,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; @@ -390,20 +407,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; @@ -413,9 +420,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; @@ -426,6 +437,8 @@ namespace OpenSim.Region.Framework.Scenes set { m_allowMovement = value; } } + private bool m_setAlwaysRun; + public bool SetAlwaysRun { get @@ -449,12 +462,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; } @@ -466,11 +483,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 @@ -479,6 +495,7 @@ namespace OpenSim.Region.Framework.Scenes } protected Vector3 m_parentPosition; + public Vector3 ParentPosition { get { return m_parentPosition; } @@ -509,7 +526,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. // @@ -517,16 +534,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 part.AbsolutePosition + (m_pos * part.GetWorldRotation()); } else { - return m_parentPosition + m_pos; + return ParentPosition + m_pos; } } } @@ -535,13 +552,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) { @@ -576,10 +592,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!", @@ -590,13 +605,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) { @@ -617,6 +631,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_offsetRotation; } set { m_offsetRotation = value; } } + private Quaternion m_bodyRot = Quaternion.Identity; public Quaternion Rotation { @@ -707,9 +722,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() @@ -756,28 +774,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; } @@ -799,15 +824,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(); @@ -816,16 +841,16 @@ namespace OpenSim.Region.Framework.Scenes m_userFlags = account.UserFlags; 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); @@ -845,21 +870,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); @@ -930,6 +955,10 @@ namespace OpenSim.Region.Framework.Scenes public void SendPrimUpdates() { m_sceneViewer.SendPrimUpdates(); + m_perfMonMS = Util.EnvironmentTickCount(); + + SceneViewer.SendPrimUpdates(); + } #region Status Methods @@ -947,21 +976,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); @@ -1042,8 +1071,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; @@ -1059,13 +1088,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 @@ -1103,7 +1132,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); } @@ -1133,12 +1162,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(); @@ -1150,11 +1179,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); } @@ -1187,10 +1216,9 @@ namespace OpenSim.Region.Framework.Scenes public void Teleport(Vector3 pos) { bool isFlying = false; + if (PhysicsActor != null) + isFlying = PhysicsActor.Flying; - if (m_physicsActor != null) - isFlying = m_physicsActor.Flying; - RemoveFromPhysicalScene(); Velocity = Vector3.Zero; CheckLandingPoint(ref pos); @@ -1204,8 +1232,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(); CheckLandingPoint(ref pos); @@ -1321,11 +1349,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) @@ -1369,7 +1397,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) { @@ -1391,7 +1419,7 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat("[SCENE PRESENCE]: Received agent update from {0}", remoteClient.Name); - //if (m_isChildAgent) + //if (IsChildAgent) //{ // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); // return; @@ -1435,28 +1463,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; @@ -1478,7 +1506,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); } } @@ -1507,7 +1535,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) @@ -1515,12 +1543,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; @@ -1540,9 +1568,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); @@ -1550,7 +1578,7 @@ namespace OpenSim.Region.Framework.Scenes if (actor.Flying != oldflying) update_movementflag = true; - if (m_parentID == 0) + if (ParentID == 0) { bool bAllowUpdateMoveToPosition = false; @@ -1558,12 +1586,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; @@ -1583,15 +1611,15 @@ 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_BACK_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; } } @@ -1608,7 +1636,7 @@ namespace OpenSim.Region.Framework.Scenes /* 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"); } @@ -1643,7 +1671,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 @@ -1651,10 +1679,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. @@ -1683,7 +1708,7 @@ namespace OpenSim.Region.Framework.Scenes // } // } - if (update_movementflag && m_parentID == 0) + if (update_movementflag && ParentID == 0) Animator.UpdateMovementAnimations(); } @@ -1765,26 +1790,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; } @@ -1793,14 +1818,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; } @@ -1963,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes { SitGround = false; - if (m_parentID != 0) + if (ParentID != 0) { SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); if (part != null) @@ -1986,7 +2011,7 @@ 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); } // part.GetWorldRotation() is the rotation of the object being sat on @@ -2256,7 +2281,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(); } @@ -2582,6 +2607,7 @@ namespace OpenSim.Region.Framework.Scenes return; } } + ParentID = m_requestedSitTargetID; //We want our offsets to reference the root prim, not the child we may have sat on if (!part.IsRoot) @@ -2644,11 +2670,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) @@ -2670,27 +2692,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) { @@ -2723,16 +2743,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) @@ -2741,13 +2759,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. @@ -2773,9 +2791,9 @@ namespace OpenSim.Region.Framework.Scenes if (remoteClient.IsActive) { 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, @@ -2847,7 +2865,8 @@ namespace OpenSim.Region.Framework.Scenes public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List coarseLocations, List avatarUUIDs) { - m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); + m_perfMonMS = Util.EnvironmentTickCount(); + ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); } /// @@ -2857,21 +2876,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); } @@ -3019,17 +3038,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 @@ -3057,14 +3066,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; @@ -3170,7 +3178,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_requestedSitTargetUUID == UUID.Zero) { - bool isFlying = m_physicsActor.Flying; + bool isFlying = PhysicsActor.Flying; RemoveFromPhysicalScene(); Vector3 pos = AbsolutePosition; @@ -3195,7 +3203,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_requestedSitTargetUUID == UUID.Zero) { - bool isFlying = m_physicsActor.Flying; + bool isFlying = PhysicsActor.Flying; RemoveFromPhysicalScene(); Vector3 pos = AbsolutePosition; @@ -3285,7 +3293,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - return m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); + return m_scene.CrossAgentToNewRegion(this, PhysicsActor.Flying); } catch { @@ -3295,9 +3303,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; @@ -3305,7 +3313,7 @@ namespace OpenSim.Region.Framework.Scenes public void NotInTransit() { - m_inTransit = false; + IsInTransit = false; } public void RestoreInCurrentScene() @@ -3361,7 +3369,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) @@ -3387,17 +3395,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 @@ -3429,8 +3437,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; @@ -3441,7 +3449,7 @@ namespace OpenSim.Region.Framework.Scenes ReprioritizeUpdates(); } - m_CameraCenter = cAgentData.Center + offset; + CameraPosition = cAgentData.Center + offset; //SetHeight(cAgentData.AVHeight); @@ -3449,7 +3457,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); //cAgentData.AVHeight; - m_rootRegionHandle = cAgentData.RegionHandle; + RegionHandle = cAgentData.RegionHandle; //m_velocity = cAgentData.Velocity; } @@ -3462,12 +3470,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; @@ -3482,17 +3490,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) { @@ -3521,7 +3529,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) { @@ -3534,7 +3542,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); } @@ -3551,32 +3559,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); } @@ -3642,7 +3650,7 @@ namespace OpenSim.Region.Framework.Scenes { Vector3 force = m_forceToApply.Value; - m_updateflag = true; + Updated = true; Velocity = force; @@ -3659,28 +3667,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; - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, - new Vector3(0f, 0f, m_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; + // Old bug where the height was in centimeters instead of meters + PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, + new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); - SetHeight(m_appearance.AvatarHeight); + 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(Appearance.AvatarHeight); } private void OutOfBoundsCall(Vector3 pos) { - //bool flying = m_physicsActor.Flying; + //bool flying = PhysicsActor.Flying; //RemoveFromPhysicalScene(); //AddToPhysicalScene(flying); @@ -3693,8 +3703,9 @@ namespace OpenSim.Region.Framework.Scenes { if (e == null) return; - - // The Physics Scene will send (spam!) updates every 500 ms grep: m_physicsActor.SubscribeEvents( + + //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: PhysicsActor.SubscribeEvents( // as of this comment the interval is set in AddToPhysicalScene if (Animator!=null) { @@ -3887,7 +3898,7 @@ namespace OpenSim.Region.Framework.Scenes } } - if (m_invulnerable) + if (Invulnerable) return; float starthealth = Health; @@ -3912,13 +3923,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); } } @@ -3949,11 +3960,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) @@ -4319,7 +4330,7 @@ namespace OpenSim.Region.Framework.Scenes private void Reprioritize(object sender, ElapsedEventArgs e) { - m_controllingClient.ReprioritizeUpdates(); + ControllingClient.ReprioritizeUpdates(); lock (m_reprioritization_timer) { diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 93a0bd67a4..a17eb41740 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -717,16 +717,6 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator // Delete tree and alert clients (not silent) m_scene.DeleteSceneObject(selectedTree.ParentGroup, false); copse.m_trees.Remove(selectedTree.ParentGroup.UUID); -<<<<<<< HEAD:OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs - - m_scene.ForEachClient(delegate(IClientAPI controller) - { - controller.SendKillObject(m_scene.RegionInfo.RegionHandle, - new List() { selectedTree.LocalId }); - }); - -======= ->>>>>>> 146322eb34c15a5722cfe42dd012821ddf441fe6:OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs break; } }