aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
authorMW2007-08-28 14:21:17 +0000
committerMW2007-08-28 14:21:17 +0000
commit8e3b2392d129d727bfd00a2d9faa08d9e5be92de (patch)
tree7e6b89ee495af1d5ea76c58fc0796a3bb38ecc5d /OpenSim/Region/Environment/Scenes/Scene.cs
parentEnsure that UserProfileData doesn't pass down null values. (diff)
downloadopensim-SC_OLD-8e3b2392d129d727bfd00a2d9faa08d9e5be92de.zip
opensim-SC_OLD-8e3b2392d129d727bfd00a2d9faa08d9e5be92de.tar.gz
opensim-SC_OLD-8e3b2392d129d727bfd00a2d9faa08d9e5be92de.tar.bz2
opensim-SC_OLD-8e3b2392d129d727bfd00a2d9faa08d9e5be92de.tar.xz
Start of trying to make Region/Scene more modular.
Added preliminary IRegionModule interface. Also have a work in progress way of Modules registering optional API methods (kind of like Apache optional functions). But there must be a cleaner/nicer way in c# of doing these than the current way. Added three work in progress modules: ChatModule (simple handles in world chat, but by moving this to a module, we could support other types of chat modules, ie like a irc - opensim bridge module. ) , AvatarProfilesModule and XferModule. Moved most of the code from Scene.ModifyTerrain() into the BasicTerrain library, as the start of trying to make that more modular. Stopped Child agents showing up as part of the "show users" command.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs62
1 files changed, 54 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 2259a3e..b2ddb7d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -42,6 +42,8 @@ using OpenSim.Framework.Utilities;
42using OpenSim.Physics.Manager; 42using OpenSim.Physics.Manager;
43using OpenSim.Framework.Communications.Caches; 43using OpenSim.Framework.Communications.Caches;
44using OpenSim.Region.Environment.LandManagement; 44using OpenSim.Region.Environment.LandManagement;
45using OpenSim.Region.Environment;
46using OpenSim.Region.Environment.Interfaces;
45using OpenSim.Region.Scripting; 47using OpenSim.Region.Scripting;
46using OpenSim.Region.Terrain; 48using OpenSim.Region.Terrain;
47using OpenSim.Framework.Data; 49using OpenSim.Framework.Data;
@@ -73,15 +75,24 @@ namespace OpenSim.Region.Environment.Scenes
73 75
74 private Mutex updateLock; 76 private Mutex updateLock;
75 77
78 protected ModuleLoader m_moduleLoader;
76 protected StorageManager storageManager; 79 protected StorageManager storageManager;
77 protected AgentCircuitManager authenticateHandler; 80 protected AgentCircuitManager authenticateHandler;
78 protected RegionCommsListener regionCommsHost; 81 protected RegionCommsListener regionCommsHost;
79 protected CommunicationsManager commsManager; 82 protected CommunicationsManager commsManager;
80 protected XferManager xferManager; 83 // protected XferManager xferManager;
81 84
82 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); 85 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>();
83 protected BaseHttpServer httpListener; 86 protected BaseHttpServer httpListener;
84 87
88 protected Dictionary<string, IRegionModule> Modules = new Dictionary<string, IRegionModule>();
89 protected Dictionary<string, object> APIMethods = new Dictionary<string, object>();
90
91 //API method Delegates
92
93 // this most likely shouldn't be handled as a API method like this, but doing it for testing purposes
94 public ModuleAPIMethod<bool, string, byte[]>AddXferFile = null;
95
85 #region Properties 96 #region Properties
86 97
87 public AgentCircuitManager AuthenticateHandler 98 public AgentCircuitManager AuthenticateHandler
@@ -146,9 +157,11 @@ namespace OpenSim.Region.Environment.Scenes
146 /// <param name="regionHandle">Region Handle for this region</param> 157 /// <param name="regionHandle">Region Handle for this region</param>
147 /// <param name="regionName">Region Name for this region</param> 158 /// <param name="regionName">Region Name for this region</param>
148 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, 159 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
149 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer) 160 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, ModuleLoader moduleLoader)
150 { 161 {
151 updateLock = new Mutex(false); 162 updateLock = new Mutex(false);
163
164 m_moduleLoader = moduleLoader;
152 authenticateHandler = authen; 165 authenticateHandler = authen;
153 commsManager = commsMan; 166 commsManager = commsMan;
154 storageManager = storeManager; 167 storageManager = storeManager;
@@ -164,8 +177,10 @@ namespace OpenSim.Region.Environment.Scenes
164 m_scriptManager = new ScriptManager(this); 177 m_scriptManager = new ScriptManager(this);
165 m_eventManager = new EventManager(); 178 m_eventManager = new EventManager();
166 m_permissionManager = new PermissionManager(this); 179 m_permissionManager = new PermissionManager(this);
167 xferManager = new XferManager();
168 180
181 MainLog.Instance.Verbose("Loading Region Modules");
182 m_moduleLoader.LoadInternalModules(this);
183
169 m_eventManager.OnParcelPrimCountAdd += 184 m_eventManager.OnParcelPrimCountAdd +=
170 m_LandManager.addPrimToLandPrimCounts; 185 m_LandManager.addPrimToLandPrimCounts;
171 186
@@ -182,10 +197,17 @@ namespace OpenSim.Region.Environment.Scenes
182 ScenePresence.LoadAnims(); 197 ScenePresence.LoadAnims();
183 198
184 httpListener = httpServer; 199 httpListener = httpServer;
200
201 SetMethodDelegates();
185 } 202 }
186 203
187 #endregion 204 #endregion
188 205
206 private void SetMethodDelegates()
207 {
208 AddXferFile = (ModuleAPIMethod<bool, string, byte[]>)this.RequestAPIMethod("API_AddXferFile");
209 }
210
189 #region Script Handling Methods 211 #region Script Handling Methods
190 212
191 public void SendCommandToScripts(string[] args) 213 public void SendCommandToScripts(string[] args)
@@ -682,7 +704,7 @@ namespace OpenSim.Region.Environment.Scenes
682 client.OnRegionHandShakeReply += SendLayerData; 704 client.OnRegionHandShakeReply += SendLayerData;
683 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); 705 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
684 client.OnModifyTerrain += ModifyTerrain; 706 client.OnModifyTerrain += ModifyTerrain;
685 client.OnChatFromViewer += SimChat; 707 //client.OnChatFromViewer += SimChat;
686 client.OnInstantMessage += InstantMessage; 708 client.OnInstantMessage += InstantMessage;
687 client.OnRequestWearables += InformClientOfNeighbours; 709 client.OnRequestWearables += InformClientOfNeighbours;
688 client.OnAddPrim += AddNewPrim; 710 client.OnAddPrim += AddNewPrim;
@@ -725,15 +747,14 @@ namespace OpenSim.Region.Environment.Scenes
725 client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset; 747 client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset;
726 client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; 748 client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest;
727 client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; 749 client.OnXferReceive += commsManager.TransactionsManager.HandleXfer;
728 // client.OnRequestXfer += RequestXfer;
729 client.OnRequestXfer += xferManager.RequestXfer;
730 client.OnConfirmXfer += xferManager.AckPacket;
731 client.OnRezScript += RezScript; 750 client.OnRezScript += RezScript;
732 client.OnRemoveTaskItem += RemoveTaskInventory; 751 client.OnRemoveTaskItem += RemoveTaskInventory;
733 752
734 client.OnRequestAvatarProperties += RequestAvatarProperty; 753 // client.OnRequestAvatarProperties += RequestAvatarProperty;
735 754
736 client.OnGrabObject += ProcessObjectGrab; 755 client.OnGrabObject += ProcessObjectGrab;
756
757 EventManager.TriggerOnNewClient(client);
737 } 758 }
738 759
739 protected ScenePresence CreateAndAddScenePresence(IClientAPI client) 760 protected ScenePresence CreateAndAddScenePresence(IClientAPI client)
@@ -1093,6 +1114,31 @@ namespace OpenSim.Region.Environment.Scenes
1093 1114
1094 #endregion 1115 #endregion
1095 1116
1117 public void AddModule(string name, IRegionModule module)
1118 {
1119 if (!this.Modules.ContainsKey(name))
1120 {
1121 Modules.Add(name, module);
1122 }
1123 }
1124
1125 public void RegisterAPIMethod(string name, object method)
1126 {
1127 if (!this.APIMethods.ContainsKey(name))
1128 {
1129 this.APIMethods.Add(name, method);
1130 }
1131 }
1132
1133 public object RequestAPIMethod(string name)
1134 {
1135 if (this.APIMethods.ContainsKey(name))
1136 {
1137 return APIMethods[name];
1138 }
1139 return false;
1140 }
1141
1096 public void SetTimePhase(int phase) 1142 public void SetTimePhase(int phase)
1097 { 1143 {
1098 m_timePhase = phase; 1144 m_timePhase = phase;