INPCModule.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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
  34. /// more object oriented rather than controlling purely through module
  35. /// level interface calls (e.g. sit/stand).
  36. /// </summary>
  37. public interface INPC
  38. {
  39. /// <summary>
  40. /// Should this NPC be sensed by LSL sensors as an 'agent'
  41. /// (interpreted here to mean a normal user) rather than an OpenSim
  42. /// specific NPC extension?
  43. /// </summary>
  44. bool SenseAsAgent { get; }
  45. }
  46. public interface INPCModule
  47. {
  48. /// <summary>
  49. /// Create an NPC
  50. /// </summary>
  51. /// <param name="firstname"></param>
  52. /// <param name="lastname"></param>
  53. /// <param name="position"></param>
  54. /// <param name="senseAsAgent">
  55. /// Make the NPC show up as an agent on LSL sensors. The default is
  56. /// that they show up as the NPC type instead, but this is currently
  57. /// an OpenSim-only extension.
  58. /// </param>
  59. /// <param name="scene"></param>
  60. /// <param name="appearance">
  61. /// The avatar appearance to use for the new NPC.
  62. /// </param>
  63. /// <returns>
  64. /// The UUID of the ScenePresence created. UUID.Zero if there was a
  65. /// failure.
  66. /// </returns>
  67. UUID CreateNPC(string firstname, string lastname, Vector3 position,
  68. UUID owner, bool senseAsAgent, Scene scene,
  69. AvatarAppearance appearance);
  70. /// <summary>
  71. /// Check if the agent is an NPC.
  72. /// </summary>
  73. /// <param name="agentID"></param>
  74. /// <param name="scene"></param>
  75. /// <returns>
  76. /// True if the agent is an NPC in the given scene. False otherwise.
  77. /// </returns>
  78. bool IsNPC(UUID agentID, Scene scene);
  79. /// <summary>
  80. /// Get the NPC.
  81. /// </summary>
  82. /// <remarks>
  83. /// This is not currently complete - manipulation of NPCs still occurs
  84. /// through the region interface.
  85. /// </remarks>
  86. /// <param name="agentID"></param>
  87. /// <param name="scene"></param>
  88. /// <returns>The NPC. null if it does not exist.</returns>
  89. INPC GetNPC(UUID agentID, Scene scene);
  90. /// <summary>
  91. /// Check if the caller has permission to manipulate the given NPC.
  92. /// </summary>
  93. /// <param name="npcID"></param>
  94. /// <param name="callerID"></param>
  95. /// <returns>
  96. /// true if they do, false if they don't or if there's no NPC with the
  97. /// given ID.
  98. /// </returns>
  99. bool CheckPermissions(UUID npcID, UUID callerID);
  100. /// <summary>
  101. /// Set the appearance for an NPC.
  102. /// </summary>
  103. /// <param name="agentID"></param>
  104. /// <param name="appearance"></param>
  105. /// <param name="scene"></param>
  106. /// <returns>
  107. /// True if the operation succeeded, false if there was no such agent
  108. /// or the agent was not an NPC.
  109. /// </returns>
  110. bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance,
  111. Scene scene);
  112. /// <summary>
  113. /// Move an NPC to a target over time.
  114. /// </summary>
  115. /// <param name="agentID">The UUID of the NPC</param>
  116. /// <param name="scene"></param>
  117. /// <param name="pos"></param>
  118. /// <param name="noFly">
  119. /// If true, then the avatar will attempt to walk to the location even
  120. /// if it's up in the air. This is to allow walking on prims.
  121. /// </param>
  122. /// <param name="landAtTarget">
  123. /// If true and the avatar is flying when it reaches the target, land.
  124. /// </param> name="running">
  125. /// If true, NPC moves with running speed.
  126. /// <returns>
  127. /// True if the operation succeeded, false if there was no such agent
  128. /// or the agent was not an NPC.
  129. /// </returns>
  130. bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly,
  131. bool landAtTarget, bool running);
  132. /// <summary>
  133. /// Stop the NPC's current movement.
  134. /// </summary>
  135. /// <param name="agentID">The UUID of the NPC</param>
  136. /// <param name="scene"></param>
  137. /// <returns>
  138. /// True if the operation succeeded, false if there was no such agent
  139. /// or the agent was not an NPC.
  140. /// </returns>
  141. bool StopMoveToTarget(UUID agentID, Scene scene);
  142. /// <summary>
  143. /// Get the NPC to say something.
  144. /// </summary>
  145. /// <param name="agentID">The UUID of the NPC</param>
  146. /// <param name="scene"></param>
  147. /// <param name="text"></param>
  148. /// <returns>
  149. /// True if the operation succeeded, false if there was no such agent
  150. /// or the agent was not an NPC.
  151. /// </returns>
  152. bool Say(UUID agentID, Scene scene, string text);
  153. /// <summary>
  154. /// Get the NPC to say something.
  155. /// </summary>
  156. /// <param name="agentID">The UUID of the NPC</param>
  157. /// <param name="scene"></param>
  158. /// <param name="text"></param>
  159. /// <param name="channel"></param>
  160. /// <returns>
  161. /// True if the operation succeeded, false if there was no such agent
  162. /// or the agent was not an NPC.
  163. /// </returns>
  164. bool Say(UUID agentID, Scene scene, string text, int channel);
  165. /// <summary>
  166. /// Get the NPC to shout something.
  167. /// </summary>
  168. /// <param name="agentID">The UUID of the NPC</param>
  169. /// <param name="scene"></param>
  170. /// <param name="text"></param>
  171. /// <param name="channel"></param>
  172. /// <returns>
  173. /// True if the operation succeeded, false if there was no such agent
  174. /// or the agent was not an NPC.
  175. /// </returns>
  176. bool Shout(UUID agentID, Scene scene, string text, int channel);
  177. /// <summary>
  178. /// Get the NPC to whisper something.
  179. /// </summary>
  180. /// <param name="agentID">The UUID of the NPC</param>
  181. /// <param name="scene"></param>
  182. /// <param name="text"></param>
  183. /// <param name="channel"></param>
  184. /// <returns>
  185. /// True if the operation succeeded, false if there was no such agent
  186. /// or the agent was not an NPC.
  187. /// </returns>
  188. bool Whisper(UUID agentID, Scene scene, string text, int channel);
  189. /// <summary>
  190. /// Sit the NPC.
  191. /// </summary>
  192. /// <param name="agentID"></param>
  193. /// <param name="partID"></param>
  194. /// <param name="scene"></param>
  195. /// <returns>true if the sit succeeded, false if not</returns>
  196. bool Sit(UUID agentID, UUID partID, Scene scene);
  197. /// <summary>
  198. /// Stand a sitting NPC.
  199. /// </summary>
  200. /// <param name="agentID"></param>
  201. /// <param name="scene"></param>
  202. /// <returns>true if the stand succeeded, false if not</returns>
  203. bool Stand(UUID agentID, Scene scene);
  204. /// <summary>
  205. /// Get the NPC to touch an object.
  206. /// </summary>
  207. /// <param name="agentID"></param>
  208. /// <param name="partID"></param>
  209. /// <returns>
  210. /// true if the touch is actually attempted, false if not.
  211. /// </returns>
  212. bool Touch(UUID agentID, UUID partID);
  213. /// <summary>
  214. /// Delete an NPC.
  215. /// </summary>
  216. /// <param name="agentID">The UUID of the NPC</param>
  217. /// <param name="scene"></param>
  218. /// <returns>
  219. /// True if the operation succeeded, false if there was no such agent
  220. /// or the agent was not an NPC.
  221. /// </returns>
  222. bool DeleteNPC(UUID agentID, Scene scene);
  223. /// <summary>
  224. /// Get the owner of a NPC
  225. /// </summary>
  226. /// <param name="agentID">The UUID of the NPC</param>
  227. /// <returns>
  228. /// UUID of owner if the NPC exists, UUID.Zero if there was no such
  229. /// agent, the agent is unowned or the agent was not an NPC.
  230. /// </returns>
  231. UUID GetOwner(UUID agentID);
  232. }
  233. }