diff options
author | Melanie | 2011-01-28 01:37:37 +0100 |
---|---|---|
committer | Melanie | 2011-01-28 01:37:37 +0100 |
commit | 7492131bb60129f5ce875ee376fc10b477e3fc5f (patch) | |
tree | ac64f7844b1a1b7e06363badb1492ac5db73ec3a /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
download | opensim-SC_OLD-7492131bb60129f5ce875ee376fc10b477e3fc5f.zip opensim-SC_OLD-7492131bb60129f5ce875ee376fc10b477e3fc5f.tar.gz opensim-SC_OLD-7492131bb60129f5ce875ee376fc10b477e3fc5f.tar.bz2 opensim-SC_OLD-7492131bb60129f5ce875ee376fc10b477e3fc5f.tar.xz |
Fix bumping into sim borders and check estate bans for walking crossings
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 49 |
2 files changed, 42 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bb9a748..5caf06c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4022,14 +4022,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4022 | RequestTeleportLocation(remoteClient, info.RegionHandle, position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); | 4022 | RequestTeleportLocation(remoteClient, info.RegionHandle, position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); |
4023 | } | 4023 | } |
4024 | 4024 | ||
4025 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 4025 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
4026 | { | 4026 | { |
4027 | if (m_teleportModule != null) | 4027 | if (m_teleportModule != null) |
4028 | m_teleportModule.Cross(agent, isFlying); | 4028 | return m_teleportModule.Cross(agent, isFlying); |
4029 | else | 4029 | else |
4030 | { | 4030 | { |
4031 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); | 4031 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); |
4032 | } | 4032 | } |
4033 | |||
4034 | return false; | ||
4033 | } | 4035 | } |
4034 | 4036 | ||
4035 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) | 4037 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index db9a95b..a1ca9c5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3102,29 +3102,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
3102 | // Makes sure avatar does not end up outside region | 3102 | // Makes sure avatar does not end up outside region |
3103 | if (neighbor <= 0) | 3103 | if (neighbor <= 0) |
3104 | { | 3104 | { |
3105 | if (!needsTransit) | 3105 | if (needsTransit) |
3106 | { | 3106 | { |
3107 | if (m_requestedSitTargetUUID == UUID.Zero) | 3107 | if (m_requestedSitTargetUUID == UUID.Zero) |
3108 | { | 3108 | { |
3109 | bool isFlying = m_physicsActor.Flying; | ||
3110 | RemoveFromPhysicalScene(); | ||
3111 | |||
3109 | Vector3 pos = AbsolutePosition; | 3112 | Vector3 pos = AbsolutePosition; |
3110 | if (AbsolutePosition.X < 0) | 3113 | if (AbsolutePosition.X < 0) |
3111 | pos.X += Velocity.X; | 3114 | pos.X += Velocity.X * 2; |
3112 | else if (AbsolutePosition.X > Constants.RegionSize) | 3115 | else if (AbsolutePosition.X > Constants.RegionSize) |
3113 | pos.X -= Velocity.X; | 3116 | pos.X -= Velocity.X * 2; |
3114 | if (AbsolutePosition.Y < 0) | 3117 | if (AbsolutePosition.Y < 0) |
3115 | pos.Y += Velocity.Y; | 3118 | pos.Y += Velocity.Y * 2; |
3116 | else if (AbsolutePosition.Y > Constants.RegionSize) | 3119 | else if (AbsolutePosition.Y > Constants.RegionSize) |
3117 | pos.Y -= Velocity.Y; | 3120 | pos.Y -= Velocity.Y * 2; |
3121 | Velocity = Vector3.Zero; | ||
3118 | AbsolutePosition = pos; | 3122 | AbsolutePosition = pos; |
3123 | |||
3124 | AddToPhysicalScene(isFlying); | ||
3119 | } | 3125 | } |
3120 | } | 3126 | } |
3121 | } | 3127 | } |
3122 | else if (neighbor > 0) | 3128 | else if (neighbor > 0) |
3123 | CrossToNewRegion(); | 3129 | { |
3130 | if (!CrossToNewRegion()) | ||
3131 | { | ||
3132 | if (m_requestedSitTargetUUID == UUID.Zero) | ||
3133 | { | ||
3134 | bool isFlying = m_physicsActor.Flying; | ||
3135 | RemoveFromPhysicalScene(); | ||
3136 | |||
3137 | Vector3 pos = AbsolutePosition; | ||
3138 | if (AbsolutePosition.X < 0) | ||
3139 | pos.X += Velocity.X * 2; | ||
3140 | else if (AbsolutePosition.X > Constants.RegionSize) | ||
3141 | pos.X -= Velocity.X * 2; | ||
3142 | if (AbsolutePosition.Y < 0) | ||
3143 | pos.Y += Velocity.Y * 2; | ||
3144 | else if (AbsolutePosition.Y > Constants.RegionSize) | ||
3145 | pos.Y -= Velocity.Y * 2; | ||
3146 | Velocity = Vector3.Zero; | ||
3147 | AbsolutePosition = pos; | ||
3148 | |||
3149 | AddToPhysicalScene(isFlying); | ||
3150 | } | ||
3151 | } | ||
3152 | } | ||
3124 | } | 3153 | } |
3125 | else | 3154 | else |
3126 | { | 3155 | { |
3127 | RemoveFromPhysicalScene(); | ||
3128 | // This constant has been inferred from experimentation | 3156 | // This constant has been inferred from experimentation |
3129 | // I'm not sure what this value should be, so I tried a few values. | 3157 | // I'm not sure what this value should be, so I tried a few values. |
3130 | timeStep = 0.04f; | 3158 | timeStep = 0.04f; |
@@ -3173,16 +3201,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3173 | /// If the neighbor accepts, remove the agent's viewable avatar from this scene | 3201 | /// If the neighbor accepts, remove the agent's viewable avatar from this scene |
3174 | /// set them to a child agent. | 3202 | /// set them to a child agent. |
3175 | /// </summary> | 3203 | /// </summary> |
3176 | protected void CrossToNewRegion() | 3204 | protected bool CrossToNewRegion() |
3177 | { | 3205 | { |
3178 | InTransit(); | ||
3179 | try | 3206 | try |
3180 | { | 3207 | { |
3181 | m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); | 3208 | return m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); |
3182 | } | 3209 | } |
3183 | catch | 3210 | catch |
3184 | { | 3211 | { |
3185 | m_scene.CrossAgentToNewRegion(this, false); | 3212 | return m_scene.CrossAgentToNewRegion(this, false); |
3186 | } | 3213 | } |
3187 | } | 3214 | } |
3188 | 3215 | ||