RegionCombinerModule.cs 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Reflection;
  30. using log4net;
  31. using Nini.Config;
  32. using OpenMetaverse;
  33. using OpenSim.Framework;
  34. using OpenSim.Framework.Client;
  35. using OpenSim.Region.Framework.Interfaces;
  36. using OpenSim.Region.Framework.Scenes;
  37. using OpenSim.Framework.Console;
  38. using OpenSim.Region.Physics.Manager;
  39. using Mono.Addins;
  40. [assembly: Addin("RegionCombinerModule", "0.1")]
  41. [assembly: AddinDependency("OpenSim", "0.5")]
  42. namespace OpenSim.Region.RegionCombinerModule
  43. {
  44. [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
  45. public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule
  46. {
  47. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  48. public string Name
  49. {
  50. get { return "RegionCombinerModule"; }
  51. }
  52. public Type ReplaceableInterface
  53. {
  54. get { return null; }
  55. }
  56. /// <summary>
  57. /// Is this module enabled?
  58. /// </summary>
  59. private bool m_combineContiguousRegions = false;
  60. /// <summary>
  61. /// This holds the root regions for the megaregions.
  62. /// </summary>
  63. /// <remarks>
  64. /// Usually there is only ever one megaregion (and hence only one entry here).
  65. /// </remarks>
  66. private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
  67. /// <summary>
  68. /// The scenes that comprise the megaregion.
  69. /// </summary>
  70. private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
  71. public void Initialise(IConfigSource source)
  72. {
  73. IConfig myConfig = source.Configs["Startup"];
  74. m_combineContiguousRegions = myConfig.GetBoolean("CombineContiguousRegions", false);
  75. MainConsole.Instance.Commands.AddCommand(
  76. "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms",
  77. "Fixes phantom objects after an import to a megaregion or a change from a megaregion back to normal regions",
  78. FixPhantoms);
  79. }
  80. public void Close()
  81. {
  82. }
  83. public void AddRegion(Scene scene)
  84. {
  85. if (m_combineContiguousRegions)
  86. scene.RegisterModuleInterface<IRegionCombinerModule>(this);
  87. }
  88. public void RemoveRegion(Scene scene)
  89. {
  90. lock (m_startingScenes)
  91. m_startingScenes.Remove(scene.RegionInfo.originRegionID);
  92. }
  93. public void RegionLoaded(Scene scene)
  94. {
  95. lock (m_startingScenes)
  96. m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
  97. if (m_combineContiguousRegions)
  98. {
  99. RegionLoadedDoWork(scene);
  100. scene.EventManager.OnNewPresence += NewPresence;
  101. }
  102. }
  103. public bool IsRootForMegaregion(UUID regionId)
  104. {
  105. lock (m_regions)
  106. return m_regions.ContainsKey(regionId);
  107. }
  108. public Vector2 GetSizeOfMegaregion(UUID regionId)
  109. {
  110. lock (m_regions)
  111. {
  112. if (m_regions.ContainsKey(regionId))
  113. {
  114. RegionConnections rootConn = m_regions[regionId];
  115. return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd);
  116. }
  117. }
  118. throw new Exception(string.Format("Region with id {0} not found", regionId));
  119. }
  120. private void NewPresence(ScenePresence presence)
  121. {
  122. if (presence.IsChildAgent)
  123. {
  124. byte[] throttleData;
  125. try
  126. {
  127. throttleData = presence.ControllingClient.GetThrottlesPacked(1);
  128. }
  129. catch (NotImplementedException)
  130. {
  131. return;
  132. }
  133. if (throttleData == null)
  134. return;
  135. if (throttleData.Length == 0)
  136. return;
  137. if (throttleData.Length != 28)
  138. return;
  139. byte[] adjData;
  140. int pos = 0;
  141. if (!BitConverter.IsLittleEndian)
  142. {
  143. byte[] newData = new byte[7 * 4];
  144. Buffer.BlockCopy(throttleData, 0, newData, 0, 7 * 4);
  145. for (int i = 0; i < 7; i++)
  146. Array.Reverse(newData, i * 4, 4);
  147. adjData = newData;
  148. }
  149. else
  150. {
  151. adjData = throttleData;
  152. }
  153. // 0.125f converts from bits to bytes
  154. int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  155. int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  156. int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  157. int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  158. int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  159. int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  160. int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
  161. // State is a subcategory of task that we allocate a percentage to
  162. //int total = resend + land + wind + cloud + task + texture + asset;
  163. byte[] data = new byte[7 * 4];
  164. int ii = 0;
  165. Buffer.BlockCopy(Utils.FloatToBytes(resend), 0, data, ii, 4); ii += 4;
  166. Buffer.BlockCopy(Utils.FloatToBytes(land * 50), 0, data, ii, 4); ii += 4;
  167. Buffer.BlockCopy(Utils.FloatToBytes(wind), 0, data, ii, 4); ii += 4;
  168. Buffer.BlockCopy(Utils.FloatToBytes(cloud), 0, data, ii, 4); ii += 4;
  169. Buffer.BlockCopy(Utils.FloatToBytes(task), 0, data, ii, 4); ii += 4;
  170. Buffer.BlockCopy(Utils.FloatToBytes(texture), 0, data, ii, 4); ii += 4;
  171. Buffer.BlockCopy(Utils.FloatToBytes(asset), 0, data, ii, 4);
  172. try
  173. {
  174. presence.ControllingClient.SetChildAgentThrottle(data);
  175. }
  176. catch (NotImplementedException)
  177. {
  178. return;
  179. }
  180. }
  181. }
  182. private void RegionLoadedDoWork(Scene scene)
  183. {
  184. /*
  185. // For testing on a single instance
  186. if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
  187. return;
  188. //
  189. */
  190. // Give each region a standard set of non-infinite borders
  191. Border northBorder = new Border();
  192. northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
  193. northBorder.CrossDirection = Cardinals.N;
  194. scene.NorthBorders[0] = northBorder;
  195. Border southBorder = new Border();
  196. southBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
  197. southBorder.CrossDirection = Cardinals.S;
  198. scene.SouthBorders[0] = southBorder;
  199. Border eastBorder = new Border();
  200. eastBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
  201. eastBorder.CrossDirection = Cardinals.E;
  202. scene.EastBorders[0] = eastBorder;
  203. Border westBorder = new Border();
  204. westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
  205. westBorder.CrossDirection = Cardinals.W;
  206. scene.WestBorders[0] = westBorder;
  207. RegionConnections newConn = new RegionConnections();
  208. newConn.ConnectedRegions = new List<RegionData>();
  209. newConn.RegionScene = scene;
  210. newConn.RegionLandChannel = scene.LandChannel;
  211. newConn.RegionId = scene.RegionInfo.originRegionID;
  212. newConn.X = scene.RegionInfo.RegionLocX;
  213. newConn.Y = scene.RegionInfo.RegionLocY;
  214. newConn.XEnd = (int)Constants.RegionSize;
  215. newConn.YEnd = (int)Constants.RegionSize;
  216. lock (m_regions)
  217. {
  218. bool connectedYN = false;
  219. foreach (RegionConnections rootConn in m_regions.Values)
  220. {
  221. #region commented
  222. /*
  223. // If we're one region over +x +y
  224. //xxy
  225. //xxx
  226. //xxx
  227. if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
  228. == (regionConnections.X * (int)Constants.RegionSize))
  229. && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
  230. == (regionConnections.Y * (int)Constants.RegionSize)))
  231. {
  232. Vector3 offset = Vector3.Zero;
  233. offset.X = (((regionConnections.X * (int) Constants.RegionSize)) -
  234. ((conn.X * (int) Constants.RegionSize)));
  235. offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) -
  236. ((conn.Y * (int) Constants.RegionSize)));
  237. Vector3 extents = Vector3.Zero;
  238. extents.Y = regionConnections.YEnd + conn.YEnd;
  239. extents.X = conn.XEnd + conn.XEnd;
  240. m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}. Offset: {2}. Extents:{3}",
  241. conn.RegionScene.RegionInfo.RegionName,
  242. regionConnections.RegionScene.RegionInfo.RegionName,
  243. offset, extents);
  244. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  245. connectedYN = true;
  246. break;
  247. }
  248. */
  249. /*
  250. //If we're one region over x +y
  251. //xxx
  252. //xxx
  253. //xyx
  254. if ((((int)conn.X * (int)Constants.RegionSize)
  255. == (regionConnections.X * (int)Constants.RegionSize))
  256. && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
  257. == (regionConnections.Y * (int)Constants.RegionSize)))
  258. {
  259. Vector3 offset = Vector3.Zero;
  260. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  261. ((conn.X * (int)Constants.RegionSize)));
  262. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  263. ((conn.Y * (int)Constants.RegionSize)));
  264. Vector3 extents = Vector3.Zero;
  265. extents.Y = regionConnections.YEnd + conn.YEnd;
  266. extents.X = conn.XEnd;
  267. m_log.DebugFormat("Scene: {0} to the north of Scene{1}. Offset: {2}. Extents:{3}",
  268. conn.RegionScene.RegionInfo.RegionName,
  269. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  270. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  271. connectedYN = true;
  272. break;
  273. }
  274. */
  275. /*
  276. // If we're one region over -x +y
  277. //xxx
  278. //xxx
  279. //yxx
  280. if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
  281. == (regionConnections.X * (int)Constants.RegionSize))
  282. && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
  283. == (regionConnections.Y * (int)Constants.RegionSize)))
  284. {
  285. Vector3 offset = Vector3.Zero;
  286. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  287. ((conn.X * (int)Constants.RegionSize)));
  288. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  289. ((conn.Y * (int)Constants.RegionSize)));
  290. Vector3 extents = Vector3.Zero;
  291. extents.Y = regionConnections.YEnd + conn.YEnd;
  292. extents.X = conn.XEnd + conn.XEnd;
  293. m_log.DebugFormat("Scene: {0} to the northeast of Scene. Offset: {2}. Extents:{3}",
  294. conn.RegionScene.RegionInfo.RegionName,
  295. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  296. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  297. connectedYN = true;
  298. break;
  299. }
  300. */
  301. /*
  302. // If we're one region over -x y
  303. //xxx
  304. //yxx
  305. //xxx
  306. if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
  307. == (regionConnections.X * (int)Constants.RegionSize))
  308. && (((int)conn.Y * (int)Constants.RegionSize)
  309. == (regionConnections.Y * (int)Constants.RegionSize)))
  310. {
  311. Vector3 offset = Vector3.Zero;
  312. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  313. ((conn.X * (int)Constants.RegionSize)));
  314. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  315. ((conn.Y * (int)Constants.RegionSize)));
  316. Vector3 extents = Vector3.Zero;
  317. extents.Y = regionConnections.YEnd;
  318. extents.X = conn.XEnd + conn.XEnd;
  319. m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}",
  320. conn.RegionScene.RegionInfo.RegionName,
  321. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  322. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  323. connectedYN = true;
  324. break;
  325. }
  326. */
  327. /*
  328. // If we're one region over -x -y
  329. //yxx
  330. //xxx
  331. //xxx
  332. if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
  333. == (regionConnections.X * (int)Constants.RegionSize))
  334. && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
  335. == (regionConnections.Y * (int)Constants.RegionSize)))
  336. {
  337. Vector3 offset = Vector3.Zero;
  338. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  339. ((conn.X * (int)Constants.RegionSize)));
  340. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  341. ((conn.Y * (int)Constants.RegionSize)));
  342. Vector3 extents = Vector3.Zero;
  343. extents.Y = regionConnections.YEnd + conn.YEnd;
  344. extents.X = conn.XEnd + conn.XEnd;
  345. m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
  346. conn.RegionScene.RegionInfo.RegionName,
  347. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  348. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  349. connectedYN = true;
  350. break;
  351. }
  352. */
  353. #endregion
  354. // If we're one region over +x y
  355. //xxx
  356. //xxy
  357. //xxx
  358. if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY)
  359. {
  360. connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
  361. break;
  362. }
  363. // If we're one region over x +y
  364. //xyx
  365. //xxx
  366. //xxx
  367. if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
  368. {
  369. connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene);
  370. break;
  371. }
  372. // If we're one region over +x +y
  373. //xxy
  374. //xxx
  375. //xxx
  376. if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
  377. {
  378. connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene);
  379. break;
  380. }
  381. }
  382. // If !connectYN means that this region is a root region
  383. if (!connectedYN)
  384. {
  385. DoWorkForRootRegion(newConn, scene);
  386. }
  387. }
  388. // Set up infinite borders around the entire AABB of the combined ConnectedRegions
  389. AdjustLargeRegionBounds();
  390. }
  391. private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
  392. {
  393. Vector3 offset = Vector3.Zero;
  394. offset.X = newConn.PosX - rootConn.PosX;
  395. offset.Y = newConn.PosY - rootConn.PosY;
  396. Vector3 extents = Vector3.Zero;
  397. extents.Y = rootConn.YEnd;
  398. extents.X = rootConn.XEnd + newConn.XEnd;
  399. rootConn.UpdateExtents(extents);
  400. m_log.DebugFormat(
  401. "[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}",
  402. rootConn.RegionScene.RegionInfo.RegionName,
  403. newConn.RegionScene.RegionInfo.RegionName, offset, extents);
  404. scene.BordersLocked = true;
  405. rootConn.RegionScene.BordersLocked = true;
  406. RegionData ConnectedRegion = new RegionData();
  407. ConnectedRegion.Offset = offset;
  408. ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
  409. ConnectedRegion.RegionScene = scene;
  410. rootConn.ConnectedRegions.Add(ConnectedRegion);
  411. // Inform root region Physics about the extents of this region
  412. rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
  413. // Inform Child region that it needs to forward it's terrain to the root region
  414. scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
  415. // Extend the borders as appropriate
  416. lock (rootConn.RegionScene.EastBorders)
  417. rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  418. lock (rootConn.RegionScene.NorthBorders)
  419. rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  420. lock (rootConn.RegionScene.SouthBorders)
  421. rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  422. lock (scene.WestBorders)
  423. {
  424. scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
  425. // Trigger auto teleport to root region
  426. scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
  427. scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
  428. }
  429. // Reset Terrain.. since terrain loads before we get here, we need to load
  430. // it again so it loads in the root region
  431. scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
  432. // Unlock borders
  433. rootConn.RegionScene.BordersLocked = false;
  434. scene.BordersLocked = false;
  435. // Create a client event forwarder and add this region's events to the root region.
  436. if (rootConn.ClientEventForwarder != null)
  437. rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
  438. return true;
  439. }
  440. private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
  441. {
  442. Vector3 offset = Vector3.Zero;
  443. offset.X = newConn.PosX - rootConn.PosX;
  444. offset.Y = newConn.PosY - rootConn.PosY;
  445. Vector3 extents = Vector3.Zero;
  446. extents.Y = newConn.YEnd + rootConn.YEnd;
  447. extents.X = rootConn.XEnd;
  448. rootConn.UpdateExtents(extents);
  449. scene.BordersLocked = true;
  450. rootConn.RegionScene.BordersLocked = true;
  451. RegionData ConnectedRegion = new RegionData();
  452. ConnectedRegion.Offset = offset;
  453. ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
  454. ConnectedRegion.RegionScene = scene;
  455. rootConn.ConnectedRegions.Add(ConnectedRegion);
  456. m_log.DebugFormat(
  457. "[REGION COMBINER MODULE]: Root region {0} is to the south of region {1}, Offset: {2}, Extents: {3}",
  458. rootConn.RegionScene.RegionInfo.RegionName,
  459. newConn.RegionScene.RegionInfo.RegionName, offset, extents);
  460. rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
  461. scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
  462. lock (rootConn.RegionScene.NorthBorders)
  463. rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  464. lock (rootConn.RegionScene.EastBorders)
  465. rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  466. lock (rootConn.RegionScene.WestBorders)
  467. rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  468. lock (scene.SouthBorders)
  469. {
  470. scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
  471. scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
  472. scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
  473. }
  474. // Reset Terrain.. since terrain normally loads first.
  475. //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
  476. scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
  477. //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
  478. scene.BordersLocked = false;
  479. rootConn.RegionScene.BordersLocked = false;
  480. if (rootConn.ClientEventForwarder != null)
  481. rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
  482. return true;
  483. }
  484. private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
  485. {
  486. Vector3 offset = Vector3.Zero;
  487. offset.X = newConn.PosX - rootConn.PosX;
  488. offset.Y = newConn.PosY - rootConn.PosY;
  489. Vector3 extents = Vector3.Zero;
  490. // We do not want to inflate the extents for regions strictly to the NE of the root region, since this
  491. // would double count regions strictly to the north and east that have already been added.
  492. // extents.Y = regionConnections.YEnd + conn.YEnd;
  493. // extents.X = regionConnections.XEnd + conn.XEnd;
  494. // conn.UpdateExtents(extents);
  495. extents.Y = rootConn.YEnd;
  496. extents.X = rootConn.XEnd;
  497. scene.BordersLocked = true;
  498. rootConn.RegionScene.BordersLocked = true;
  499. RegionData ConnectedRegion = new RegionData();
  500. ConnectedRegion.Offset = offset;
  501. ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
  502. ConnectedRegion.RegionScene = scene;
  503. rootConn.ConnectedRegions.Add(ConnectedRegion);
  504. m_log.DebugFormat(
  505. "[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}",
  506. rootConn.RegionScene.RegionInfo.RegionName,
  507. newConn.RegionScene.RegionInfo.RegionName, offset, extents);
  508. rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
  509. scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
  510. lock (rootConn.RegionScene.NorthBorders)
  511. {
  512. if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2)
  513. {
  514. //compound border
  515. // already locked above
  516. rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  517. lock (rootConn.RegionScene.EastBorders)
  518. rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  519. lock (rootConn.RegionScene.WestBorders)
  520. rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  521. }
  522. }
  523. lock (scene.SouthBorders)
  524. {
  525. scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
  526. scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
  527. scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
  528. }
  529. lock (rootConn.RegionScene.EastBorders)
  530. {
  531. if (rootConn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
  532. {
  533. rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  534. lock (rootConn.RegionScene.NorthBorders)
  535. rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  536. lock (rootConn.RegionScene.SouthBorders)
  537. rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  538. }
  539. }
  540. lock (scene.WestBorders)
  541. {
  542. scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
  543. scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
  544. scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
  545. }
  546. /*
  547. else
  548. {
  549. conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  550. conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  551. conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  552. scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
  553. }
  554. */
  555. // Reset Terrain.. since terrain normally loads first.
  556. //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
  557. scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
  558. //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
  559. scene.BordersLocked = false;
  560. rootConn.RegionScene.BordersLocked = false;
  561. if (rootConn.ClientEventForwarder != null)
  562. rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
  563. return true;
  564. //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
  565. }
  566. private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene)
  567. {
  568. m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName);
  569. RegionData rdata = new RegionData();
  570. rdata.Offset = Vector3.Zero;
  571. rdata.RegionId = scene.RegionInfo.originRegionID;
  572. rdata.RegionScene = scene;
  573. // save it's land channel
  574. rootConn.RegionLandChannel = scene.LandChannel;
  575. // Substitue our landchannel
  576. RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
  577. rootConn.ConnectedRegions);
  578. scene.LandChannel = lnd;
  579. // Forward the permissions modules of each of the connected regions to the root region
  580. lock (m_regions)
  581. {
  582. foreach (RegionData r in rootConn.ConnectedRegions)
  583. {
  584. ForwardPermissionRequests(rootConn, r.RegionScene);
  585. }
  586. // Create the root region's Client Event Forwarder
  587. rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
  588. // Sets up the CoarseLocationUpdate forwarder for this root region
  589. scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
  590. // Adds this root region to a dictionary of regions that are connectable
  591. m_regions.Add(scene.RegionInfo.originRegionID, rootConn);
  592. }
  593. }
  594. private void SetCourseLocationDelegate(ScenePresence presence)
  595. {
  596. presence.SetSendCourseLocationMethod(SendCourseLocationUpdates);
  597. }
  598. // This delegate was refactored for non-combined regions.
  599. // This combined region version will not use the pre-compiled lists of locations and ids
  600. private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
  601. {
  602. RegionConnections connectiondata = null;
  603. lock (m_regions)
  604. {
  605. if (m_regions.ContainsKey(sceneId))
  606. connectiondata = m_regions[sceneId];
  607. else
  608. return;
  609. }
  610. List<Vector3> CoarseLocations = new List<Vector3>();
  611. List<UUID> AvatarUUIDs = new List<UUID>();
  612. connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
  613. {
  614. if (sp.UUID != presence.UUID)
  615. {
  616. CoarseLocations.Add(sp.AbsolutePosition);
  617. AvatarUUIDs.Add(sp.UUID);
  618. }
  619. });
  620. DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
  621. }
  622. private void DistributeCourseLocationUpdates(List<Vector3> locations, List<UUID> uuids,
  623. RegionConnections connectiondata, ScenePresence rootPresence)
  624. {
  625. RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
  626. //List<IClientAPI> clients = new List<IClientAPI>();
  627. Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>();
  628. // Root Region entry
  629. RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct();
  630. rootupdatedata.Locations = new List<Vector3>();
  631. rootupdatedata.Uuids = new List<UUID>();
  632. rootupdatedata.Offset = Vector2.Zero;
  633. rootupdatedata.UserAPI = rootPresence.ControllingClient;
  634. if (rootupdatedata.UserAPI != null)
  635. updates.Add(Vector2.Zero, rootupdatedata);
  636. //Each Region needs an entry or we will end up with dead minimap dots
  637. foreach (RegionData regiondata in rdata)
  638. {
  639. Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
  640. RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
  641. updatedata.Locations = new List<Vector3>();
  642. updatedata.Uuids = new List<UUID>();
  643. updatedata.Offset = offset;
  644. if (offset == Vector2.Zero)
  645. updatedata.UserAPI = rootPresence.ControllingClient;
  646. else
  647. updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
  648. if (updatedata.UserAPI != null)
  649. updates.Add(offset, updatedata);
  650. }
  651. // go over the locations and assign them to an IClientAPI
  652. for (int i = 0; i < locations.Count; i++)
  653. //{locations[i]/(int) Constants.RegionSize;
  654. {
  655. Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize,
  656. (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z);
  657. Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize,
  658. pPosition.Y*(int) Constants.RegionSize);
  659. if (!updates.ContainsKey(offset))
  660. {
  661. // This shouldn't happen
  662. RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
  663. updatedata.Locations = new List<Vector3>();
  664. updatedata.Uuids = new List<UUID>();
  665. updatedata.Offset = offset;
  666. if (offset == Vector2.Zero)
  667. updatedata.UserAPI = rootPresence.ControllingClient;
  668. else
  669. updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
  670. updates.Add(offset,updatedata);
  671. }
  672. updates[offset].Locations.Add(locations[i]);
  673. updates[offset].Uuids.Add(uuids[i]);
  674. }
  675. // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is
  676. foreach (Vector2 offset in updates.Keys)
  677. {
  678. if (updates[offset].UserAPI != null)
  679. {
  680. updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations);
  681. }
  682. }
  683. }
  684. /// <summary>
  685. /// Locates a the Client of a particular region in an Array of RegionData based on offset
  686. /// </summary>
  687. /// <param name="offset"></param>
  688. /// <param name="uUID"></param>
  689. /// <param name="rdata"></param>
  690. /// <returns>IClientAPI or null</returns>
  691. private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
  692. {
  693. IClientAPI returnclient = null;
  694. foreach (RegionData r in rdata)
  695. {
  696. if (r.Offset.X == offset.X && r.Offset.Y == offset.Y)
  697. {
  698. return r.RegionScene.SceneGraph.GetControllingClient(uUID);
  699. }
  700. }
  701. return returnclient;
  702. }
  703. public void PostInitialise()
  704. {
  705. }
  706. // /// <summary>
  707. // /// TODO:
  708. // /// </summary>
  709. // /// <param name="rdata"></param>
  710. // public void UnCombineRegion(RegionData rdata)
  711. // {
  712. // lock (m_regions)
  713. // {
  714. // if (m_regions.ContainsKey(rdata.RegionId))
  715. // {
  716. // // uncombine root region and virtual regions
  717. // }
  718. // else
  719. // {
  720. // foreach (RegionConnections r in m_regions.Values)
  721. // {
  722. // foreach (RegionData rd in r.ConnectedRegions)
  723. // {
  724. // if (rd.RegionId == rdata.RegionId)
  725. // {
  726. // // uncombine virtual region
  727. // }
  728. // }
  729. // }
  730. // }
  731. // }
  732. // }
  733. // Create a set of infinite borders around the whole aabb of the combined island.
  734. private void AdjustLargeRegionBounds()
  735. {
  736. lock (m_regions)
  737. {
  738. foreach (RegionConnections rconn in m_regions.Values)
  739. {
  740. Vector3 offset = Vector3.Zero;
  741. rconn.RegionScene.BordersLocked = true;
  742. foreach (RegionData rdata in rconn.ConnectedRegions)
  743. {
  744. if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X;
  745. if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y;
  746. }
  747. lock (rconn.RegionScene.NorthBorders)
  748. {
  749. Border northBorder = null;
  750. // If we don't already have an infinite border, create one.
  751. if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
  752. {
  753. northBorder = new Border();
  754. rconn.RegionScene.NorthBorders.Add(northBorder);
  755. }
  756. northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
  757. offset.Y + (int) Constants.RegionSize); //<---
  758. northBorder.CrossDirection = Cardinals.N;
  759. }
  760. lock (rconn.RegionScene.SouthBorders)
  761. {
  762. Border southBorder = null;
  763. // If we don't already have an infinite border, create one.
  764. if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
  765. {
  766. southBorder = new Border();
  767. rconn.RegionScene.SouthBorders.Add(southBorder);
  768. }
  769. southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
  770. southBorder.CrossDirection = Cardinals.S;
  771. }
  772. lock (rconn.RegionScene.EastBorders)
  773. {
  774. Border eastBorder = null;
  775. // If we don't already have an infinite border, create one.
  776. if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
  777. {
  778. eastBorder = new Border();
  779. rconn.RegionScene.EastBorders.Add(eastBorder);
  780. }
  781. eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
  782. //<---
  783. eastBorder.CrossDirection = Cardinals.E;
  784. }
  785. lock (rconn.RegionScene.WestBorders)
  786. {
  787. Border westBorder = null;
  788. // If we don't already have an infinite border, create one.
  789. if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
  790. {
  791. westBorder = new Border();
  792. rconn.RegionScene.WestBorders.Add(westBorder);
  793. }
  794. westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
  795. westBorder.CrossDirection = Cardinals.W;
  796. }
  797. rconn.RegionScene.BordersLocked = false;
  798. }
  799. }
  800. }
  801. /// <summary>
  802. /// Try and get an Infinite border out of a listT of borders
  803. /// </summary>
  804. /// <param name="borders"></param>
  805. /// <param name="oborder"></param>
  806. /// <returns></returns>
  807. public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
  808. {
  809. // Warning! Should be locked before getting here!
  810. foreach (Border b in borders)
  811. {
  812. if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
  813. {
  814. oborder = b;
  815. return true;
  816. }
  817. }
  818. oborder = null;
  819. return false;
  820. }
  821. public RegionData GetRegionFromPosition(Vector3 pPosition)
  822. {
  823. pPosition = pPosition/(int) Constants.RegionSize;
  824. int OffsetX = (int) pPosition.X;
  825. int OffsetY = (int) pPosition.Y;
  826. lock (m_regions)
  827. {
  828. foreach (RegionConnections regConn in m_regions.Values)
  829. {
  830. foreach (RegionData reg in regConn.ConnectedRegions)
  831. {
  832. if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
  833. return reg;
  834. }
  835. }
  836. }
  837. return new RegionData();
  838. }
  839. public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
  840. {
  841. if (BigRegion.PermissionModule == null)
  842. BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene);
  843. VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions;
  844. VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions;
  845. VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions;
  846. VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags;
  847. VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel;
  848. VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel;
  849. VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel;
  850. VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject;
  851. VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod;
  852. VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
  853. VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
  854. VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
  855. VirtualRegion.Permissions.OnEditParcelProperties += BigRegion.PermissionModule.CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
  856. VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
  857. VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
  858. VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
  859. VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
  860. VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
  861. VirtualRegion.Permissions.OnReturnObjects += BigRegion.PermissionModule.CanReturnObjects; //NOT YET IMPLEMENTED
  862. VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
  863. VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
  864. VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
  865. VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript;
  866. VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel;
  867. VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject;
  868. VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject;
  869. VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand;
  870. VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED
  871. VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
  872. VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
  873. VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
  874. VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
  875. VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
  876. VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
  877. VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
  878. VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
  879. VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
  880. VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
  881. VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
  882. VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED
  883. VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED
  884. VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
  885. VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
  886. VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
  887. }
  888. #region console commands
  889. public void FixPhantoms(string module, string[] cmdparams)
  890. {
  891. List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
  892. foreach (Scene s in scenes)
  893. {
  894. MainConsole.Instance.OutputFormat("Fixing phantoms for {0}", s.RegionInfo.RegionName);
  895. s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition);
  896. }
  897. }
  898. #endregion
  899. }
  900. }