aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs75
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
2 files changed, 21 insertions, 56 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 9bcaf32..b671aec 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -97,8 +97,6 @@ namespace OpenSim.Region.CoreModules.World.Land
97 97
98 // caches ExtendedLandData 98 // caches ExtendedLandData
99 private Cache parcelInfoCache; 99 private Cache parcelInfoCache;
100 private Dictionary<UUID, Vector3> forcedPosition =
101 new Dictionary<UUID, Vector3>();
102 100
103 #region INonSharedRegionModule Members 101 #region INonSharedRegionModule Members
104 102
@@ -223,36 +221,6 @@ namespace OpenSim.Region.CoreModules.World.Land
223 221
224 void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) 222 void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
225 { 223 {
226 //If we are forcing a position for them to go
227 if (forcedPosition.ContainsKey(remoteClient.AgentId))
228 {
229 ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId);
230
231 //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND
232 //When the avatar walks into a ban line on the ground, it prevents getting stuck
233 agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
234
235
236 //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines
237 if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2)
238 {
239 Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition));
240 forcedPosition.Remove(remoteClient.AgentId);
241 }
242 //if we are far away, teleport
243 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3)
244 {
245 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition));
246 clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]);
247 forcedPosition.Remove(remoteClient.AgentId);
248 }
249 else
250 {
251 //Forces them toward the forced position we want if they aren't there yet
252 agentData.UseClientAgentPosition = true;
253 agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId];
254 }
255 }
256 } 224 }
257 225
258 public void Close() 226 public void Close()
@@ -367,10 +335,16 @@ namespace OpenSim.Region.CoreModules.World.Land
367 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) 335 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
368 { 336 {
369 if (m_scene.Permissions.IsGod(avatar.UUID)) return; 337 if (m_scene.Permissions.IsGod(avatar.UUID)) return;
370 if (position.HasValue) 338
371 { 339 if (!position.HasValue)
372 forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; 340 return;
373 } 341
342 bool isFlying = avatar.PhysicsActor.Flying;
343 avatar.RemoveFromPhysicalScene();
344
345 avatar.AbsolutePosition = (Vector3)position;
346
347 avatar.AddToPhysicalScene(isFlying);
374 } 348 }
375 349
376 public void SendYouAreRestrictedNotice(ScenePresence avatar) 350 public void SendYouAreRestrictedNotice(ScenePresence avatar)
@@ -396,12 +370,14 @@ namespace OpenSim.Region.CoreModules.World.Land
396 if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID)) 370 if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID))
397 { 371 {
398 SendYouAreBannedNotice(avatar); 372 SendYouAreBannedNotice(avatar);
399 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); 373 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
374 //ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
400 } 375 }
401 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) 376 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID))
402 { 377 {
403 SendYouAreRestrictedNotice(avatar); 378 SendYouAreRestrictedNotice(avatar);
404 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); 379 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
380 //ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
405 } 381 }
406 else 382 else
407 { 383 {
@@ -499,26 +475,15 @@ namespace OpenSim.Region.CoreModules.World.Land
499 else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && 475 else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
500 parcel.IsBannedFromLand(clientAvatar.UUID)) 476 parcel.IsBannedFromLand(clientAvatar.UUID))
501 { 477 {
502 //once we've sent the message once, keep going toward the target until we are done 478 // SendYouAreBannedNotice(clientAvatar);
503 if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) 479 //ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
504 { 480 ForceAvatarToPosition(clientAvatar, clientAvatar.lastKnownAllowedPosition);
505 SendYouAreBannedNotice(clientAvatar);
506 ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
507 }
508 } 481 }
509 else if (parcel.IsRestrictedFromLand(clientAvatar.UUID)) 482 else if (parcel.IsRestrictedFromLand(clientAvatar.UUID))
510 { 483 {
511 //once we've sent the message once, keep going toward the target until we are done 484 // SendYouAreRestrictedNotice(clientAvatar);
512 if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) 485 //ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
513 { 486 ForceAvatarToPosition(clientAvatar, clientAvatar.lastKnownAllowedPosition);
514 SendYouAreRestrictedNotice(clientAvatar);
515 ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
516 }
517 }
518 else
519 {
520 //when we are finally in a safe place, lets release the forced position lock
521 forcedPosition.Remove(clientAvatar.ControllingClient.AgentId);
522 } 487 }
523 } 488 }
524 } 489 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index df7d7c8..b54d1b8 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1128,7 +1128,7 @@ namespace OpenSim.Region.Framework.Scenes
1128 /// <summary> 1128 /// <summary>
1129 /// Removes physics plugin scene representation of this agent if it exists. 1129 /// Removes physics plugin scene representation of this agent if it exists.
1130 /// </summary> 1130 /// </summary>
1131 private void RemoveFromPhysicalScene() 1131 public void RemoveFromPhysicalScene()
1132 { 1132 {
1133 if (PhysicsActor != null) 1133 if (PhysicsActor != null)
1134 { 1134 {