aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/LandManagement/LandManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/LandManagement/LandManager.cs')
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs111
1 files changed, 71 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index 59bf7f8..5e243d1 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -76,35 +76,6 @@ namespace OpenSim.Region.Environment.LandManagement
76 76
77 #endregion 77 #endregion
78 78
79 #region Events and Triggers
80 public delegate void LandObjectAdded(Land newParcel, LLUUID regionUUID);
81 public delegate void LandObjectRemoved(LLUUID globalID);
82
83 public event LandObjectAdded OnLandObjectAdded;
84 public event LandObjectRemoved OnLandObjectRemoved;
85
86 public void triggerLandObjectAdded(Land newParcel)
87 {
88 if (OnLandObjectAdded != null)
89 {
90 OnLandObjectAdded(newParcel, m_scene.RegionInfo.RegionID);
91 }
92 }
93 public void triggerLandObjectRemoved(LLUUID globalID)
94 {
95 if (OnLandObjectRemoved != null)
96 {
97 OnLandObjectRemoved(globalID);
98 }
99 }
100 public void triggerLandObjectUpdated(uint localParcelID, Land newParcel)
101 {
102 //triggerLandObjectRemoved(localParcelID);
103 triggerLandObjectAdded(newParcel);
104 }
105
106 #endregion
107
108 #region Member Variables 79 #region Member Variables
109 80
110 public Dictionary<int, Land> landList = new Dictionary<int, Land>(); 81 public Dictionary<int, Land> landList = new Dictionary<int, Land>();
@@ -128,6 +99,8 @@ namespace OpenSim.Region.Environment.LandManagement
128 m_scene = scene; 99 m_scene = scene;
129 m_regInfo = reginfo; 100 m_regInfo = reginfo;
130 landIDList.Initialize(); 101 landIDList.Initialize();
102 scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel);
103
131 } 104 }
132 105
133 106
@@ -170,6 +143,7 @@ namespace OpenSim.Region.Environment.LandManagement
170 /// <returns></returns> 143 /// <returns></returns>
171 public Land createBaseLand() 144 public Land createBaseLand()
172 { 145 {
146
173 return new Land(LLUUID.Zero, false, m_scene); 147 return new Land(LLUUID.Zero, false, m_scene);
174 } 148 }
175 149
@@ -197,7 +171,7 @@ namespace OpenSim.Region.Environment.LandManagement
197 } 171 }
198 } 172 }
199 landList[lastLandLocalID].forceUpdateLandInfo(); 173 landList[lastLandLocalID].forceUpdateLandInfo();
200 triggerLandObjectAdded(new_land); 174 m_scene.EventManager.TriggerLandObjectAdded(new_land,m_scene.RegionInfo.RegionID);
201 return new_land; 175 return new_land;
202 } 176 }
203 177
@@ -219,7 +193,7 @@ namespace OpenSim.Region.Environment.LandManagement
219 } 193 }
220 } 194 }
221 195
222 triggerLandObjectRemoved(landList[local_id].landData.globalID); 196 m_scene.EventManager.TriggerLandObjectRemoved(landList[local_id].landData.globalID);
223 landList.Remove(local_id); 197 landList.Remove(local_id);
224 } 198 }
225 199
@@ -228,7 +202,7 @@ namespace OpenSim.Region.Environment.LandManagement
228 if (landList.ContainsKey(local_id)) 202 if (landList.ContainsKey(local_id))
229 { 203 {
230 landList[local_id].landData = newData.Copy(); 204 landList[local_id].landData = newData.Copy();
231 triggerLandObjectUpdated((uint)local_id, landList[local_id]); 205 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landList[local_id]);
232 } 206 }
233 else 207 else
234 { 208 {
@@ -590,18 +564,70 @@ namespace OpenSim.Region.Environment.LandManagement
590 addLandObject(fullSimParcel); 564 addLandObject(fullSimParcel);
591 } 565 }
592 566
593 public void sendOutBannedNotices(IClientAPI avatar) 567 public List<Land> parcelsNearPoint(LLVector3 position)
568 {
569
570 List<Land> parcelsNear = new List<Land>();
571 int x, y;
572 for (x = -4; x <= 4; x += 4)
573 {
574 for (y = -4; y <= 4; y += 4)
575 {
576 Land check = getLandObject(position.X + x, position.Y + y);
577 if (!parcelsNear.Contains(check))
578 {
579 parcelsNear.Add(check);
580 }
581 }
582 }
583
584 return parcelsNear;
585
586 }
587
588 public void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
594 { 589 {
595 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 590 if (m_scene.RegionInfo.RegionID == regionID)
596 entry.AgentID = avatar.AgentId; 591 {
597 entry.Flags = ParcelManager.AccessList.Ban; 592 if (landList[localLandID] != null)
598 entry.Time = new DateTime(); 593 {
594 Land parcelAvatarIsEntering = landList[localLandID];
595 if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID))
596 {
597 avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers");
598
599 }
600 else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID))
601 {
602 avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because the land owner has restricted access. Please go away. <3 OpenSim Developers");
603 }
604 }
605 }
606 }
599 607
600 foreach (Land checkBan in landList.Values) 608 public void sendOutBannedNotices(IClientAPI avatar)
609 {
610
611 List<ScenePresence> avatars = m_scene.GetAvatars();
612 foreach (ScenePresence presence in avatars)
601 { 613 {
602 if (checkBan.isBannedFromLand(entry, avatar)) 614 if (presence.UUID == avatar.AgentId)
603 { 615 {
604 checkBan.sendLandProperties(-30000, false, (int)ParcelManager.ParcelResult.Single, avatar); 616 List<Land> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition);
617 foreach (Land checkBan in checkLandParcels)
618 {
619 if (checkBan.isBannedFromLand(avatar.AgentId))
620 {
621 checkBan.sendLandProperties(-30000, false, (int)ParcelManager.ParcelResult.Single, avatar);
622 return; //Only send one
623 }
624 else if (checkBan.isRestrictedFromLand(avatar.AgentId))
625 {
626 checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar);
627 return; //Only send one
628 }
629 }
630 return;
605 } 631 }
606 } 632 }
607 } 633 }
@@ -614,6 +640,11 @@ namespace OpenSim.Region.Environment.LandManagement
614 if (over != null) 640 if (over != null)
615 { 641 {
616 over.sendLandUpdateToClient(avatar.ControllingClient); 642 over.sendLandUpdateToClient(avatar.ControllingClient);
643 if (avatar.currentParcelUUID != over.landData.globalID)
644 {
645 avatar.currentParcelUUID = over.landData.globalID;
646 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, this.m_scene.RegionInfo.RegionID);
647 }
617 } 648 }
618 649
619 } 650 }