aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authormingchen2008-05-23 15:12:15 +0000
committermingchen2008-05-23 15:12:15 +0000
commitd04443b4fe0fb3993b53086d95be97a766b409f6 (patch)
treed6989220bdb1aad7e49546108f9624227c3f07f8 /OpenSim/Region/Environment/Scenes
parenti've refactored the ChatModule into two modules: ChatModule and IRCBridgeModule. (diff)
downloadopensim-SC_OLD-d04443b4fe0fb3993b53086d95be97a766b409f6.zip
opensim-SC_OLD-d04443b4fe0fb3993b53086d95be97a766b409f6.tar.gz
opensim-SC_OLD-d04443b4fe0fb3993b53086d95be97a766b409f6.tar.bz2
opensim-SC_OLD-d04443b4fe0fb3993b53086d95be97a766b409f6.tar.xz
*Refactor of the LandManagementModule that allows OpenSim to run without it
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/EventManager.cs89
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs35
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs13
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs10
5 files changed, 100 insertions, 51 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs
index e0a24a6..f8eef82 100644
--- a/OpenSim/Region/Environment/Scenes/EventManager.cs
+++ b/OpenSim/Region/Environment/Scenes/EventManager.cs
@@ -30,6 +30,7 @@ using libsecondlife;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
32using Caps=OpenSim.Framework.Communications.Capabilities.Caps; 32using Caps=OpenSim.Framework.Communications.Capabilities.Caps;
33using System.Collections.Generic;
33 34
34namespace OpenSim.Region.Environment.Scenes 35namespace OpenSim.Region.Environment.Scenes
35{ 36{
@@ -169,6 +170,26 @@ namespace OpenSim.Region.Environment.Scenes
169 170
170 public event AvatarKillData OnAvatarKilled; 171 public event AvatarKillData OnAvatarKilled;
171 172
173
174
175 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
176 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
177
178 public delegate void NoticeNoLandDataFromStorage();
179 public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage;
180
181 public delegate void IncomingLandDataFromStorage(List<LandData> data);
182 public event IncomingLandDataFromStorage OnIncomingLandDataFromStorage;
183
184 public delegate void SetAllowForcefulBan(bool allow);
185 public event SetAllowForcefulBan OnSetAllowForcefulBan;
186
187 public delegate void RequestParcelPrimCountUpdate();
188 public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate;
189
190 public delegate void ParcelPrimCountTainted();
191 public event ParcelPrimCountTainted OnParcelPrimCountTainted;
192
172 /// <summary> 193 /// <summary>
173 /// RegisterCapsEvent is called by Scene after the Caps object 194 /// RegisterCapsEvent is called by Scene after the Caps object
174 /// has been instantiated and before it is return to the 195 /// has been instantiated and before it is return to the
@@ -300,6 +321,13 @@ namespace OpenSim.Region.Environment.Scenes
300 private LandBuy handlerValidateLandBuy = null; 321 private LandBuy handlerValidateLandBuy = null;
301 private AvatarKillData handlerAvatarKill = null; 322 private AvatarKillData handlerAvatarKill = null;
302 323
324 private NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = null;
325 private IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = null;
326 private SetAllowForcefulBan handlerSetAllowForcefulBan = null;
327 private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null;
328 private ParcelPrimCountTainted handlerParcelPrimCountTainted = null;
329 private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null;
330
303 public void TriggerOnScriptChangedEvent(uint localID, uint change) 331 public void TriggerOnScriptChangedEvent(uint localID, uint change)
304 { 332 {
305 handlerScriptChangedEvent = OnScriptChangedEvent; 333 handlerScriptChangedEvent = OnScriptChangedEvent;
@@ -651,5 +679,66 @@ namespace OpenSim.Region.Environment.Scenes
651 handlerScriptControlEvent(p, scriptUUID, avatarID, held, _changed); 679 handlerScriptControlEvent(p, scriptUUID, avatarID, held, _changed);
652 } 680 }
653 } 681 }
682
683
684 public void TriggerNoticeNoLandDataFromStorage()
685 {
686 handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage;
687 if (handlerNoticeNoLandDataFromStorage != null)
688 {
689 handlerNoticeNoLandDataFromStorage();
690
691 }
692 }
693
694 public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
695 {
696 handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage;
697 if (handlerIncomingLandDataFromStorage != null)
698 {
699 handlerIncomingLandDataFromStorage(landData);
700
701 }
702 }
703
704 public void TriggerSetAllowForcefulBan(bool allow)
705 {
706 handlerSetAllowForcefulBan = OnSetAllowForcefulBan;
707 if (handlerSetAllowForcefulBan != null)
708 {
709 handlerSetAllowForcefulBan(allow);
710
711 }
712 }
713
714 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
715 {
716 handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
717 if (handlerObjectBeingRemovedFromScene != null)
718 {
719 handlerObjectBeingRemovedFromScene(obj);
720
721 }
722 }
723
724
725 public void TriggerRequestParcelPrimCountUpdate()
726 {
727 handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate;
728 if (handlerRequestParcelPrimCountUpdate != null)
729 {
730 handlerRequestParcelPrimCountUpdate();
731
732 }
733 }
734 public void TriggerParcelPrimCountTainted()
735 {
736 handlerParcelPrimCountTainted = OnParcelPrimCountTainted;
737 if (handlerParcelPrimCountTainted != null)
738 {
739 handlerParcelPrimCountTainted();
740
741 }
742 }
654 } 743 }
655} 744}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 9eb86cb..788e80a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Scenes
86 // A prim is only tainted if it's allowed to be edited by the person clicking it. 86 // A prim is only tainted if it's allowed to be edited by the person clicking it.
87 if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) 87 if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId))
88 { 88 {
89 LandChannel.SetPrimsTainted(); 89 EventManager.TriggerParcelPrimCountTainted();
90 } 90 }
91 break; 91 break;
92 } 92 }
@@ -113,7 +113,7 @@ namespace OpenSim.Region.Environment.Scenes
113 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); 113 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
114 if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) 114 if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId))
115 { 115 {
116 LandChannel.SetPrimsTainted(); 116 EventManager.TriggerParcelPrimCountTainted();
117 break; 117 break;
118 } 118 }
119 } 119 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 774ddfc..fe8cada 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -819,7 +819,7 @@ namespace OpenSim.Region.Environment.Scenes
819 { 819 {
820 if (LandChannel.IsLandPrimCountTainted()) 820 if (LandChannel.IsLandPrimCountTainted())
821 { 821 {
822 LandChannel.PerformParcelPrimCountUpdate(); 822 EventManager.TriggerParcelPrimCountUpdate();
823 } 823 }
824 } 824 }
825 } 825 }
@@ -970,12 +970,12 @@ namespace OpenSim.Region.Environment.Scenes
970 if (dGridSettings["allow_forceful_banlines"] != "TRUE") 970 if (dGridSettings["allow_forceful_banlines"] != "TRUE")
971 { 971 {
972 m_log.Info("[GRID]: Grid is disabling forceful parcel banlists"); 972 m_log.Info("[GRID]: Grid is disabling forceful parcel banlists");
973 LandChannel.AllowedForcefulBans = false; 973 EventManager.TriggerSetAllowForcefulBan(false);
974 } 974 }
975 else 975 else
976 { 976 {
977 m_log.Info("[GRID]: Grid is allowing forceful parcel banlists"); 977 m_log.Info("[GRID]: Grid is allowing forceful parcel banlists");
978 LandChannel.AllowedForcefulBans = true; 978 EventManager.TriggerSetAllowForcefulBan(true);
979 } 979 }
980 } 980 }
981 } 981 }
@@ -1142,11 +1142,11 @@ namespace OpenSim.Region.Environment.Scenes
1142 { 1142 {
1143 if (landData.Count == 0) 1143 if (landData.Count == 0)
1144 { 1144 {
1145 LandChannel.NoLandDataFromStorage(); 1145 EventManager.TriggerNoticeNoLandDataFromStorage();
1146 } 1146 }
1147 else 1147 else
1148 { 1148 {
1149 LandChannel.IncomingLandObjectsFromStorage(landData); 1149 EventManager.TriggerIncomingLandDataFromStorage(landData);
1150 } 1150 }
1151 } 1151 }
1152 else 1152 else
@@ -1344,22 +1344,13 @@ namespace OpenSim.Region.Environment.Scenes
1344 { 1344 {
1345 if (Entities.ContainsKey(sceneObject.UUID)) 1345 if (Entities.ContainsKey(sceneObject.UUID))
1346 { 1346 {
1347 LandChannel.RemovePrimFromLandPrimCounts(sceneObject); 1347 EventManager.TriggerObjectBeingRemovedFromScene(sceneObject);
1348 Entities.Remove(sceneObject.UUID); 1348 Entities.Remove(sceneObject.UUID);
1349 LandChannel.SetPrimsTainted(); 1349 EventManager.TriggerParcelPrimCountTainted();
1350 m_innerScene.RemoveAPrimCount(); 1350 m_innerScene.RemoveAPrimCount();
1351 } 1351 }
1352 } 1352 }
1353 1353
1354 /// <summary>
1355 /// Called by a prim when it has been created/cloned, so that its events can be subscribed to
1356 /// </summary>
1357 /// <param name="prim"></param>
1358 public void AcknowledgeNewPrim(SceneObjectGroup prim)
1359 {
1360 prim.OnPrimCountTainted += LandChannel.SetPrimsTainted;
1361 }
1362
1363 public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) 1354 public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset)
1364 { 1355 {
1365 m_sceneXmlLoader.LoadPrimsFromXml(fileName, newIdsFlag, loadOffset); 1356 m_sceneXmlLoader.LoadPrimsFromXml(fileName, newIdsFlag, loadOffset);
@@ -1589,15 +1580,6 @@ namespace OpenSim.Region.Environment.Scenes
1589 1580
1590 CreateAndAddScenePresence(client, child); 1581 CreateAndAddScenePresence(client, child);
1591 1582
1592 try
1593 {
1594 LandChannel.SendParcelOverlay(client);
1595 } //BUG: Mike - please fix this.
1596 catch (KeyNotFoundException)
1597 {
1598 m_log.Warn("[LAND]: Bug #2 triggered with NPC. LandModule needs a refactor to fix this.");
1599 }
1600
1601 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 1583 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
1602 } 1584 }
1603 } 1585 }
@@ -3174,8 +3156,7 @@ namespace OpenSim.Region.Environment.Scenes
3174 3156
3175 lock (Entities) 3157 lock (Entities)
3176 { 3158 {
3177 Entities.Remove(group.UUID); 3159 RemoveEntity(group);
3178 m_innerScene.RemoveAPrimCount();
3179 } 3160 }
3180 group.DeleteParts(); 3161 group.DeleteParts();
3181 3162
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 35c563b..a99426a 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -601,7 +601,6 @@ namespace OpenSim.Region.Environment.Scenes
601 601
602 #endregion 602 #endregion
603 603
604 public event PrimCountTaintedDelegate OnPrimCountTainted;
605 604
606 public string ToXmlString() 605 public string ToXmlString()
607 { 606 {
@@ -1068,18 +1067,6 @@ namespace OpenSim.Region.Environment.Scenes
1068 #region Events 1067 #region Events
1069 1068
1070 /// <summary> 1069 /// <summary>
1071 ///
1072 /// </summary>
1073 public void TriggerTainted()
1074 {
1075 handlerPrimCountTainted = OnPrimCountTainted;
1076 if (handlerPrimCountTainted != null)
1077 {
1078 handlerPrimCountTainted();
1079 }
1080 }
1081
1082 /// <summary>
1083 /// Processes backup 1070 /// Processes backup
1084 /// </summary> 1071 /// </summary>
1085 /// <param name="datastore"></param> 1072 /// <param name="datastore"></param>
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 0dbd6dd..103068c 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -405,14 +405,7 @@ namespace OpenSim.Region.Environment.Scenes
405 RegisterToEvents(); 405 RegisterToEvents();
406 SetDirectionVectors(); 406 SetDirectionVectors();
407 407
408 try 408
409 {
410 m_scene.LandChannel.SendLandUpdate(this, true);
411 } //BUG: Mike - please fix this.
412 catch (KeyNotFoundException)
413 {
414 m_log.Warn("[LAND]: Bug triggered with NPC. LandModule needs a refactor to fix this.");
415 }
416 } 409 }
417 410
418 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, 411 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
@@ -596,7 +589,6 @@ namespace OpenSim.Region.Environment.Scenes
596 //if (!m_gotAllObjectsInScene) 589 //if (!m_gotAllObjectsInScene)
597 //{ 590 //{
598 m_scene.SendAllSceneObjectsToClient(this); 591 m_scene.SendAllSceneObjectsToClient(this);
599 m_scene.LandChannel.SendLandUpdate(this, true);
600 592
601 //m_gotAllObjectsInScene = true; 593 //m_gotAllObjectsInScene = true;
602 //} 594 //}