RegionCombinerModule.cs 49 KB

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