aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/LandManagement/LandManager.cs
diff options
context:
space:
mode:
authorlbsa712007-12-27 21:41:48 +0000
committerlbsa712007-12-27 21:41:48 +0000
commitefd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch)
treebf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Region/Environment/LandManagement/LandManager.cs
parent* removed always true if (diff)
downloadopensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
Diffstat (limited to 'OpenSim/Region/Environment/LandManagement/LandManager.cs')
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs95
1 files changed, 51 insertions, 44 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index ecd458d..772fe2e 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -27,11 +27,13 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Axiom.Math;
30using libsecondlife; 31using libsecondlife;
31using libsecondlife.Packets; 32using libsecondlife.Packets;
32using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Console;
33using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Physics.Manager;
35 37
36namespace OpenSim.Region.Environment.LandManagement 38namespace OpenSim.Region.Environment.LandManagement
37{ 39{
@@ -93,7 +95,7 @@ namespace OpenSim.Region.Environment.LandManagement
93 private readonly RegionInfo m_regInfo; 95 private readonly RegionInfo m_regInfo;
94 96
95 public bool allowedForcefulBans = true; 97 public bool allowedForcefulBans = true;
96 98
97 #endregion 99 #endregion
98 100
99 #region Constructors 101 #region Constructors
@@ -103,14 +105,13 @@ namespace OpenSim.Region.Environment.LandManagement
103 m_scene = scene; 105 m_scene = scene;
104 m_regInfo = reginfo; 106 m_regInfo = reginfo;
105 landIDList.Initialize(); 107 landIDList.Initialize();
106 scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel); 108 scene.EventManager.OnAvatarEnteringNewParcel +=
107 scene.EventManager.OnClientMovement += new EventManager.ClientMovement(this.handleAnyClientMovement); 109 new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel);
110 scene.EventManager.OnClientMovement += new EventManager.ClientMovement(handleAnyClientMovement);
108 } 111 }
109 112
110
111
112 #endregion 113 #endregion
113 114
114 #region Member Functions 115 #region Member Functions
115 116
116 #region Land Object From Storage Functions 117 #region Land Object From Storage Functions
@@ -147,7 +148,6 @@ namespace OpenSim.Region.Environment.LandManagement
147 /// <returns></returns> 148 /// <returns></returns>
148 public Land createBaseLand() 149 public Land createBaseLand()
149 { 150 {
150
151 return new Land(LLUUID.Zero, false, m_scene); 151 return new Land(LLUUID.Zero, false, m_scene);
152 } 152 }
153 153
@@ -175,7 +175,7 @@ namespace OpenSim.Region.Environment.LandManagement
175 } 175 }
176 } 176 }
177 landList[lastLandLocalID].forceUpdateLandInfo(); 177 landList[lastLandLocalID].forceUpdateLandInfo();
178 m_scene.EventManager.TriggerLandObjectAdded(new_land,m_scene.RegionInfo.RegionID); 178 m_scene.EventManager.TriggerLandObjectAdded(new_land, m_scene.RegionInfo.RegionID);
179 return new_land; 179 return new_land;
180 } 180 }
181 181
@@ -207,7 +207,7 @@ namespace OpenSim.Region.Environment.LandManagement
207 if (landList.ContainsKey(local_id)) 207 if (landList.ContainsKey(local_id))
208 { 208 {
209 landList[local_id].landData = newData.Copy(); 209 landList[local_id].landData = newData.Copy();
210 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landList[local_id]); 210 m_scene.EventManager.TriggerLandObjectUpdated((uint) local_id, landList[local_id]);
211 } 211 }
212 else 212 else
213 { 213 {
@@ -335,7 +335,7 @@ namespace OpenSim.Region.Environment.LandManagement
335 335
336 //Now add the new land object 336 //Now add the new land object
337 Land result = addLandObject(newLand); 337 Land result = addLandObject(newLand);
338 updateLandObject(startLandObject.landData.localID,startLandObject.landData); 338 updateLandObject(startLandObject.landData.localID, startLandObject.landData);
339 result.sendLandUpdateToAvatarsOverMe(); 339 result.sendLandUpdateToAvatarsOverMe();
340 340
341 341
@@ -463,11 +463,11 @@ namespace OpenSim.Region.Environment.LandManagement
463 Land southParcel = null; 463 Land southParcel = null;
464 if (x > 0) 464 if (x > 0)
465 { 465 {
466 westParcel = getLandObject((x - 1) * 4, y * 4); 466 westParcel = getLandObject((x - 1)*4, y*4);
467 } 467 }
468 if (y > 0) 468 if (y > 0)
469 { 469 {
470 southParcel = getLandObject(x * 4, (y - 1) * 4); 470 southParcel = getLandObject(x*4, (y - 1)*4);
471 } 471 }
472 472
473 if (x == 0) 473 if (x == 0)
@@ -496,14 +496,15 @@ namespace OpenSim.Region.Environment.LandManagement
496 packet = new ParcelOverlayPacket(); 496 packet = new ParcelOverlayPacket();
497 packet.ParcelData.Data = byteArray; 497 packet.ParcelData.Data = byteArray;
498 packet.ParcelData.SequenceID = sequenceID; 498 packet.ParcelData.SequenceID = sequenceID;
499 remote_client.OutPacket((Packet)packet, ThrottleOutPacketType.Task); 499 remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
500 sequenceID++; 500 sequenceID++;
501 byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 501 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
502 } 502 }
503 } 503 }
504 catch (System.Exception e) 504 catch (Exception e)
505 { 505 {
506 OpenSim.Framework.Console.MainLog.Instance.Debug("LAND", "Skipped Land checks because avatar is out of bounds: " + e.Message); 506 MainLog.Instance.Debug("LAND",
507 "Skipped Land checks because avatar is out of bounds: " + e.Message);
507 } 508 }
508 } 509 }
509 } 510 }
@@ -599,7 +600,6 @@ namespace OpenSim.Region.Environment.LandManagement
599 600
600 public List<Land> parcelsNearPoint(LLVector3 position) 601 public List<Land> parcelsNearPoint(LLVector3 position)
601 { 602 {
602
603 List<Land> parcelsNear = new List<Land>(); 603 List<Land> parcelsNear = new List<Land>();
604 int x, y; 604 int x, y;
605 for (x = -4; x <= 4; x += 4) 605 for (x = -4; x <= 4; x += 4)
@@ -617,22 +617,25 @@ namespace OpenSim.Region.Environment.LandManagement
617 } 617 }
618 } 618 }
619 619
620 return parcelsNear; 620 return parcelsNear;
621
622 } 621 }
623 622
624 public void sendYouAreBannedNotice(ScenePresence avatar) 623 public void sendYouAreBannedNotice(ScenePresence avatar)
625 { 624 {
626 if (allowedForcefulBans) 625 if (allowedForcefulBans)
627 { 626 {
628 avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers"); 627 avatar.ControllingClient.SendAlertMessage(
628 "You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers");
629 629
630 avatar.PhysicsActor.Position = new OpenSim.Region.Physics.Manager.PhysicsVector(avatar.lastKnownAllowedPosition.x, avatar.lastKnownAllowedPosition.y, avatar.lastKnownAllowedPosition.z); 630 avatar.PhysicsActor.Position =
631 avatar.PhysicsActor.Velocity = new OpenSim.Region.Physics.Manager.PhysicsVector(0, 0, 0); 631 new PhysicsVector(avatar.lastKnownAllowedPosition.x, avatar.lastKnownAllowedPosition.y,
632 avatar.lastKnownAllowedPosition.z);
633 avatar.PhysicsActor.Velocity = new PhysicsVector(0, 0, 0);
632 } 634 }
633 else 635 else
634 { 636 {
635 avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim! <3 OpenSim Developers"); 637 avatar.ControllingClient.SendAlertMessage(
638 "You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim! <3 OpenSim Developers");
636 } 639 }
637 } 640 }
638 641
@@ -651,7 +654,8 @@ namespace OpenSim.Region.Environment.LandManagement
651 } 654 }
652 else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID)) 655 else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID))
653 { 656 {
654 avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!). <3 OpenSim Developers"); 657 avatar.ControllingClient.SendAlertMessage(
658 "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!). <3 OpenSim Developers");
655 } 659 }
656 else 660 else
657 { 661 {
@@ -668,7 +672,6 @@ namespace OpenSim.Region.Environment.LandManagement
668 672
669 public void sendOutNearestBanLine(IClientAPI avatar) 673 public void sendOutNearestBanLine(IClientAPI avatar)
670 { 674 {
671
672 List<ScenePresence> avatars = m_scene.GetAvatars(); 675 List<ScenePresence> avatars = m_scene.GetAvatars();
673 foreach (ScenePresence presence in avatars) 676 foreach (ScenePresence presence in avatars)
674 { 677 {
@@ -679,15 +682,14 @@ namespace OpenSim.Region.Environment.LandManagement
679 { 682 {
680 if (checkBan.isBannedFromLand(avatar.AgentId)) 683 if (checkBan.isBannedFromLand(avatar.AgentId))
681 { 684 {
682 checkBan.sendLandProperties(-30000, false, (int)ParcelManager.ParcelResult.Single, avatar); 685 checkBan.sendLandProperties(-30000, false, (int) ParcelManager.ParcelResult.Single, avatar);
683 return; //Only send one 686 return; //Only send one
684 } 687 }
685 else if (checkBan.isRestrictedFromLand(avatar.AgentId)) 688 else if (checkBan.isRestrictedFromLand(avatar.AgentId))
686 { 689 {
687 checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar); 690 checkBan.sendLandProperties(-40000, false, (int) ParcelManager.ParcelResult.Single, avatar);
688 return; //Only send one 691 return; //Only send one
689 } 692 }
690
691 } 693 }
692 return; 694 return;
693 } 695 }
@@ -696,8 +698,8 @@ namespace OpenSim.Region.Environment.LandManagement
696 698
697 public void sendLandUpdate(ScenePresence avatar) 699 public void sendLandUpdate(ScenePresence avatar)
698 { 700 {
699 Land over = getLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), 701 Land over = getLandObject((int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
700 (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); 702 (int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
701 703
702 if (over != null) 704 if (over != null)
703 { 705 {
@@ -705,10 +707,10 @@ namespace OpenSim.Region.Environment.LandManagement
705 if (avatar.currentParcelUUID != over.landData.globalID) 707 if (avatar.currentParcelUUID != over.landData.globalID)
706 { 708 {
707 avatar.currentParcelUUID = over.landData.globalID; 709 avatar.currentParcelUUID = over.landData.globalID;
708 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, this.m_scene.RegionInfo.RegionID); 710 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID,
711 m_scene.RegionInfo.RegionID);
709 } 712 }
710 } 713 }
711
712 } 714 }
713 715
714 public void handleSignificantClientMovement(IClientAPI remote_client) 716 public void handleSignificantClientMovement(IClientAPI remote_client)
@@ -722,16 +724,18 @@ namespace OpenSim.Region.Environment.LandManagement
722 Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); 724 Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
723 if (parcel != null) 725 if (parcel != null)
724 { 726 {
725 if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) 727 if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT &&
728 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
726 { 729 {
727 730 handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID);
728 handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID); //They are going below the safety line! 731 //They are going below the safety line!
729 if (!parcel.isBannedFromLand(clientAvatar.UUID)) 732 if (!parcel.isBannedFromLand(clientAvatar.UUID))
730 { 733 {
731 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; 734 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
732 } 735 }
733 } 736 }
734 else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && parcel.isBannedFromLand(clientAvatar.UUID)) 737 else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT &&
738 parcel.isBannedFromLand(clientAvatar.UUID))
735 { 739 {
736 sendYouAreBannedNotice(clientAvatar); 740 sendYouAreBannedNotice(clientAvatar);
737 } 741 }
@@ -739,30 +743,33 @@ namespace OpenSim.Region.Environment.LandManagement
739 } 743 }
740 } 744 }
741 745
742 public void handleAnyClientMovement(ScenePresence avatar) //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance. 746 public void handleAnyClientMovement(ScenePresence avatar)
747 //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance.
743 { 748 {
744 Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 749 Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
745 if (over != null) 750 if (over != null)
746 { 751 {
747 if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT) 752 if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT)
748 { 753 {
749 avatar.lastKnownAllowedPosition = new Axiom.Math.Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); 754 avatar.lastKnownAllowedPosition =
750 755 new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
751
752 } 756 }
753 } 757 }
754 } 758 }
755 759
756 760
757 public void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client) 761 public void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID,
762 int landLocalID, IClientAPI remote_client)
758 { 763 {
759 if (landList.ContainsKey(landLocalID)) 764 if (landList.ContainsKey(landLocalID))
760 { 765 {
761 landList[landLocalID].sendAccessList(agentID, sessionID, flags, sequenceID,remote_client); 766 landList[landLocalID].sendAccessList(agentID, sessionID, flags, sequenceID, remote_client);
762 } 767 }
763 } 768 }
764 769
765 public void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID,uint flags, int landLocalID, List<libsecondlife.ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 770 public void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID,
771 List<ParcelManager.ParcelAccessEntry> entries,
772 IClientAPI remote_client)
766 { 773 {
767 if (landList.ContainsKey(landLocalID)) 774 if (landList.ContainsKey(landLocalID))
768 { 775 {
@@ -849,4 +856,4 @@ namespace OpenSim.Region.Environment.LandManagement
849 } 856 }
850 857
851 #endregion 858 #endregion
852} 859} \ No newline at end of file