LandChannel.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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 OpenSim 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 libsecondlife;
  30. using OpenSim.Framework;
  31. using OpenSim.Region.Environment.Interfaces;
  32. using OpenSim.Region.Environment.Scenes;
  33. namespace OpenSim.Region.Environment.Modules.World.Land
  34. {
  35. public class LandChannel : ILandChannel
  36. {
  37. #region Constants
  38. //Land types set with flags in ParcelOverlay.
  39. //Only one of these can be used.
  40. public const float BAN_LINE_SAFETY_HIEGHT = 100;
  41. public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = 128; //Equals 10000000
  42. public const byte LAND_FLAG_PROPERTY_BORDER_WEST = 64; //Equals 01000000
  43. //RequestResults (I think these are right, they seem to work):
  44. public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land
  45. public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land
  46. //ParcelSelectObjects
  47. public const int LAND_SELECT_OBJECTS_GROUP = 4;
  48. public const int LAND_SELECT_OBJECTS_OTHER = 8;
  49. public const int LAND_SELECT_OBJECTS_OWNER = 2;
  50. public const byte LAND_TYPE_IS_BEING_AUCTIONED = 5; //Equals 00000101
  51. public const byte LAND_TYPE_IS_FOR_SALE = 4; //Equals 00000100
  52. public const byte LAND_TYPE_OWNED_BY_GROUP = 2; //Equals 00000010
  53. public const byte LAND_TYPE_OWNED_BY_OTHER = 1; //Equals 00000001
  54. public const byte LAND_TYPE_OWNED_BY_REQUESTER = 3; //Equals 00000011
  55. public const byte LAND_TYPE_PUBLIC = 0; //Equals 00000000
  56. //These are other constants. Yay!
  57. public const int START_LAND_LOCAL_ID = 1;
  58. #endregion
  59. private readonly Scene m_scene;
  60. private readonly LandManagementModule m_landManagementModule;
  61. public LandChannel(Scene scene, LandManagementModule landManagementMod)
  62. {
  63. m_scene = scene;
  64. m_landManagementModule = landManagementMod;
  65. }
  66. #region ILandChannel Members
  67. /// <summary>
  68. /// Get the land object at the specified point
  69. /// </summary>
  70. /// <param name="x_float">Value between 0 - 256 on the x axis of the point</param>
  71. /// <param name="y_float">Value between 0 - 256 on the y axis of the point</param>
  72. /// <returns>Land object at the point supplied</returns>
  73. public ILandObject GetLandObject(float x_float, float y_float)
  74. {
  75. if (m_landManagementModule != null)
  76. {
  77. return m_landManagementModule.GetLandObject(x_float, y_float);
  78. }
  79. ILandObject obj = new LandObject(LLUUID.Zero, false, m_scene);
  80. obj.landData.landName = "NO LAND";
  81. return obj;
  82. }
  83. public ILandObject GetLandObject(int x, int y)
  84. {
  85. if (m_landManagementModule != null)
  86. {
  87. return m_landManagementModule.GetLandObject(x, y);
  88. }
  89. ILandObject obj = new LandObject(LLUUID.Zero, false, m_scene);
  90. obj.landData.landName = "NO LAND";
  91. return obj;
  92. }
  93. public List<ILandObject> ParcelsNearPoint(LLVector3 position)
  94. {
  95. if (m_landManagementModule != null)
  96. {
  97. return m_landManagementModule.ParcelsNearPoint(position);
  98. }
  99. return new List<ILandObject>();
  100. }
  101. public bool IsLandPrimCountTainted()
  102. {
  103. if (m_landManagementModule != null)
  104. {
  105. return m_landManagementModule.IsLandPrimCountTainted();
  106. }
  107. return false;
  108. }
  109. public bool IsForcefulBansAllowed()
  110. {
  111. if (m_landManagementModule != null)
  112. {
  113. return m_landManagementModule.AllowedForcefulBans;
  114. }
  115. return false;
  116. }
  117. public void UpdateLandObject(int localID, LandData data)
  118. {
  119. if (m_landManagementModule != null)
  120. {
  121. m_landManagementModule.UpdateLandObject(localID, data);
  122. }
  123. }
  124. public void ReturnObjectsInParcel(int localID, uint returnType, LLUUID[] agentIDs, LLUUID[] taskIDs, IClientAPI remoteClient)
  125. {
  126. if (m_landManagementModule != null)
  127. {
  128. m_landManagementModule.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
  129. }
  130. }
  131. public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
  132. {
  133. if (m_landManagementModule != null)
  134. {
  135. m_landManagementModule.setParcelObjectMaxOverride(overrideDel);
  136. }
  137. }
  138. public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
  139. {
  140. if (m_landManagementModule != null)
  141. {
  142. m_landManagementModule.setSimulatorObjectMaxOverride(overrideDel);
  143. }
  144. }
  145. #endregion
  146. }
  147. }