aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs24
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs111
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs42
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs7
5 files changed, 144 insertions, 44 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 4cfb0c1..da17a69 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -227,10 +227,14 @@ namespace OpenSim.Region.Environment.LandManagement
227 } 227 }
228 } 228 }
229 229
230 public bool isBannedFromLand(ParcelManager.ParcelAccessEntry entry, IClientAPI remote_client) 230 public bool isBannedFromLand(LLUUID avatar)
231 { 231 {
232 if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseBanList) > 0) 232 if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseBanList) > 0)
233 { 233 {
234 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
235 entry.AgentID = avatar;
236 entry.Flags = ParcelManager.AccessList.Ban;
237 entry.Time = new DateTime();
234 if (this.landData.parcelAccessList.Contains(entry)) 238 if (this.landData.parcelAccessList.Contains(entry))
235 { 239 {
236 //They are banned, so lets send them a notice about this parcel 240 //They are banned, so lets send them a notice about this parcel
@@ -239,6 +243,24 @@ namespace OpenSim.Region.Environment.LandManagement
239 } 243 }
240 return false; 244 return false;
241 } 245 }
246
247 public bool isRestrictedFromLand(LLUUID avatar)
248 {
249 if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseAccessList) > 0)
250 {
251 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
252 entry.AgentID = avatar;
253 entry.Flags = ParcelManager.AccessList.Access;
254 entry.Time = new DateTime();
255 if (!this.landData.parcelAccessList.Contains(entry))
256 {
257 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
258 return true;
259 }
260 }
261 return false;
262 }
263
242 public void sendLandUpdateToClient(IClientAPI remote_client) 264 public void sendLandUpdateToClient(IClientAPI remote_client)
243 { 265 {
244 sendLandProperties(0, false, 0, remote_client); 266 sendLandProperties(0, false, 0, remote_client);
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 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index eec07fc..474d8d5 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -230,8 +230,8 @@ namespace OpenSim.Region.Environment.Scenes
230 m_LandManager = new LandManager(this, m_regInfo); 230 m_LandManager = new LandManager(this, m_regInfo);
231 231
232 //Bind Storage Manager functions to some land manager functions for this scene 232 //Bind Storage Manager functions to some land manager functions for this scene
233 m_LandManager.OnLandObjectAdded += new LandManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); 233 EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
234 m_LandManager.OnLandObjectRemoved += new LandManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); 234 EventManager.OnLandObjectRemoved += new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
235 235
236 m_estateManager = new EstateManager(this, m_regInfo); 236 m_estateManager = new EstateManager(this, m_regInfo);
237 237
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index e058745..694c548 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -29,6 +29,7 @@
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.Environment.LandManagement;
32 33
33namespace OpenSim.Region.Environment.Scenes 34namespace OpenSim.Region.Environment.Scenes
34{ 35{
@@ -78,6 +79,7 @@ namespace OpenSim.Region.Environment.Scenes
78 public delegate void OnPermissionErrorDelegate(LLUUID user, string reason); 79 public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
79 80
80 public event ObjectGrabDelegate OnObjectGrab; 81 public event ObjectGrabDelegate OnObjectGrab;
82
81 public event OnPermissionErrorDelegate OnPermissionError; 83 public event OnPermissionErrorDelegate OnPermissionError;
82 84
83 public delegate void NewRezScript(uint localID, LLUUID itemID, string script); 85 public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
@@ -96,6 +98,18 @@ namespace OpenSim.Region.Environment.Scenes
96 98
97 public event SceneGroupGrabed OnSceneGroupGrab; 99 public event SceneGroupGrabed OnSceneGroupGrab;
98 100
101 public delegate void LandObjectAdded(Land newParcel, LLUUID regionUUID);
102
103 public event LandObjectAdded OnLandObjectAdded;
104
105 public delegate void LandObjectRemoved(LLUUID globalID);
106
107 public event LandObjectRemoved OnLandObjectRemoved;
108
109 public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID);
110
111 public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
112
99 public void TriggerPermissionError(LLUUID user, string reason) 113 public void TriggerPermissionError(LLUUID user, string reason)
100 { 114 {
101 if (OnPermissionError != null) 115 if (OnPermissionError != null)
@@ -210,5 +224,33 @@ namespace OpenSim.Region.Environment.Scenes
210 OnSceneGroupGrab(groupID, offset, userID); 224 OnSceneGroupGrab(groupID, offset, userID);
211 } 225 }
212 } 226 }
227
228 public void TriggerLandObjectAdded(Land newParcel,LLUUID regionID)
229 {
230 if (OnLandObjectAdded != null)
231 {
232 OnLandObjectAdded(newParcel, regionID);
233 }
234 }
235 public void TriggerLandObjectRemoved(LLUUID globalID)
236 {
237 if (OnLandObjectRemoved != null)
238 {
239 OnLandObjectRemoved(globalID);
240 }
241 }
242 public void TriggerLandObjectUpdated(uint localParcelID, Land newParcel)
243 {
244 //triggerLandObjectRemoved(localParcelID);
245 TriggerLandObjectAdded(newParcel,newParcel.m_scene.RegionInfo.RegionID);
246 }
247
248 public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
249 {
250 if (OnAvatarEnteringNewParcel != null)
251 {
252 OnAvatarEnteringNewParcel(avatar, localLandID, regionID);
253 }
254 }
213 } 255 }
214} \ No newline at end of file 256} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 89701d7..2f074d0 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
42 { 42 {
43 public static AvatarAnimations Animations; 43 public static AvatarAnimations Animations;
44 public static byte[] DefaultTexture; 44 public static byte[] DefaultTexture;
45 45 public LLUUID currentParcelUUID = LLUUID.Zero;
46 private List<LLUUID> m_animations = new List<LLUUID>(); 46 private List<LLUUID> m_animations = new List<LLUUID>();
47 private List<int> m_animationSeqs = new List<int>(); 47 private List<int> m_animationSeqs = new List<int>();
48 48
@@ -448,6 +448,11 @@ namespace OpenSim.Region.Environment.Scenes
448 } 448 }
449 } 449 }
450 450
451 public void forceAvatarMovement(Vector3 position, Quaternion rotation)
452 {
453 AddNewMovement(position, rotation);
454 }
455
451 #region Status Methods 456 #region Status Methods
452 /// <summary> 457 /// <summary>
453 /// This turns a child agent, into a root agent 458 /// This turns a child agent, into a root agent