aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Interfaces/INPCModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Interfaces/INPCModule.cs')
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs288
1 files changed, 288 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
new file mode 100644
index 0000000..478833e
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -0,0 +1,288 @@
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
28using OpenMetaverse;
29using OpenSim.Framework;
30using OpenSim.Region.Framework.Scenes;
31
32namespace OpenSim.Region.Framework.Interfaces
33{
34 /// <summary>
35 /// Temporary interface. More methods to come at some point to make NPCs
36 /// more object oriented rather than controlling purely through module
37 /// level interface calls (e.g. sit/stand).
38 /// </summary>
39 public interface INPC
40 {
41 /// <summary>
42 /// Should this NPC be sensed by LSL sensors as an 'agent'
43 /// (interpreted here to mean a normal user) rather than an OpenSim
44 /// specific NPC extension?
45 /// </summary>
46 bool SenseAsAgent { get; }
47 }
48
49 public interface INPCModule
50 {
51 /// <summary>
52 /// Create an NPC
53 /// </summary>
54 /// <param name="firstname"></param>
55 /// <param name="lastname"></param>
56 /// <param name="position"></param>
57 /// <param name="senseAsAgent">
58 /// Make the NPC show up as an agent on LSL sensors. The default is
59 /// that they show up as the NPC type instead, but this is currently
60 /// an OpenSim-only extension.
61 /// </param>
62 /// <param name="scene"></param>
63 /// <param name="appearance">
64 /// The avatar appearance to use for the new NPC.
65 /// </param>
66 /// <returns>
67 /// The UUID of the ScenePresence created. UUID.Zero if there was a
68 /// failure.
69 /// </returns>
70 UUID CreateNPC(string firstname, string lastname, Vector3 position,
71 UUID owner, bool senseAsAgent, Scene scene,
72 AvatarAppearance appearance);
73
74 /// <summary>
75 /// Create an NPC with a user-supplied agentID
76 /// </summary>
77 /// <param name="firstname"></param>
78 /// <param name="lastname"></param>
79 /// <param name="position"></param>
80 /// <param name="agentID"></param>
81 /// The desired agent ID
82 /// <param name="owner"></param>
83 /// <param name="senseAsAgent">
84 /// Make the NPC show up as an agent on LSL sensors. The default is
85 /// that they show up as the NPC type instead, but this is currently
86 /// an OpenSim-only extension.
87 /// </param>
88 /// <param name="scene"></param>
89 /// <param name="appearance">
90 /// The avatar appearance to use for the new NPC.
91 /// </param>
92 /// <returns>
93 /// The UUID of the ScenePresence created. UUID.Zero if there was a
94 /// failure.
95 /// </returns>
96 UUID CreateNPC(string firstname, string lastname,
97 Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene,
98 AvatarAppearance appearance);
99
100 /// <summary>
101 /// Check if the agent is an NPC.
102 /// </summary>
103 /// <param name="agentID"></param>
104 /// <param name="scene"></param>
105 /// <returns>
106 /// True if the agent is an NPC in the given scene. False otherwise.
107 /// </returns>
108 bool IsNPC(UUID agentID, Scene scene);
109
110 /// <summary>
111 /// Get the NPC.
112 /// </summary>
113 /// <remarks>
114 /// This is not currently complete - manipulation of NPCs still occurs
115 /// through the region interface.
116 /// </remarks>
117 /// <param name="agentID"></param>
118 /// <param name="scene"></param>
119 /// <returns>The NPC. null if it does not exist.</returns>
120 INPC GetNPC(UUID agentID, Scene scene);
121
122 /// <summary>
123 /// Check if the caller has permission to manipulate the given NPC.
124 /// </summary>
125 /// <remarks>
126 /// A caller has permission if
127 /// * An NPC exists with the given npcID.
128 /// * The caller UUID given is UUID.Zero.
129 /// * The avatar is unowned (owner is UUID.Zero).
130 /// * The avatar is owned and the owner and callerID match.
131 /// * The avatar is owned and the callerID matches its agentID.
132 /// </remarks>
133 /// <param name="av"></param>
134 /// <param name="callerID"></param>
135 /// <returns>true if they do, false if they don't.</returns>
136 /// <param name="npcID"></param>
137 /// <param name="callerID"></param>
138 /// <returns>
139 /// true if they do, false if they don't or if there's no NPC with the
140 /// given ID.
141 /// </returns>
142 bool CheckPermissions(UUID npcID, UUID callerID);
143
144 /// <summary>
145 /// Set the appearance for an NPC.
146 /// </summary>
147 /// <param name="agentID"></param>
148 /// <param name="appearance"></param>
149 /// <param name="scene"></param>
150 /// <returns>
151 /// True if the operation succeeded, false if there was no such agent
152 /// or the agent was not an NPC.
153 /// </returns>
154 bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance,
155 Scene scene);
156
157 /// <summary>
158 /// Move an NPC to a target over time.
159 /// </summary>
160 /// <param name="agentID">The UUID of the NPC</param>
161 /// <param name="scene"></param>
162 /// <param name="pos"></param>
163 /// <param name="noFly">
164 /// If true, then the avatar will attempt to walk to the location even
165 /// if it's up in the air. This is to allow walking on prims.
166 /// </param>
167 /// <param name="landAtTarget">
168 /// If true and the avatar is flying when it reaches the target, land.
169 /// </param> name="running">
170 /// If true, NPC moves with running speed.
171 /// <returns>
172 /// True if the operation succeeded, false if there was no such agent
173 /// or the agent was not an NPC.
174 /// </returns>
175 bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly,
176 bool landAtTarget, bool running);
177
178 /// <summary>
179 /// Stop the NPC's current movement.
180 /// </summary>
181 /// <param name="agentID">The UUID of the NPC</param>
182 /// <param name="scene"></param>
183 /// <returns>
184 /// True if the operation succeeded, false if there was no such agent
185 /// or the agent was not an NPC.
186 /// </returns>
187 bool StopMoveToTarget(UUID agentID, Scene scene);
188
189 /// <summary>
190 /// Get the NPC to say something.
191 /// </summary>
192 /// <param name="agentID">The UUID of the NPC</param>
193 /// <param name="scene"></param>
194 /// <param name="text"></param>
195 /// <returns>
196 /// True if the operation succeeded, false if there was no such agent
197 /// or the agent was not an NPC.
198 /// </returns>
199 bool Say(UUID agentID, Scene scene, string text);
200
201 /// <summary>
202 /// Get the NPC to say something.
203 /// </summary>
204 /// <param name="agentID">The UUID of the NPC</param>
205 /// <param name="scene"></param>
206 /// <param name="text"></param>
207 /// <param name="channel"></param>
208 /// <returns>
209 /// True if the operation succeeded, false if there was no such agent
210 /// or the agent was not an NPC.
211 /// </returns>
212 bool Say(UUID agentID, Scene scene, string text, int channel);
213
214 /// <summary>
215 /// Get the NPC to shout something.
216 /// </summary>
217 /// <param name="agentID">The UUID of the NPC</param>
218 /// <param name="scene"></param>
219 /// <param name="text"></param>
220 /// <param name="channel"></param>
221 /// <returns>
222 /// True if the operation succeeded, false if there was no such agent
223 /// or the agent was not an NPC.
224 /// </returns>
225 bool Shout(UUID agentID, Scene scene, string text, int channel);
226
227 /// <summary>
228 /// Get the NPC to whisper something.
229 /// </summary>
230 /// <param name="agentID">The UUID of the NPC</param>
231 /// <param name="scene"></param>
232 /// <param name="text"></param>
233 /// <param name="channel"></param>
234 /// <returns>
235 /// True if the operation succeeded, false if there was no such agent
236 /// or the agent was not an NPC.
237 /// </returns>
238 bool Whisper(UUID agentID, Scene scene, string text, int channel);
239
240 /// <summary>
241 /// Sit the NPC.
242 /// </summary>
243 /// <param name="agentID"></param>
244 /// <param name="partID"></param>
245 /// <param name="scene"></param>
246 /// <returns>true if the sit succeeded, false if not</returns>
247 bool Sit(UUID agentID, UUID partID, Scene scene);
248
249 /// <summary>
250 /// Stand a sitting NPC.
251 /// </summary>
252 /// <param name="agentID"></param>
253 /// <param name="scene"></param>
254 /// <returns>true if the stand succeeded, false if not</returns>
255 bool Stand(UUID agentID, Scene scene);
256
257 /// <summary>
258 /// Get the NPC to touch an object.
259 /// </summary>
260 /// <param name="agentID"></param>
261 /// <param name="partID"></param>
262 /// <returns>
263 /// true if the touch is actually attempted, false if not.
264 /// </returns>
265 bool Touch(UUID agentID, UUID partID);
266
267 /// <summary>
268 /// Delete an NPC.
269 /// </summary>
270 /// <param name="agentID">The UUID of the NPC</param>
271 /// <param name="scene"></param>
272 /// <returns>
273 /// True if the operation succeeded, false if there was no such agent
274 /// or the agent was not an NPC.
275 /// </returns>
276 bool DeleteNPC(UUID agentID, Scene scene);
277
278 /// <summary>
279 /// Get the owner of a NPC
280 /// </summary>
281 /// <param name="agentID">The UUID of the NPC</param>
282 /// <returns>
283 /// UUID of owner if the NPC exists, UUID.Zero if there was no such
284 /// agent, the agent is unowned or the agent was not an NPC.
285 /// </returns>
286 UUID GetOwner(UUID agentID);
287 }
288}