INPCModule.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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. /// Create an NPC with a user-supplied agentID
  72. /// </summary>
  73. /// <param name="firstname"></param>
  74. /// <param name="lastname"></param>
  75. /// <param name="position"></param>
  76. /// <param name="agentID"></param>
  77. /// The desired agent ID
  78. /// <param name="owner"></param>
  79. /// <param name="senseAsAgent">
  80. /// Make the NPC show up as an agent on LSL sensors. The default is
  81. /// that they show up as the NPC type instead, but this is currently
  82. /// an OpenSim-only extension.
  83. /// </param>
  84. /// <param name="scene"></param>
  85. /// <param name="appearance">
  86. /// The avatar appearance to use for the new NPC.
  87. /// </param>
  88. /// <returns>
  89. /// The UUID of the ScenePresence created. UUID.Zero if there was a
  90. /// failure.
  91. /// </returns>
  92. UUID CreateNPC(string firstname, string lastname,
  93. Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene,
  94. AvatarAppearance appearance);
  95. /// <summary>
  96. /// Check if the agent is an NPC.
  97. /// </summary>
  98. /// <param name="agentID"></param>
  99. /// <param name="scene"></param>
  100. /// <returns>
  101. /// True if the agent is an NPC in the given scene. False otherwise.
  102. /// </returns>
  103. bool IsNPC(UUID agentID, Scene scene);
  104. /// <summary>
  105. /// Get the NPC.
  106. /// </summary>
  107. /// <remarks>
  108. /// This is not currently complete - manipulation of NPCs still occurs
  109. /// through the region interface.
  110. /// </remarks>
  111. /// <param name="agentID"></param>
  112. /// <param name="scene"></param>
  113. /// <returns>The NPC. null if it does not exist.</returns>
  114. INPC GetNPC(UUID agentID, Scene scene);
  115. /// <summary>
  116. /// Check if the caller has permission to manipulate the given NPC.
  117. /// </summary>
  118. /// <param name="npcID"></param>
  119. /// <param name="callerID"></param>
  120. /// <returns>
  121. /// true if they do, false if they don't or if there's no NPC with the
  122. /// given ID.
  123. /// </returns>
  124. bool CheckPermissions(UUID npcID, UUID callerID);
  125. /// <summary>
  126. /// Set the appearance for an NPC.
  127. /// </summary>
  128. /// <param name="agentID"></param>
  129. /// <param name="appearance"></param>
  130. /// <param name="scene"></param>
  131. /// <returns>
  132. /// True if the operation succeeded, false if there was no such agent
  133. /// or the agent was not an NPC.
  134. /// </returns>
  135. bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance,
  136. Scene scene);
  137. /// <summary>
  138. /// Move an NPC to a target over time.
  139. /// </summary>
  140. /// <param name="agentID">The UUID of the NPC</param>
  141. /// <param name="scene"></param>
  142. /// <param name="pos"></param>
  143. /// <param name="noFly">
  144. /// If true, then the avatar will attempt to walk to the location even
  145. /// if it's up in the air. This is to allow walking on prims.
  146. /// </param>
  147. /// <param name="landAtTarget">
  148. /// If true and the avatar is flying when it reaches the target, land.
  149. /// </param> name="running">
  150. /// If true, NPC moves with running speed.
  151. /// <returns>
  152. /// True if the operation succeeded, false if there was no such agent
  153. /// or the agent was not an NPC.
  154. /// </returns>
  155. bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly,
  156. bool landAtTarget, bool running);
  157. /// <summary>
  158. /// Stop the NPC's current movement.
  159. /// </summary>
  160. /// <param name="agentID">The UUID of the NPC</param>
  161. /// <param name="scene"></param>
  162. /// <returns>
  163. /// True if the operation succeeded, false if there was no such agent
  164. /// or the agent was not an NPC.
  165. /// </returns>
  166. bool StopMoveToTarget(UUID agentID, Scene scene);
  167. /// <summary>
  168. /// Get the NPC to say something.
  169. /// </summary>
  170. /// <param name="agentID">The UUID of the NPC</param>
  171. /// <param name="scene"></param>
  172. /// <param name="text"></param>
  173. /// <returns>
  174. /// True if the operation succeeded, false if there was no such agent
  175. /// or the agent was not an NPC.
  176. /// </returns>
  177. bool Say(UUID agentID, Scene scene, string text);
  178. /// <summary>
  179. /// Get the NPC to say something.
  180. /// </summary>
  181. /// <param name="agentID">The UUID of the NPC</param>
  182. /// <param name="scene"></param>
  183. /// <param name="text"></param>
  184. /// <param name="channel"></param>
  185. /// <returns>
  186. /// True if the operation succeeded, false if there was no such agent
  187. /// or the agent was not an NPC.
  188. /// </returns>
  189. bool Say(UUID agentID, Scene scene, string text, int channel);
  190. /// <summary>
  191. /// Get the NPC to shout something.
  192. /// </summary>
  193. /// <param name="agentID">The UUID of the NPC</param>
  194. /// <param name="scene"></param>
  195. /// <param name="text"></param>
  196. /// <param name="channel"></param>
  197. /// <returns>
  198. /// True if the operation succeeded, false if there was no such agent
  199. /// or the agent was not an NPC.
  200. /// </returns>
  201. bool Shout(UUID agentID, Scene scene, string text, int channel);
  202. /// <summary>
  203. /// Get the NPC to whisper something.
  204. /// </summary>
  205. /// <param name="agentID">The UUID of the NPC</param>
  206. /// <param name="scene"></param>
  207. /// <param name="text"></param>
  208. /// <param name="channel"></param>
  209. /// <returns>
  210. /// True if the operation succeeded, false if there was no such agent
  211. /// or the agent was not an NPC.
  212. /// </returns>
  213. bool Whisper(UUID agentID, Scene scene, string text, int channel);
  214. /// <summary>
  215. /// Sit the NPC.
  216. /// </summary>
  217. /// <param name="agentID"></param>
  218. /// <param name="partID"></param>
  219. /// <param name="scene"></param>
  220. /// <returns>true if the sit succeeded, false if not</returns>
  221. bool Sit(UUID agentID, UUID partID, Scene scene);
  222. /// <summary>
  223. /// Stand a sitting NPC.
  224. /// </summary>
  225. /// <param name="agentID"></param>
  226. /// <param name="scene"></param>
  227. /// <returns>true if the stand succeeded, false if not</returns>
  228. bool Stand(UUID agentID, Scene scene);
  229. /// <summary>
  230. /// Get the NPC to touch an object.
  231. /// </summary>
  232. /// <param name="agentID"></param>
  233. /// <param name="partID"></param>
  234. /// <returns>
  235. /// true if the touch is actually attempted, false if not.
  236. /// </returns>
  237. bool Touch(UUID agentID, UUID partID);
  238. /// <summary>
  239. /// Delete an NPC.
  240. /// </summary>
  241. /// <param name="agentID">The UUID of the NPC</param>
  242. /// <param name="scene"></param>
  243. /// <returns>
  244. /// True if the operation succeeded, false if there was no such agent
  245. /// or the agent was not an NPC.
  246. /// </returns>
  247. bool DeleteNPC(UUID agentID, Scene scene);
  248. /// <summary>
  249. /// Get the owner of a NPC
  250. /// </summary>
  251. /// <param name="agentID">The UUID of the NPC</param>
  252. /// <returns>
  253. /// UUID of owner if the NPC exists, UUID.Zero if there was no such
  254. /// agent, the agent is unowned or the agent was not an NPC.
  255. /// </returns>
  256. UUID GetOwner(UUID agentID);
  257. }
  258. }