diff options
7 files changed, 52 insertions, 9 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c386c95..4bb865a 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -1184,6 +1184,7 @@ namespace OpenSim.Framework | |||
1184 | void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations); | 1184 | void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations); |
1185 | 1185 | ||
1186 | void SetChildAgentThrottle(byte[] throttle); | 1186 | void SetChildAgentThrottle(byte[] throttle); |
1187 | void SetChildAgentThrottle(byte[] throttle,float factor); | ||
1187 | 1188 | ||
1188 | void SetAgentThrottleSilent(int throttle, int setting); | 1189 | void SetAgentThrottleSilent(int throttle, int setting); |
1189 | int GetAgentThrottleSilent(int throttle); | 1190 | int GetAgentThrottleSilent(int throttle); |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b9646c7..f2f7cf9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -12344,7 +12344,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12344 | /// <param name="throttles"></param> | 12344 | /// <param name="throttles"></param> |
12345 | public void SetChildAgentThrottle(byte[] throttles) | 12345 | public void SetChildAgentThrottle(byte[] throttles) |
12346 | { | 12346 | { |
12347 | m_udpClient.SetThrottles(throttles); | 12347 | SetChildAgentThrottle(throttles, 1.0f); |
12348 | } | ||
12349 | |||
12350 | public void SetChildAgentThrottle(byte[] throttles,float factor) | ||
12351 | { | ||
12352 | m_udpClient.SetThrottles(throttles, factor); | ||
12348 | GenericCall2 handler = OnUpdateThrottles; | 12353 | GenericCall2 handler = OnUpdateThrottles; |
12349 | if (handler != null) | 12354 | if (handler != null) |
12350 | { | 12355 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 33375ff..0ae7617 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -340,6 +340,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
340 | 340 | ||
341 | public void SetThrottles(byte[] throttleData) | 341 | public void SetThrottles(byte[] throttleData) |
342 | { | 342 | { |
343 | SetThrottles(throttleData, 1.0f); | ||
344 | } | ||
345 | |||
346 | public void SetThrottles(byte[] throttleData, float factor) | ||
347 | { | ||
343 | byte[] adjData; | 348 | byte[] adjData; |
344 | int pos = 0; | 349 | int pos = 0; |
345 | 350 | ||
@@ -359,13 +364,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
359 | } | 364 | } |
360 | 365 | ||
361 | // 0.125f converts from bits to bytes | 366 | // 0.125f converts from bits to bytes |
362 | int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 367 | float scale = 0.125f * factor; |
363 | int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 368 | int resend = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; |
364 | int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 369 | int land = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; |
365 | int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 370 | int wind = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; |
366 | int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 371 | int cloud = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; |
367 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | 372 | int task = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; |
368 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | 373 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; |
374 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale); | ||
369 | 375 | ||
370 | // Make sure none of the throttles are set below our packet MTU, | 376 | // Make sure none of the throttles are set below our packet MTU, |
371 | // otherwise a throttle could become permanently clogged | 377 | // otherwise a throttle could become permanently clogged |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6a9e0ca..3b64088 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -4104,7 +4104,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
4104 | CameraPosition = cAgentData.Center + offset; | 4104 | CameraPosition = cAgentData.Center + offset; |
4105 | 4105 | ||
4106 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) | 4106 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) |
4107 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); | 4107 | { |
4108 | // some scaling factor | ||
4109 | float x = m_pos.X; | ||
4110 | if (x > m_scene.RegionInfo.RegionSizeX) | ||
4111 | x -= m_scene.RegionInfo.RegionSizeX; | ||
4112 | float y = m_pos.Y; | ||
4113 | if (y > m_scene.RegionInfo.RegionSizeY) | ||
4114 | y -= m_scene.RegionInfo.RegionSizeY; | ||
4115 | |||
4116 | x = x * x + y * y; | ||
4117 | |||
4118 | const float distScale = 0.4f / Constants.RegionSize / Constants.RegionSize; | ||
4119 | float factor = 1.0f - distScale * x; | ||
4120 | if (factor < 0.2f) | ||
4121 | factor = 0.2f; | ||
4122 | |||
4123 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles,factor); | ||
4124 | } | ||
4108 | 4125 | ||
4109 | if(cAgentData.ChildrenCapSeeds != null && cAgentData.ChildrenCapSeeds.Count >0) | 4126 | if(cAgentData.ChildrenCapSeeds != null && cAgentData.ChildrenCapSeeds.Count >0) |
4110 | { | 4127 | { |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index a45bea9..ed1503c 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -1433,6 +1433,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1433 | 1433 | ||
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | public virtual void SetChildAgentThrottle(byte[] throttle,float factor) | ||
1437 | { | ||
1438 | |||
1439 | } | ||
1440 | |||
1436 | public void SetAgentThrottleSilent(int throttle, int setting) | 1441 | public void SetAgentThrottleSilent(int throttle, int setting) |
1437 | { | 1442 | { |
1438 | 1443 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index cb87536..0b33c51 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -621,6 +621,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
621 | { | 621 | { |
622 | } | 622 | } |
623 | 623 | ||
624 | public virtual void SetChildAgentThrottle(byte[] throttle, float factor) | ||
625 | { | ||
626 | |||
627 | } | ||
628 | |||
624 | public void SetAgentThrottleSilent(int throttle, int setting) | 629 | public void SetAgentThrottleSilent(int throttle, int setting) |
625 | { | 630 | { |
626 | 631 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 00929df..d4f29c8 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -544,6 +544,10 @@ namespace OpenSim.Tests.Common.Mock | |||
544 | { | 544 | { |
545 | } | 545 | } |
546 | 546 | ||
547 | public virtual void SetChildAgentThrottle(byte[] throttle, float factor) | ||
548 | { | ||
549 | } | ||
550 | |||
547 | public void SetAgentThrottleSilent(int throttle, int setting) | 551 | public void SetAgentThrottleSilent(int throttle, int setting) |
548 | { | 552 | { |
549 | } | 553 | } |