aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
diff options
context:
space:
mode:
authorMelanie2012-01-06 21:34:43 +0100
committerMelanie2012-01-06 21:34:43 +0100
commitf1846045a6663c0530524d7c91d1ed17bf449c07 (patch)
treef4592ad721f22ff632da5f14dd3552647d404867 /OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-f1846045a6663c0530524d7c91d1ed17bf449c07.zip
opensim-SC-f1846045a6663c0530524d7c91d1ed17bf449c07.tar.gz
opensim-SC-f1846045a6663c0530524d7c91d1ed17bf449c07.tar.bz2
opensim-SC-f1846045a6663c0530524d7c91d1ed17bf449c07.tar.xz
Add osNpcCreateOwned to create an owned NPC. Those can be sensed only by the owner, can be destroyed only by the owner and only the owner can save their appearance. Added "NPC" as a flag to llSensor to sense NPCs and exclude them from "AGENT" results.
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs28
1 files changed, 23 insertions, 5 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 56ff367..e874417 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -91,9 +91,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
91 } 91 }
92 92
93 public UUID CreateNPC( 93 public UUID CreateNPC(
94 string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance) 94 string firstname, string lastname, Vector3 position, UUID owner, Scene scene, AvatarAppearance appearance)
95 { 95 {
96 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); 96 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, owner, scene);
97 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); 97 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
98 98
99 m_log.DebugFormat( 99 m_log.DebugFormat(
@@ -234,12 +234,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC
234 return false; 234 return false;
235 } 235 }
236 236
237 public bool DeleteNPC(UUID agentID, Scene scene) 237 public UUID GetOwner(UUID agentID)
238 { 238 {
239 lock (m_avatars) 239 lock (m_avatars)
240 { 240 {
241 if (m_avatars.ContainsKey(agentID)) 241 NPCAvatar av;
242 if (m_avatars.TryGetValue(agentID, out av))
242 { 243 {
244 return av.OwnerID;
245 }
246 }
247
248 return UUID.Zero;
249 }
250
251 public bool DeleteNPC(UUID agentID, UUID callerID, Scene scene)
252 {
253 lock (m_avatars)
254 {
255 NPCAvatar av;
256 if (m_avatars.TryGetValue(agentID, out av))
257 {
258 if (av.OwnerID != UUID.Zero && callerID != UUID.Zero && av.OwnerID != callerID)
259 return false;
260
243 scene.RemoveClient(agentID, false); 261 scene.RemoveClient(agentID, false);
244 m_avatars.Remove(agentID); 262 m_avatars.Remove(agentID);
245 263
@@ -268,4 +286,4 @@ namespace OpenSim.Region.OptionalModules.World.NPC
268 get { return true; } 286 get { return true; }
269 } 287 }
270 } 288 }
271} \ No newline at end of file 289}