RegionCombinerModule.cs 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  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. }
  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.XEnd
  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.ForEachRootScenePresence(delegate(ScenePresence sp)
  587. {
  588. if (sp.UUID != presence.UUID)
  589. {
  590. if (sp.ParentID != 0)
  591. {
  592. // sitting avatar
  593. SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID);
  594. if (sop != null)
  595. {
  596. CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition);
  597. AvatarUUIDs.Add(sp.UUID);
  598. }
  599. else
  600. {
  601. // we can't find the parent.. ! arg!
  602. CoarseLocations.Add(sp.AbsolutePosition);
  603. AvatarUUIDs.Add(sp.UUID);
  604. }
  605. }
  606. else
  607. {
  608. CoarseLocations.Add(sp.AbsolutePosition);
  609. AvatarUUIDs.Add(sp.UUID);
  610. }
  611. }
  612. });
  613. DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
  614. }
  615. private void DistributeCourseLocationUpdates(List<Vector3> locations, List<UUID> uuids,
  616. RegionConnections connectiondata, ScenePresence rootPresence)
  617. {
  618. RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
  619. //List<IClientAPI> clients = new List<IClientAPI>();
  620. Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>();
  621. // Root Region entry
  622. RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct();
  623. rootupdatedata.Locations = new List<Vector3>();
  624. rootupdatedata.Uuids = new List<UUID>();
  625. rootupdatedata.Offset = Vector2.Zero;
  626. rootupdatedata.UserAPI = rootPresence.ControllingClient;
  627. if (rootupdatedata.UserAPI != null)
  628. updates.Add(Vector2.Zero, rootupdatedata);
  629. //Each Region needs an entry or we will end up with dead minimap dots
  630. foreach (RegionData regiondata in rdata)
  631. {
  632. Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
  633. RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
  634. updatedata.Locations = new List<Vector3>();
  635. updatedata.Uuids = new List<UUID>();
  636. updatedata.Offset = offset;
  637. if (offset == Vector2.Zero)
  638. updatedata.UserAPI = rootPresence.ControllingClient;
  639. else
  640. updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
  641. if (updatedata.UserAPI != null)
  642. updates.Add(offset, updatedata);
  643. }
  644. // go over the locations and assign them to an IClientAPI
  645. for (int i = 0; i < locations.Count; i++)
  646. //{locations[i]/(int) Constants.RegionSize;
  647. {
  648. Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize,
  649. (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z);
  650. Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize,
  651. pPosition.Y*(int) Constants.RegionSize);
  652. if (!updates.ContainsKey(offset))
  653. {
  654. // This shouldn't happen
  655. RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
  656. updatedata.Locations = new List<Vector3>();
  657. updatedata.Uuids = new List<UUID>();
  658. updatedata.Offset = offset;
  659. if (offset == Vector2.Zero)
  660. updatedata.UserAPI = rootPresence.ControllingClient;
  661. else
  662. updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
  663. updates.Add(offset,updatedata);
  664. }
  665. updates[offset].Locations.Add(locations[i]);
  666. updates[offset].Uuids.Add(uuids[i]);
  667. }
  668. // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is
  669. foreach (Vector2 offset in updates.Keys)
  670. {
  671. if (updates[offset].UserAPI != null)
  672. {
  673. updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations);
  674. }
  675. }
  676. }
  677. /// <summary>
  678. /// Locates a the Client of a particular region in an Array of RegionData based on offset
  679. /// </summary>
  680. /// <param name="offset"></param>
  681. /// <param name="uUID"></param>
  682. /// <param name="rdata"></param>
  683. /// <returns>IClientAPI or null</returns>
  684. private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
  685. {
  686. IClientAPI returnclient = null;
  687. foreach (RegionData r in rdata)
  688. {
  689. if (r.Offset.X == offset.X && r.Offset.Y == offset.Y)
  690. {
  691. return r.RegionScene.SceneGraph.GetControllingClient(uUID);
  692. }
  693. }
  694. return returnclient;
  695. }
  696. public void PostInitialise()
  697. {
  698. }
  699. // /// <summary>
  700. // /// TODO:
  701. // /// </summary>
  702. // /// <param name="rdata"></param>
  703. // public void UnCombineRegion(RegionData rdata)
  704. // {
  705. // lock (m_regions)
  706. // {
  707. // if (m_regions.ContainsKey(rdata.RegionId))
  708. // {
  709. // // uncombine root region and virtual regions
  710. // }
  711. // else
  712. // {
  713. // foreach (RegionConnections r in m_regions.Values)
  714. // {
  715. // foreach (RegionData rd in r.ConnectedRegions)
  716. // {
  717. // if (rd.RegionId == rdata.RegionId)
  718. // {
  719. // // uncombine virtual region
  720. // }
  721. // }
  722. // }
  723. // }
  724. // }
  725. // }
  726. // Create a set of infinite borders around the whole aabb of the combined island.
  727. private void AdjustLargeRegionBounds()
  728. {
  729. lock (m_regions)
  730. {
  731. foreach (RegionConnections rconn in m_regions.Values)
  732. {
  733. Vector3 offset = Vector3.Zero;
  734. rconn.RegionScene.BordersLocked = true;
  735. foreach (RegionData rdata in rconn.ConnectedRegions)
  736. {
  737. if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X;
  738. if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y;
  739. }
  740. lock (rconn.RegionScene.NorthBorders)
  741. {
  742. Border northBorder = null;
  743. // If we don't already have an infinite border, create one.
  744. if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
  745. {
  746. northBorder = new Border();
  747. rconn.RegionScene.NorthBorders.Add(northBorder);
  748. }
  749. northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
  750. offset.Y + (int) Constants.RegionSize); //<---
  751. northBorder.CrossDirection = Cardinals.N;
  752. }
  753. lock (rconn.RegionScene.SouthBorders)
  754. {
  755. Border southBorder = null;
  756. // If we don't already have an infinite border, create one.
  757. if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
  758. {
  759. southBorder = new Border();
  760. rconn.RegionScene.SouthBorders.Add(southBorder);
  761. }
  762. southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
  763. southBorder.CrossDirection = Cardinals.S;
  764. }
  765. lock (rconn.RegionScene.EastBorders)
  766. {
  767. Border eastBorder = null;
  768. // If we don't already have an infinite border, create one.
  769. if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
  770. {
  771. eastBorder = new Border();
  772. rconn.RegionScene.EastBorders.Add(eastBorder);
  773. }
  774. eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
  775. //<---
  776. eastBorder.CrossDirection = Cardinals.E;
  777. }
  778. lock (rconn.RegionScene.WestBorders)
  779. {
  780. Border westBorder = null;
  781. // If we don't already have an infinite border, create one.
  782. if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
  783. {
  784. westBorder = new Border();
  785. rconn.RegionScene.WestBorders.Add(westBorder);
  786. }
  787. westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
  788. westBorder.CrossDirection = Cardinals.W;
  789. }
  790. rconn.RegionScene.BordersLocked = false;
  791. }
  792. }
  793. }
  794. /// <summary>
  795. /// Try and get an Infinite border out of a listT of borders
  796. /// </summary>
  797. /// <param name="borders"></param>
  798. /// <param name="oborder"></param>
  799. /// <returns></returns>
  800. public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
  801. {
  802. // Warning! Should be locked before getting here!
  803. foreach (Border b in borders)
  804. {
  805. if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
  806. {
  807. oborder = b;
  808. return true;
  809. }
  810. }
  811. oborder = null;
  812. return false;
  813. }
  814. public RegionData GetRegionFromPosition(Vector3 pPosition)
  815. {
  816. pPosition = pPosition/(int) Constants.RegionSize;
  817. int OffsetX = (int) pPosition.X;
  818. int OffsetY = (int) pPosition.Y;
  819. foreach (RegionConnections regConn in m_regions.Values)
  820. {
  821. foreach (RegionData reg in regConn.ConnectedRegions)
  822. {
  823. if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
  824. return reg;
  825. }
  826. }
  827. return new RegionData();
  828. }
  829. public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
  830. {
  831. if (BigRegion.PermissionModule == null)
  832. BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene);
  833. VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions;
  834. VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions;
  835. VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions;
  836. VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags;
  837. VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel;
  838. VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel;
  839. VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel;
  840. VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject;
  841. VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod;
  842. VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
  843. VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
  844. VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
  845. VirtualRegion.Permissions.OnEditParcelProperties += BigRegion.PermissionModule.CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
  846. VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
  847. VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
  848. VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
  849. VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
  850. VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
  851. VirtualRegion.Permissions.OnReturnObjects += BigRegion.PermissionModule.CanReturnObjects; //NOT YET IMPLEMENTED
  852. VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
  853. VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
  854. VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
  855. VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript;
  856. VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel;
  857. VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject;
  858. VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject;
  859. VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand;
  860. VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED
  861. VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
  862. VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
  863. VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
  864. VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
  865. VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
  866. VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
  867. VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
  868. VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
  869. VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
  870. VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
  871. VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
  872. VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED
  873. VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED
  874. VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
  875. VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
  876. VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
  877. }
  878. #region console commands
  879. public void FixPhantoms(string module, string[] cmdparams)
  880. {
  881. List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
  882. foreach (Scene s in scenes)
  883. {
  884. s.ForEachSOG(delegate(SceneObjectGroup e)
  885. {
  886. e.AbsolutePosition = e.AbsolutePosition;
  887. }
  888. );
  889. }
  890. }
  891. #endregion
  892. }
  893. }