aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs22
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs47
2 files changed, 44 insertions, 25 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index b3e1069..4fcf40d 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
47 private readonly string m_firstname; 47 private readonly string m_firstname;
48 private readonly string m_lastname; 48 private readonly string m_lastname;
49 private readonly Vector3 m_startPos; 49 private readonly Vector3 m_startPos;
50 private readonly UUID m_uuid = UUID.Random(); 50 private UUID m_uuid = UUID.Random();
51 private readonly Scene m_scene; 51 private readonly Scene m_scene;
52 private readonly UUID m_ownerID; 52 private readonly UUID m_ownerID;
53 53
@@ -174,7 +174,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
174#pragma warning disable 67 174#pragma warning disable 67
175 public event Action<IClientAPI> OnLogout; 175 public event Action<IClientAPI> OnLogout;
176 public event ObjectPermissions OnObjectPermissions; 176 public event ObjectPermissions OnObjectPermissions;
177 177 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
178 public event MoneyTransferRequest OnMoneyTransferRequest; 178 public event MoneyTransferRequest OnMoneyTransferRequest;
179 public event ParcelBuy OnParcelBuy; 179 public event ParcelBuy OnParcelBuy;
180 public event Action<IClientAPI> OnConnectionClosed; 180 public event Action<IClientAPI> OnConnectionClosed;
@@ -194,6 +194,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
194 public event ObjectDrop OnObjectDrop; 194 public event ObjectDrop OnObjectDrop;
195 public event StartAnim OnStartAnim; 195 public event StartAnim OnStartAnim;
196 public event StopAnim OnStopAnim; 196 public event StopAnim OnStopAnim;
197 public event ChangeAnim OnChangeAnim;
197 public event LinkObjects OnLinkObjects; 198 public event LinkObjects OnLinkObjects;
198 public event DelinkObjects OnDelinkObjects; 199 public event DelinkObjects OnDelinkObjects;
199 public event RequestMapBlocks OnRequestMapBlocks; 200 public event RequestMapBlocks OnRequestMapBlocks;
@@ -243,6 +244,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
243 public event UpdatePrimTexture OnUpdatePrimTexture; 244 public event UpdatePrimTexture OnUpdatePrimTexture;
244 public event UpdateVector OnUpdatePrimGroupPosition; 245 public event UpdateVector OnUpdatePrimGroupPosition;
245 public event UpdateVector OnUpdatePrimSinglePosition; 246 public event UpdateVector OnUpdatePrimSinglePosition;
247 public event ClientChangeObject onClientChangeObject;
246 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 248 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
247 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; 249 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
248 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 250 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
@@ -380,7 +382,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
380 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 382 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
381 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 383 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
382 public event ClassifiedDelete OnClassifiedDelete; 384 public event ClassifiedDelete OnClassifiedDelete;
383 public event ClassifiedDelete OnClassifiedGodDelete; 385 public event ClassifiedGodDelete OnClassifiedGodDelete;
384 386
385 public event EventNotificationAddRequest OnEventNotificationAddRequest; 387 public event EventNotificationAddRequest OnEventNotificationAddRequest;
386 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 388 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
@@ -419,6 +421,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
419 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 421 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
420 public event SimWideDeletesDelegate OnSimWideDeletes; 422 public event SimWideDeletesDelegate OnSimWideDeletes;
421 public event SendPostcard OnSendPostcard; 423 public event SendPostcard OnSendPostcard;
424 public event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
422 public event MuteListEntryUpdate OnUpdateMuteListEntry; 425 public event MuteListEntryUpdate OnUpdateMuteListEntry;
423 public event MuteListEntryRemove OnRemoveMuteListEntry; 426 public event MuteListEntryRemove OnRemoveMuteListEntry;
424 public event GodlikeMessage onGodlikeMessage; 427 public event GodlikeMessage onGodlikeMessage;
@@ -446,6 +449,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
446 public virtual UUID AgentId 449 public virtual UUID AgentId
447 { 450 {
448 get { return m_uuid; } 451 get { return m_uuid; }
452 set { m_uuid = value; }
449 } 453 }
450 454
451 public UUID SessionId 455 public UUID SessionId
@@ -854,8 +858,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
854 858
855 public void Close() 859 public void Close()
856 { 860 {
857 // Remove ourselves from the scene 861 Close(true);
858 m_scene.RemoveClient(AgentId, false); 862 }
863
864 public void Close(bool sendStop)
865 {
859 } 866 }
860 867
861 public void Start() 868 public void Start()
@@ -1185,5 +1192,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1185 public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data) 1192 public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
1186 { 1193 {
1187 } 1194 }
1195
1196 public void SendPartPhysicsProprieties(ISceneEntity entity)
1197 {
1198 }
1199
1188 } 1200 }
1189} 1201}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index d3456ab..a32ab2a 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -144,29 +144,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC
144// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); 144// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
145// } 145// }
146 146
147 lock (m_avatars) 147 ManualResetEvent ev = new ManualResetEvent(false);
148 {
149 scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
150 scene.AddNewClient(npcAvatar, PresenceType.Npc);
151 148
152 ScenePresence sp; 149 Util.FireAndForget(delegate(object x) {
153 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) 150 lock (m_avatars)
154 { 151 {
155// m_log.DebugFormat( 152 scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
156// "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); 153 scene.AddNewClient(npcAvatar, PresenceType.Npc);
157 154
158 sp.CompleteMovement(npcAvatar, false); 155 ScenePresence sp;
159 m_avatars.Add(npcAvatar.AgentId, npcAvatar); 156 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
160 m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); 157 {
161 158 sp.CompleteMovement(npcAvatar, false);
162 return npcAvatar.AgentId; 159 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
163 } 160 m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name);
164 else 161 }
165 {
166 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
167 return UUID.Zero;
168 } 162 }
169 } 163 ev.Set();
164 });
165
166 ev.WaitOne();
167
168// m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
169
170 return npcAvatar.AgentId;
170 } 171 }
171 172
172 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running) 173 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running)
@@ -356,9 +357,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
356 { 357 {
357 NPCAvatar av; 358 NPCAvatar av;
358 if (m_avatars.TryGetValue(npcID, out av)) 359 if (m_avatars.TryGetValue(npcID, out av))
360 {
361 if (npcID == callerID)
362 return true;
359 return CheckPermissions(av, callerID); 363 return CheckPermissions(av, callerID);
364 }
360 else 365 else
366 {
361 return false; 367 return false;
368 }
362 } 369 }
363 } 370 }
364 371
@@ -370,7 +377,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
370 /// <returns>true if they do, false if they don't.</returns> 377 /// <returns>true if they do, false if they don't.</returns>
371 private bool CheckPermissions(NPCAvatar av, UUID callerID) 378 private bool CheckPermissions(NPCAvatar av, UUID callerID)
372 { 379 {
373 return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID; 380 return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID;
374 } 381 }
375 } 382 }
376} 383}