INPCModule.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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> name="running">
  109. /// If true, NPC moves with running speed.
  110. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  111. ///
  112. bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running);
  113. /// <summary>
  114. /// Stop the NPC's current movement.
  115. /// </summary>
  116. /// <param name="agentID">The UUID of the NPC</param>
  117. /// <param name="scene"></param>
  118. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  119. bool StopMoveToTarget(UUID agentID, Scene scene);
  120. /// <summary>
  121. /// Get the NPC to say something.
  122. /// </summary>
  123. /// <param name="agentID">The UUID of the NPC</param>
  124. /// <param name="scene"></param>
  125. /// <param name="text"></param>
  126. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  127. bool Say(UUID agentID, Scene scene, string text);
  128. /// <summary>
  129. /// Get the NPC to say something.
  130. /// </summary>
  131. /// <param name="agentID">The UUID of the NPC</param>
  132. /// <param name="scene"></param>
  133. /// <param name="text"></param>
  134. /// <param name="channel"></param>
  135. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  136. bool Say(UUID agentID, Scene scene, string text, int channel);
  137. /// <summary>
  138. /// Get the NPC to shout something.
  139. /// </summary>
  140. /// <param name="agentID">The UUID of the NPC</param>
  141. /// <param name="scene"></param>
  142. /// <param name="text"></param>
  143. /// <param name="channel"></param>
  144. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  145. bool Shout(UUID agentID, Scene scene, string text, int channel);
  146. /// <summary>
  147. /// Get the NPC to whisper something.
  148. /// </summary>
  149. /// <param name="agentID">The UUID of the NPC</param>
  150. /// <param name="scene"></param>
  151. /// <param name="text"></param>
  152. /// <param name="channel"></param>
  153. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  154. bool Whisper(UUID agentID, Scene scene, string text, int channel);
  155. /// <summary>
  156. /// Sit the NPC.
  157. /// </summary>
  158. /// <param name="agentID"></param>
  159. /// <param name="partID"></param>
  160. /// <param name="scene"></param>
  161. /// <returns>true if the sit succeeded, false if not</returns>
  162. bool Sit(UUID agentID, UUID partID, Scene scene);
  163. /// <summary>
  164. /// Stand a sitting NPC.
  165. /// </summary>
  166. /// <param name="agentID"></param>
  167. /// <param name="scene"></param>
  168. /// <returns>true if the stand succeeded, false if not</returns>
  169. bool Stand(UUID agentID, Scene scene);
  170. /// <summary>
  171. /// Get the NPC to touch an object.
  172. /// </summary>
  173. /// <param name="agentID"></param>
  174. /// <param name="partID"></param>
  175. /// <returns>true if the touch is actually attempted, false if not</returns>
  176. bool Touch(UUID agentID, UUID partID);
  177. /// <summary>
  178. /// Delete an NPC.
  179. /// </summary>
  180. /// <param name="agentID">The UUID of the NPC</param>
  181. /// <param name="scene"></param>
  182. /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
  183. bool DeleteNPC(UUID agentID, Scene scene);
  184. /// <summary>
  185. /// Get the owner of a NPC
  186. /// </summary>
  187. /// <param name="agentID">The UUID of the NPC</param>
  188. /// <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>
  189. UUID GetOwner(UUID agentID);
  190. }
  191. }