diff options
author | Melanie | 2011-01-28 01:37:37 +0100 |
---|---|---|
committer | Melanie | 2011-01-28 02:38:14 +0000 |
commit | d90b0c53ec747c512b1efccf6f25596dac9c3e41 (patch) | |
tree | 26fac666b5879f1727177eb75eaeb2d03d8a0d2d /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-d90b0c53ec747c512b1efccf6f25596dac9c3e41.zip opensim-SC_OLD-d90b0c53ec747c512b1efccf6f25596dac9c3e41.tar.gz opensim-SC_OLD-d90b0c53ec747c512b1efccf6f25596dac9c3e41.tar.bz2 opensim-SC_OLD-d90b0c53ec747c512b1efccf6f25596dac9c3e41.tar.xz |
Fix bumping into sim borders and check estate bans for walking crossings
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1c276fa..cd70de8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2725,29 +2725,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
2725 | // Makes sure avatar does not end up outside region | 2725 | // Makes sure avatar does not end up outside region |
2726 | if (neighbor <= 0) | 2726 | if (neighbor <= 0) |
2727 | { | 2727 | { |
2728 | if (!needsTransit) | 2728 | if (needsTransit) |
2729 | { | 2729 | { |
2730 | if (m_requestedSitTargetUUID == UUID.Zero) | 2730 | if (m_requestedSitTargetUUID == UUID.Zero) |
2731 | { | 2731 | { |
2732 | bool isFlying = m_physicsActor.Flying; | ||
2733 | RemoveFromPhysicalScene(); | ||
2734 | |||
2732 | Vector3 pos = AbsolutePosition; | 2735 | Vector3 pos = AbsolutePosition; |
2733 | if (AbsolutePosition.X < 0) | 2736 | if (AbsolutePosition.X < 0) |
2734 | pos.X += Velocity.X; | 2737 | pos.X += Velocity.X * 2; |
2735 | else if (AbsolutePosition.X > Constants.RegionSize) | 2738 | else if (AbsolutePosition.X > Constants.RegionSize) |
2736 | pos.X -= Velocity.X; | 2739 | pos.X -= Velocity.X * 2; |
2737 | if (AbsolutePosition.Y < 0) | 2740 | if (AbsolutePosition.Y < 0) |
2738 | pos.Y += Velocity.Y; | 2741 | pos.Y += Velocity.Y * 2; |
2739 | else if (AbsolutePosition.Y > Constants.RegionSize) | 2742 | else if (AbsolutePosition.Y > Constants.RegionSize) |
2740 | pos.Y -= Velocity.Y; | 2743 | pos.Y -= Velocity.Y * 2; |
2744 | Velocity = Vector3.Zero; | ||
2741 | AbsolutePosition = pos; | 2745 | AbsolutePosition = pos; |
2746 | |||
2747 | AddToPhysicalScene(isFlying); | ||
2742 | } | 2748 | } |
2743 | } | 2749 | } |
2744 | } | 2750 | } |
2745 | else if (neighbor > 0) | 2751 | else if (neighbor > 0) |
2746 | CrossToNewRegion(); | 2752 | { |
2753 | if (!CrossToNewRegion()) | ||
2754 | { | ||
2755 | if (m_requestedSitTargetUUID == UUID.Zero) | ||
2756 | { | ||
2757 | bool isFlying = m_physicsActor.Flying; | ||
2758 | RemoveFromPhysicalScene(); | ||
2759 | |||
2760 | Vector3 pos = AbsolutePosition; | ||
2761 | if (AbsolutePosition.X < 0) | ||
2762 | pos.X += Velocity.X * 2; | ||
2763 | else if (AbsolutePosition.X > Constants.RegionSize) | ||
2764 | pos.X -= Velocity.X * 2; | ||
2765 | if (AbsolutePosition.Y < 0) | ||
2766 | pos.Y += Velocity.Y * 2; | ||
2767 | else if (AbsolutePosition.Y > Constants.RegionSize) | ||
2768 | pos.Y -= Velocity.Y * 2; | ||
2769 | Velocity = Vector3.Zero; | ||
2770 | AbsolutePosition = pos; | ||
2771 | |||
2772 | AddToPhysicalScene(isFlying); | ||
2773 | } | ||
2774 | } | ||
2775 | } | ||
2747 | } | 2776 | } |
2748 | else | 2777 | else |
2749 | { | 2778 | { |
2750 | RemoveFromPhysicalScene(); | ||
2751 | // This constant has been inferred from experimentation | 2779 | // This constant has been inferred from experimentation |
2752 | // I'm not sure what this value should be, so I tried a few values. | 2780 | // I'm not sure what this value should be, so I tried a few values. |
2753 | timeStep = 0.04f; | 2781 | timeStep = 0.04f; |
@@ -2796,16 +2824,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2796 | /// If the neighbor accepts, remove the agent's viewable avatar from this scene | 2824 | /// If the neighbor accepts, remove the agent's viewable avatar from this scene |
2797 | /// set them to a child agent. | 2825 | /// set them to a child agent. |
2798 | /// </summary> | 2826 | /// </summary> |
2799 | protected void CrossToNewRegion() | 2827 | protected bool CrossToNewRegion() |
2800 | { | 2828 | { |
2801 | InTransit(); | ||
2802 | try | 2829 | try |
2803 | { | 2830 | { |
2804 | m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); | 2831 | return m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); |
2805 | } | 2832 | } |
2806 | catch | 2833 | catch |
2807 | { | 2834 | { |
2808 | m_scene.CrossAgentToNewRegion(this, false); | 2835 | return m_scene.CrossAgentToNewRegion(this, false); |
2809 | } | 2836 | } |
2810 | } | 2837 | } |
2811 | 2838 | ||