RegionCombinerModule.cs 49 KB

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