aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2011-01-28 04:04:30 +0100
committerMelanie2011-01-28 04:04:30 +0100
commit0ea8046545bdbc9da4904413882bd54c1b7b6d75 (patch)
treeb6e00e8d35f62e52a4b8ced02b506a4bb38e0813 /OpenSim/Region
parentChange the way ban lines work (diff)
downloadopensim-SC_OLD-0ea8046545bdbc9da4904413882bd54c1b7b6d75.zip
opensim-SC_OLD-0ea8046545bdbc9da4904413882bd54c1b7b6d75.tar.gz
opensim-SC_OLD-0ea8046545bdbc9da4904413882bd54c1b7b6d75.tar.bz2
opensim-SC_OLD-0ea8046545bdbc9da4904413882bd54c1b7b6d75.tar.xz
Change the way ban lines are handled. Remove a lot of useless stuff designed
to physically move the avatar and instead just re-set the position. Ban lines now work fully.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs63
1 files changed, 10 insertions, 53 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 4f24415..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()
@@ -377,8 +345,6 @@ namespace OpenSim.Region.CoreModules.World.Land
377 avatar.AbsolutePosition = (Vector3)position; 345 avatar.AbsolutePosition = (Vector3)position;
378 346
379 avatar.AddToPhysicalScene(isFlying); 347 avatar.AddToPhysicalScene(isFlying);
380
381 forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position;
382 } 348 }
383 349
384 public void SendYouAreRestrictedNotice(ScenePresence avatar) 350 public void SendYouAreRestrictedNotice(ScenePresence avatar)
@@ -404,12 +370,14 @@ namespace OpenSim.Region.CoreModules.World.Land
404 if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID)) 370 if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID))
405 { 371 {
406 SendYouAreBannedNotice(avatar); 372 SendYouAreBannedNotice(avatar);
407 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); 373 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
374 //ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
408 } 375 }
409 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) 376 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID))
410 { 377 {
411 SendYouAreRestrictedNotice(avatar); 378 SendYouAreRestrictedNotice(avatar);
412 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); 379 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
380 //ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
413 } 381 }
414 else 382 else
415 { 383 {
@@ -507,26 +475,15 @@ namespace OpenSim.Region.CoreModules.World.Land
507 else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && 475 else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
508 parcel.IsBannedFromLand(clientAvatar.UUID)) 476 parcel.IsBannedFromLand(clientAvatar.UUID))
509 { 477 {
510 //once we've sent the message once, keep going toward the target until we are done 478 // SendYouAreBannedNotice(clientAvatar);
511 if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) 479 //ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
512 { 480 ForceAvatarToPosition(clientAvatar, clientAvatar.lastKnownAllowedPosition);
513 SendYouAreBannedNotice(clientAvatar);
514 ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
515 }
516 } 481 }
517 else if (parcel.IsRestrictedFromLand(clientAvatar.UUID)) 482 else if (parcel.IsRestrictedFromLand(clientAvatar.UUID))
518 { 483 {
519 //once we've sent the message once, keep going toward the target until we are done 484 // SendYouAreRestrictedNotice(clientAvatar);
520 if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) 485 //ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
521 { 486 ForceAvatarToPosition(clientAvatar, clientAvatar.lastKnownAllowedPosition);
522 SendYouAreRestrictedNotice(clientAvatar);
523 ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
524 }
525 }
526 else
527 {
528 //when we are finally in a safe place, lets release the forced position lock
529 forcedPosition.Remove(clientAvatar.ControllingClient.AgentId);
530 } 487 }
531 } 488 }
532 } 489 }