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 | |
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 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 49 |
3 files changed, 43 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index e8738c4..8b96de4 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
42 | 42 | ||
43 | void TeleportHome(UUID id, IClientAPI client); | 43 | void TeleportHome(UUID id, IClientAPI client); |
44 | 44 | ||
45 | void Cross(ScenePresence agent, bool isFlying); | 45 | bool Cross(ScenePresence agent, bool isFlying); |
46 | 46 | ||
47 | void AgentArrivedAtDestination(UUID agent); | 47 | void AgentArrivedAtDestination(UUID agent); |
48 | 48 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index dc08b49..4325ab8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3861,14 +3861,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3861 | RequestTeleportLocation(remoteClient, info.RegionHandle, position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); | 3861 | RequestTeleportLocation(remoteClient, info.RegionHandle, position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); |
3862 | } | 3862 | } |
3863 | 3863 | ||
3864 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 3864 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
3865 | { | 3865 | { |
3866 | if (m_teleportModule != null) | 3866 | if (m_teleportModule != null) |
3867 | m_teleportModule.Cross(agent, isFlying); | 3867 | return m_teleportModule.Cross(agent, isFlying); |
3868 | else | 3868 | else |
3869 | { | 3869 | { |
3870 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); | 3870 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); |
3871 | } | 3871 | } |
3872 | |||
3873 | return false; | ||
3872 | } | 3874 | } |
3873 | 3875 | ||
3874 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) | 3876 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) |
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 | ||