INPCModule.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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 OpenMetaverse;
  28. using OpenSim.Framework;
  29. using OpenSim.Region.Framework.Scenes;
  30. namespace OpenSim.Region.Framework.Interfaces
  31. {
  32. /// <summary>
  33. /// Temporary interface. More methods to come at some point to make NPCs more object oriented rather than
  34. /// controlling purely through module level interface calls (e.g. sit/stand).
  35. /// </summary>
  36. public interface INPC
  37. {
  38. /// <summary>
  39. /// Should this NPC be sensed by LSL sensors as an 'agent' (interpreted here to mean a normal user)
  40. /// rather than an OpenSim specific NPC extension?
  41. /// </summary>
  42. bool SenseAsAgent { get; }
  43. }
  44. public interface INPCModule
  45. {
  46. /// <summary>
  47. /// Create an NPC
  48. /// </summary>
  49. /// <param name="firstname"></param>
  50. /// <param name="lastname"></param>
  51. /// <param name="position"></param>
  52. /// <param name="senseAsAgent">
  53. /// Make the NPC show up as an agent on LSL sensors. The default is that they
  54. /// show up as the NPC type instead, but this is currently an OpenSim-only extension.
  55. /// </param>
  56. /// <param name="scene"></param>
  57. /// <param name="appearance">The avatar appearance to use for the new NPC.</param>
  58. /// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns>
  59. UUID CreateNPC(
  60. string firstname,
  61. string lastname,
  62. Vector3 position,
  63. UUID owner,
  64. bool senseAsAgent,
  65. Scene scene,
  66. AvatarAppearance appearance);
  67. /// <summary>
  68. /// Check if the agent is an NPC.
  69. /// </summary>
  70. /// <param name="agentID"></param>
  71. /// <param name="scene"></param>
  72. /// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns>
  73. bool IsNPC(UUID agentID, Scene scene);
  74. /// <summary>
  75. /// Get the NPC. This is not currently complete - manipulation of NPCs still occurs through the region interface
  76. /// </summary>
  77. /// <param name="agentID"></param>
  78. /// <param name="scene"></param>
  79. /// <returns>The NPC. null if it does not exist.</returns>
  80. INPC GetNPC(UUID agentID, Scene scene);
  81. /// <summary>
  82. /// Check if the caller has permission to manipulate the given NPC.
  83. /// </summary>
  84. /// <param name="npcID"></param>
  85. /// <param name="callerID"></param>
  86. /// <returns>true if they do, false if they don't or if there's no NPC with the given ID.</returns>
  87. bool CheckPermissions(UUID npcID, UUID callerID);
  88. /// <summary>
  89. /// Set the appearance for an NPC.
  90. /// </summary>
  91. /// <param name="agentID"></param>
  92. /// <param name="appearance"></param>
  93. /// <param name="scene"></param>
  94. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  95. bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene);
  96. /// <summary>
  97. /// Move an NPC to a target over time.
  98. /// </summary>
  99. /// <param name="agentID">The UUID of the NPC</param>
  100. /// <param name="scene"></param>
  101. /// <param name="pos"></param>
  102. /// <param name="noFly">
  103. /// If true, then the avatar will attempt to walk to the location even if it's up in the air.
  104. /// This is to allow walking on prims.
  105. /// </param>
  106. /// <param name="landAtTarget">
  107. /// If true and the avatar is flying when it reaches the target, land.
  108. /// </param>
  109. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  110. bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget);
  111. /// <summary>
  112. /// Stop the NPC's current movement.
  113. /// </summary>
  114. /// <param name="agentID">The UUID of the NPC</param>
  115. /// <param name="scene"></param>
  116. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  117. bool StopMoveToTarget(UUID agentID, Scene scene);
  118. /// <summary>
  119. /// Get the NPC to say something.
  120. /// </summary>
  121. /// <param name="agentID">The UUID of the NPC</param>
  122. /// <param name="scene"></param>
  123. /// <param name="text"></param>
  124. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  125. bool Say(UUID agentID, Scene scene, string text);
  126. /// <summary>
  127. /// Sit the NPC.
  128. /// </summary>
  129. /// <param name="agentID"></param>
  130. /// <param name="partID"></param>
  131. /// <param name="scene"></param>
  132. /// <returns>true if the sit succeeded, false if not</returns>
  133. bool Sit(UUID agentID, UUID partID, Scene scene);
  134. /// <summary>
  135. /// Stand a sitting NPC.
  136. /// </summary>
  137. /// <param name="agentID"></param>
  138. /// <param name="scene"></param>
  139. /// <returns>true if the stand succeeded, false if not</returns>
  140. bool Stand(UUID agentID, Scene scene);
  141. /// <summary>
  142. /// Delete an NPC.
  143. /// </summary>
  144. /// <param name="agentID">The UUID of the NPC</param>
  145. /// <param name="scene"></param>
  146. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  147. bool DeleteNPC(UUID agentID, Scene scene);
  148. /// <summary>
  149. /// Get the owner of a NPC
  150. /// </summary>
  151. /// <param name="agentID">The UUID of the NPC</param>
  152. /// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns>
  153. UUID GetOwner(UUID agentID);
  154. }
  155. }