RegionCombinerModule.cs 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  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 (i.e. root region is to the west)
  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 (i.e. root region is to the south)
  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 (i.e. root region is to the south-west)
  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. }