diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 5a9eeb57f9..330a41e93d 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -173,6 +173,7 @@ namespace OpenSim.Framework /// Position the Agent's Avatar starts in the region /// public Vector3 startpos; + public float startfar = -1.0f; public Dictionary ServiceURLs; @@ -219,6 +220,8 @@ namespace OpenSim.Framework args["channel"] = OSD.FromString(Channel); args["mac"] = OSD.FromString(Mac); args["id0"] = OSD.FromString(Id0); + if(startfar > 0) + args["far"] = OSD.FromReal(startfar); if (Appearance != null) { @@ -327,6 +330,9 @@ namespace OpenSim.Framework if (args["start_pos"] != null) Vector3.TryParse(args["start_pos"].AsString(), out startpos); + if(args["far"] != null) + startfar = (float)args["far"].AsReal(); + //m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos); try diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs index b6e48b4372..2cd11ffe83 100644 --- a/OpenSim/Framework/AgentCircuitManager.cs +++ b/OpenSim/Framework/AgentCircuitManager.cs @@ -79,6 +79,7 @@ namespace OpenSim.Framework user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder; user.LoginInfo.BaseFolder = validcircuit.BaseFolder; user.LoginInfo.StartPos = validcircuit.startpos; + user.LoginInfo.StartFar = (float)validcircuit.startfar; } else { @@ -175,7 +176,8 @@ namespace OpenSim.Framework { m_agentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname; m_agentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname; - m_agentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos; + m_agentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; + m_agentCircuits[(uint)agentData.circuitcode].startfar = agentData.startfar; // Updated for when we don't know them before calling Scene.NewUserConnection m_agentCircuits[(uint) agentData.circuitcode].SecureSessionID = agentData.SecureSessionID; diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 8b1a98286b..b395f392e6 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -707,6 +707,7 @@ namespace OpenSim.Framework public interface IClientAPI { Vector3 StartPos { get; set; } + float StartFar { get; set; } UUID AgentId { get; } diff --git a/OpenSim/Framework/Login.cs b/OpenSim/Framework/Login.cs index 54a6654685..b8a24ea7a6 100644 --- a/OpenSim/Framework/Login.cs +++ b/OpenSim/Framework/Login.cs @@ -42,11 +42,13 @@ namespace OpenSim.Framework public UUID SecureSession = UUID.Zero; public UUID Session; public Vector3 StartPos; + public float StartFar; public AvatarAppearance Appearance; public Login() { StartPos = new Vector3(128, 128, 70); + StartFar = -1; } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6859b8357c..5ffea6297b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -408,6 +408,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_startpos; } set { m_startpos = value; } } + public float StartFar { get; set; } + public bool DeliverPackets { get { return m_deliverPackets; } @@ -540,6 +542,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_firstName = sessionInfo.LoginInfo.First; m_lastName = sessionInfo.LoginInfo.Last; m_startpos = sessionInfo.LoginInfo.StartPos; + StartFar = sessionInfo.LoginInfo.StartFar; m_udpServer = udpServer; m_udpClient = udpClient; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index fb2fd07490..6b3e8c48c3 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1946,6 +1946,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.BaseFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero; agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, region); + agent.startfar = sp.DrawDistance; agent.child = true; agent.Appearance = new AvatarAppearance(); agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; @@ -2105,7 +2106,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.child = true; agent.Appearance = new AvatarAppearance(); agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; - + agent.startfar = sp.DrawDistance; if (currentAgentCircuit != null) { agent.ServiceURLs = currentAgentCircuit.ServiceURLs; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2c20da6f37..be593ad5a2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1079,7 +1079,14 @@ namespace OpenSim.Region.Framework.Scenes Animator = new ScenePresenceAnimator(this); Overrides = new MovementAnimationOverrides(); PresenceType = type; - DrawDistance = world.DefaultDrawDistance; + m_drawDistance = client.StartFar; + if(m_drawDistance > 32) + { + if(m_drawDistance > world.MaxDrawDistance) + m_drawDistance = world.MaxDrawDistance; + } + else + m_drawDistance = world.DefaultDrawDistance; RegionHandle = world.RegionInfo.RegionHandle; ControllingClient = client; Firstname = ControllingClient.FirstName; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 9f85185dc0..16be1c80f8 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -524,6 +524,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server set { } } + public float StartFar { get; set; } + public bool TryGet(out T iface) { iface = default(T); diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 954d336e04..b2a9716a93 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -562,6 +562,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC set { } } + public float StartFar { get; set; } + public virtual UUID AgentId { get { return m_uuid; } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 0031127763..3cd525369a 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -369,6 +369,8 @@ namespace OpenSim.Tests.Common set { } } + public float StartFar { get; set; } + public virtual UUID AgentId { get { return m_agentId; }