RegionCombinerModule.cs 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053
  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. //enabledYN = true;
  64. if (enabledYN)
  65. MainConsole.Instance.Commands.AddCommand("RegionCombinerModule", false, "fix-phantoms",
  66. "Fix phantom objects", "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. }
  77. public void RegionLoaded(Scene scene)
  78. {
  79. if (enabledYN)
  80. {
  81. RegionLoadedDoWork(scene);
  82. scene.EventManager.OnNewPresence += NewPresence;
  83. }
  84. }
  85. private void NewPresence(ScenePresence presence)
  86. {
  87. if (presence.IsChildAgent)
  88. {
  89. byte[] throttleData;
  90. try
  91. {
  92. throttleData = presence.ControllingClient.GetThrottlesPacked(1);
  93. }
  94. catch (NotImplementedException)
  95. {
  96. return;
  97. }
  98. if (throttleData == null)
  99. return;
  100. if (throttleData.Length == 0)
  101. return;
  102. if (throttleData.Length != 28)
  103. return;
  104. byte[] adjData;
  105. int pos = 0;
  106. if (!BitConverter.IsLittleEndian)
  107. {
  108. byte[] newData = new byte[7 * 4];
  109. Buffer.BlockCopy(throttleData, 0, newData, 0, 7 * 4);
  110. for (int i = 0; i < 7; i++)
  111. Array.Reverse(newData, i * 4, 4);
  112. adjData = newData;
  113. }
  114. else
  115. {
  116. adjData = throttleData;
  117. }
  118. // 0.125f converts from bits to bytes
  119. int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  120. int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  121. int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  122. int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  123. int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  124. int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
  125. int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
  126. // State is a subcategory of task that we allocate a percentage to
  127. //int total = resend + land + wind + cloud + task + texture + asset;
  128. byte[] data = new byte[7 * 4];
  129. int ii = 0;
  130. Buffer.BlockCopy(Utils.FloatToBytes(resend), 0, data, ii, 4); ii += 4;
  131. Buffer.BlockCopy(Utils.FloatToBytes(land * 50), 0, data, ii, 4); ii += 4;
  132. Buffer.BlockCopy(Utils.FloatToBytes(wind), 0, data, ii, 4); ii += 4;
  133. Buffer.BlockCopy(Utils.FloatToBytes(cloud), 0, data, ii, 4); ii += 4;
  134. Buffer.BlockCopy(Utils.FloatToBytes(task), 0, data, ii, 4); ii += 4;
  135. Buffer.BlockCopy(Utils.FloatToBytes(texture), 0, data, ii, 4); ii += 4;
  136. Buffer.BlockCopy(Utils.FloatToBytes(asset), 0, data, ii, 4);
  137. try
  138. {
  139. presence.ControllingClient.SetChildAgentThrottle(data);
  140. }
  141. catch (NotImplementedException)
  142. {
  143. return;
  144. }
  145. }
  146. }
  147. private void RegionLoadedDoWork(Scene scene)
  148. {
  149. /*
  150. // For testing on a single instance
  151. if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
  152. return;
  153. //
  154. */
  155. lock (m_startingScenes)
  156. m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
  157. // Give each region a standard set of non-infinite borders
  158. Border northBorder = new Border();
  159. northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
  160. northBorder.CrossDirection = Cardinals.N;
  161. scene.NorthBorders[0] = northBorder;
  162. Border southBorder = new Border();
  163. southBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
  164. southBorder.CrossDirection = Cardinals.S;
  165. scene.SouthBorders[0] = southBorder;
  166. Border eastBorder = new Border();
  167. eastBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
  168. eastBorder.CrossDirection = Cardinals.E;
  169. scene.EastBorders[0] = eastBorder;
  170. Border westBorder = new Border();
  171. westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
  172. westBorder.CrossDirection = Cardinals.W;
  173. scene.WestBorders[0] = westBorder;
  174. RegionConnections regionConnections = new RegionConnections();
  175. regionConnections.ConnectedRegions = new List<RegionData>();
  176. regionConnections.RegionScene = scene;
  177. regionConnections.RegionLandChannel = scene.LandChannel;
  178. regionConnections.RegionId = scene.RegionInfo.originRegionID;
  179. regionConnections.X = scene.RegionInfo.RegionLocX;
  180. regionConnections.Y = scene.RegionInfo.RegionLocY;
  181. regionConnections.XEnd = (int)Constants.RegionSize;
  182. regionConnections.YEnd = (int)Constants.RegionSize;
  183. lock (m_regions)
  184. {
  185. bool connectedYN = false;
  186. foreach (RegionConnections conn in m_regions.Values)
  187. {
  188. #region commented
  189. /*
  190. // If we're one region over +x +y
  191. //xxy
  192. //xxx
  193. //xxx
  194. if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
  195. == (regionConnections.X * (int)Constants.RegionSize))
  196. && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
  197. == (regionConnections.Y * (int)Constants.RegionSize)))
  198. {
  199. Vector3 offset = Vector3.Zero;
  200. offset.X = (((regionConnections.X * (int) Constants.RegionSize)) -
  201. ((conn.X * (int) Constants.RegionSize)));
  202. offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) -
  203. ((conn.Y * (int) Constants.RegionSize)));
  204. Vector3 extents = Vector3.Zero;
  205. extents.Y = regionConnections.YEnd + conn.YEnd;
  206. extents.X = conn.XEnd + conn.XEnd;
  207. m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}. Offset: {2}. Extents:{3}",
  208. conn.RegionScene.RegionInfo.RegionName,
  209. regionConnections.RegionScene.RegionInfo.RegionName,
  210. offset, extents);
  211. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  212. connectedYN = true;
  213. break;
  214. }
  215. */
  216. /*
  217. //If we're one region over x +y
  218. //xxx
  219. //xxx
  220. //xyx
  221. if ((((int)conn.X * (int)Constants.RegionSize)
  222. == (regionConnections.X * (int)Constants.RegionSize))
  223. && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
  224. == (regionConnections.Y * (int)Constants.RegionSize)))
  225. {
  226. Vector3 offset = Vector3.Zero;
  227. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  228. ((conn.X * (int)Constants.RegionSize)));
  229. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  230. ((conn.Y * (int)Constants.RegionSize)));
  231. Vector3 extents = Vector3.Zero;
  232. extents.Y = regionConnections.YEnd + conn.YEnd;
  233. extents.X = conn.XEnd;
  234. m_log.DebugFormat("Scene: {0} to the north of Scene{1}. Offset: {2}. Extents:{3}",
  235. conn.RegionScene.RegionInfo.RegionName,
  236. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  237. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  238. connectedYN = true;
  239. break;
  240. }
  241. */
  242. /*
  243. // If we're one region over -x +y
  244. //xxx
  245. //xxx
  246. //yxx
  247. if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
  248. == (regionConnections.X * (int)Constants.RegionSize))
  249. && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
  250. == (regionConnections.Y * (int)Constants.RegionSize)))
  251. {
  252. Vector3 offset = Vector3.Zero;
  253. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  254. ((conn.X * (int)Constants.RegionSize)));
  255. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  256. ((conn.Y * (int)Constants.RegionSize)));
  257. Vector3 extents = Vector3.Zero;
  258. extents.Y = regionConnections.YEnd + conn.YEnd;
  259. extents.X = conn.XEnd + conn.XEnd;
  260. m_log.DebugFormat("Scene: {0} to the northeast of Scene. Offset: {2}. Extents:{3}",
  261. conn.RegionScene.RegionInfo.RegionName,
  262. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  263. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  264. connectedYN = true;
  265. break;
  266. }
  267. */
  268. /*
  269. // If we're one region over -x y
  270. //xxx
  271. //yxx
  272. //xxx
  273. if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
  274. == (regionConnections.X * (int)Constants.RegionSize))
  275. && (((int)conn.Y * (int)Constants.RegionSize)
  276. == (regionConnections.Y * (int)Constants.RegionSize)))
  277. {
  278. Vector3 offset = Vector3.Zero;
  279. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  280. ((conn.X * (int)Constants.RegionSize)));
  281. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  282. ((conn.Y * (int)Constants.RegionSize)));
  283. Vector3 extents = Vector3.Zero;
  284. extents.Y = regionConnections.YEnd;
  285. extents.X = conn.XEnd + conn.XEnd;
  286. m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}",
  287. conn.RegionScene.RegionInfo.RegionName,
  288. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  289. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  290. connectedYN = true;
  291. break;
  292. }
  293. */
  294. /*
  295. // If we're one region over -x -y
  296. //yxx
  297. //xxx
  298. //xxx
  299. if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
  300. == (regionConnections.X * (int)Constants.RegionSize))
  301. && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
  302. == (regionConnections.Y * (int)Constants.RegionSize)))
  303. {
  304. Vector3 offset = Vector3.Zero;
  305. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  306. ((conn.X * (int)Constants.RegionSize)));
  307. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  308. ((conn.Y * (int)Constants.RegionSize)));
  309. Vector3 extents = Vector3.Zero;
  310. extents.Y = regionConnections.YEnd + conn.YEnd;
  311. extents.X = conn.XEnd + conn.XEnd;
  312. m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
  313. conn.RegionScene.RegionInfo.RegionName,
  314. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  315. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
  316. connectedYN = true;
  317. break;
  318. }
  319. */
  320. #endregion
  321. // If we're one region over +x y
  322. //xxx
  323. //xxy
  324. //xxx
  325. if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
  326. >= (regionConnections.X * (int)Constants.RegionSize))
  327. && (((int)conn.Y * (int)Constants.RegionSize)
  328. >= (regionConnections.Y * (int)Constants.RegionSize)))
  329. {
  330. connectedYN = DoWorkForOneRegionOverPlusXY(conn, regionConnections, scene);
  331. break;
  332. }
  333. // If we're one region over x +y
  334. //xyx
  335. //xxx
  336. //xxx
  337. if ((((int)conn.X * (int)Constants.RegionSize)
  338. >= (regionConnections.X * (int)Constants.RegionSize))
  339. && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
  340. >= (regionConnections.Y * (int)Constants.RegionSize)))
  341. {
  342. connectedYN = DoWorkForOneRegionOverXPlusY(conn, regionConnections, scene);
  343. break;
  344. }
  345. // If we're one region over +x +y
  346. //xxy
  347. //xxx
  348. //xxx
  349. if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd
  350. >= (regionConnections.X * (int)Constants.RegionSize))
  351. && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
  352. >= (regionConnections.Y * (int)Constants.RegionSize)))
  353. {
  354. connectedYN = DoWorkForOneRegionOverPlusXPlusY(conn, regionConnections, scene);
  355. break;
  356. }
  357. }
  358. // If !connectYN means that this region is a root region
  359. if (!connectedYN)
  360. {
  361. DoWorkForRootRegion(regionConnections, scene);
  362. }
  363. }
  364. // Set up infinite borders around the entire AABB of the combined ConnectedRegions
  365. AdjustLargeRegionBounds();
  366. }
  367. private bool DoWorkForOneRegionOverPlusXY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
  368. {
  369. Vector3 offset = Vector3.Zero;
  370. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  371. ((conn.X * (int)Constants.RegionSize)));
  372. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  373. ((conn.Y * (int)Constants.RegionSize)));
  374. Vector3 extents = Vector3.Zero;
  375. extents.Y = conn.YEnd;
  376. extents.X = conn.XEnd + regionConnections.XEnd;
  377. conn.UpdateExtents(extents);
  378. m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
  379. conn.RegionScene.RegionInfo.RegionName,
  380. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  381. scene.BordersLocked = true;
  382. conn.RegionScene.BordersLocked = true;
  383. RegionData ConnectedRegion = new RegionData();
  384. ConnectedRegion.Offset = offset;
  385. ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
  386. ConnectedRegion.RegionScene = scene;
  387. conn.ConnectedRegions.Add(ConnectedRegion);
  388. // Inform root region Physics about the extents of this region
  389. conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
  390. // Inform Child region that it needs to forward it's terrain to the root region
  391. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
  392. // Extend the borders as appropriate
  393. lock (conn.RegionScene.EastBorders)
  394. conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  395. lock (conn.RegionScene.NorthBorders)
  396. conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  397. lock (conn.RegionScene.SouthBorders)
  398. conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  399. lock (scene.WestBorders)
  400. {
  401. scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
  402. // Trigger auto teleport to root region
  403. scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
  404. scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
  405. }
  406. // Reset Terrain.. since terrain loads before we get here, we need to load
  407. // it again so it loads in the root region
  408. scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
  409. // Unlock borders
  410. conn.RegionScene.BordersLocked = false;
  411. scene.BordersLocked = false;
  412. // Create a client event forwarder and add this region's events to the root region.
  413. if (conn.ClientEventForwarder != null)
  414. conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
  415. return true;
  416. }
  417. private bool DoWorkForOneRegionOverXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
  418. {
  419. Vector3 offset = Vector3.Zero;
  420. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  421. ((conn.X * (int)Constants.RegionSize)));
  422. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  423. ((conn.Y * (int)Constants.RegionSize)));
  424. Vector3 extents = Vector3.Zero;
  425. extents.Y = regionConnections.YEnd + conn.YEnd;
  426. extents.X = conn.XEnd;
  427. conn.UpdateExtents(extents);
  428. scene.BordersLocked = true;
  429. conn.RegionScene.BordersLocked = true;
  430. RegionData ConnectedRegion = new RegionData();
  431. ConnectedRegion.Offset = offset;
  432. ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
  433. ConnectedRegion.RegionScene = scene;
  434. conn.ConnectedRegions.Add(ConnectedRegion);
  435. m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
  436. conn.RegionScene.RegionInfo.RegionName,
  437. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  438. conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
  439. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
  440. lock (conn.RegionScene.NorthBorders)
  441. conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  442. lock (conn.RegionScene.EastBorders)
  443. conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  444. lock (conn.RegionScene.WestBorders)
  445. conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  446. lock (scene.SouthBorders)
  447. {
  448. scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
  449. scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
  450. scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
  451. }
  452. // Reset Terrain.. since terrain normally loads first.
  453. //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
  454. scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
  455. //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
  456. scene.BordersLocked = false;
  457. conn.RegionScene.BordersLocked = false;
  458. if (conn.ClientEventForwarder != null)
  459. conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
  460. return true;
  461. }
  462. private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
  463. {
  464. Vector3 offset = Vector3.Zero;
  465. offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
  466. ((conn.X * (int)Constants.RegionSize)));
  467. offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
  468. ((conn.Y * (int)Constants.RegionSize)));
  469. Vector3 extents = Vector3.Zero;
  470. extents.Y = regionConnections.YEnd + conn.YEnd;
  471. extents.X = regionConnections.XEnd + conn.XEnd;
  472. conn.UpdateExtents(extents);
  473. scene.BordersLocked = true;
  474. conn.RegionScene.BordersLocked = true;
  475. RegionData ConnectedRegion = new RegionData();
  476. ConnectedRegion.Offset = offset;
  477. ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
  478. ConnectedRegion.RegionScene = scene;
  479. conn.ConnectedRegions.Add(ConnectedRegion);
  480. m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
  481. conn.RegionScene.RegionInfo.RegionName,
  482. regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
  483. conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
  484. scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
  485. lock (conn.RegionScene.NorthBorders)
  486. {
  487. if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
  488. {
  489. //compound border
  490. // already locked above
  491. conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  492. lock (conn.RegionScene.EastBorders)
  493. conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  494. lock (conn.RegionScene.WestBorders)
  495. conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  496. }
  497. }
  498. lock (scene.SouthBorders)
  499. {
  500. scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
  501. scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
  502. scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
  503. }
  504. lock (conn.RegionScene.EastBorders)
  505. {
  506. if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
  507. {
  508. conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  509. lock (conn.RegionScene.NorthBorders)
  510. conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  511. lock (conn.RegionScene.SouthBorders)
  512. conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  513. }
  514. }
  515. lock (scene.WestBorders)
  516. {
  517. scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
  518. scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
  519. scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
  520. }
  521. /*
  522. else
  523. {
  524. conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
  525. conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  526. conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
  527. scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
  528. }
  529. */
  530. // Reset Terrain.. since terrain normally loads first.
  531. //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
  532. scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
  533. //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
  534. scene.BordersLocked = false;
  535. conn.RegionScene.BordersLocked = false;
  536. if (conn.ClientEventForwarder != null)
  537. conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
  538. return true;
  539. //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
  540. }
  541. private void DoWorkForRootRegion(RegionConnections regionConnections, Scene scene)
  542. {
  543. RegionData rdata = new RegionData();
  544. rdata.Offset = Vector3.Zero;
  545. rdata.RegionId = scene.RegionInfo.originRegionID;
  546. rdata.RegionScene = scene;
  547. // save it's land channel
  548. regionConnections.RegionLandChannel = scene.LandChannel;
  549. // Substitue our landchannel
  550. RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
  551. regionConnections.ConnectedRegions);
  552. scene.LandChannel = lnd;
  553. // Forward the permissions modules of each of the connected regions to the root region
  554. lock (m_regions)
  555. {
  556. foreach (RegionData r in regionConnections.ConnectedRegions)
  557. {
  558. ForwardPermissionRequests(regionConnections, r.RegionScene);
  559. }
  560. }
  561. // Create the root region's Client Event Forwarder
  562. regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
  563. // Sets up the CoarseLocationUpdate forwarder for this root region
  564. scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
  565. // Adds this root region to a dictionary of regions that are connectable
  566. m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
  567. }
  568. private void SetCourseLocationDelegate(ScenePresence presence)
  569. {
  570. presence.SetSendCourseLocationMethod(SendCourseLocationUpdates);
  571. }
  572. // This delegate was refactored for non-combined regions.
  573. // This combined region version will not use the pre-compiled lists of locations and ids
  574. private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
  575. {
  576. RegionConnections connectiondata = null;
  577. lock (m_regions)
  578. {
  579. if (m_regions.ContainsKey(sceneId))
  580. connectiondata = m_regions[sceneId];
  581. else
  582. return;
  583. }
  584. List<Vector3> CoarseLocations = new List<Vector3>();
  585. List<UUID> AvatarUUIDs = new List<UUID>();
  586. connectiondata.RegionScene.ForEachScenePresence(delegate(ScenePresence sp)
  587. {
  588. if (sp.IsChildAgent)
  589. return;
  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.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //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. }