diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC')
3 files changed, 75 insertions, 38 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index fb644b7..35af6e7 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -61,10 +61,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
61 | private readonly string m_firstname; | 61 | private readonly string m_firstname; |
62 | private readonly string m_lastname; | 62 | private readonly string m_lastname; |
63 | private readonly Vector3 m_startPos; | 63 | private readonly Vector3 m_startPos; |
64 | private readonly UUID m_uuid; | 64 | private UUID m_uuid = UUID.Random(); |
65 | private readonly Scene m_scene; | 65 | private readonly Scene m_scene; |
66 | private readonly UUID m_ownerID; | 66 | private readonly UUID m_ownerID; |
67 | 67 | ||
68 | public List<uint> SelectedObjects {get; private set;} | ||
69 | |||
68 | public NPCAvatar( | 70 | public NPCAvatar( |
69 | string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene) | 71 | string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene) |
70 | { | 72 | { |
@@ -94,6 +96,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
94 | get { return m_scene; } | 96 | get { return m_scene; } |
95 | } | 97 | } |
96 | 98 | ||
99 | public int PingTimeMS { get { return 0; } } | ||
100 | |||
97 | public UUID OwnerID | 101 | public UUID OwnerID |
98 | { | 102 | { |
99 | get { return m_ownerID; } | 103 | get { return m_ownerID; } |
@@ -248,7 +252,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
248 | #pragma warning disable 67 | 252 | #pragma warning disable 67 |
249 | public event Action<IClientAPI> OnLogout; | 253 | public event Action<IClientAPI> OnLogout; |
250 | public event ObjectPermissions OnObjectPermissions; | 254 | public event ObjectPermissions OnObjectPermissions; |
251 | 255 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | |
252 | public event MoneyTransferRequest OnMoneyTransferRequest; | 256 | public event MoneyTransferRequest OnMoneyTransferRequest; |
253 | public event ParcelBuy OnParcelBuy; | 257 | public event ParcelBuy OnParcelBuy; |
254 | public event Action<IClientAPI> OnConnectionClosed; | 258 | public event Action<IClientAPI> OnConnectionClosed; |
@@ -268,6 +272,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
268 | public event ObjectDrop OnObjectDrop; | 272 | public event ObjectDrop OnObjectDrop; |
269 | public event StartAnim OnStartAnim; | 273 | public event StartAnim OnStartAnim; |
270 | public event StopAnim OnStopAnim; | 274 | public event StopAnim OnStopAnim; |
275 | public event ChangeAnim OnChangeAnim; | ||
271 | public event LinkObjects OnLinkObjects; | 276 | public event LinkObjects OnLinkObjects; |
272 | public event DelinkObjects OnDelinkObjects; | 277 | public event DelinkObjects OnDelinkObjects; |
273 | public event RequestMapBlocks OnRequestMapBlocks; | 278 | public event RequestMapBlocks OnRequestMapBlocks; |
@@ -318,6 +323,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
318 | public event UpdatePrimTexture OnUpdatePrimTexture; | 323 | public event UpdatePrimTexture OnUpdatePrimTexture; |
319 | public event UpdateVector OnUpdatePrimGroupPosition; | 324 | public event UpdateVector OnUpdatePrimGroupPosition; |
320 | public event UpdateVector OnUpdatePrimSinglePosition; | 325 | public event UpdateVector OnUpdatePrimSinglePosition; |
326 | public event ClientChangeObject onClientChangeObject; | ||
321 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | 327 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; |
322 | public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; | 328 | public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; |
323 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; | 329 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; |
@@ -456,7 +462,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
456 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 462 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
457 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 463 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
458 | public event ClassifiedDelete OnClassifiedDelete; | 464 | public event ClassifiedDelete OnClassifiedDelete; |
459 | public event ClassifiedDelete OnClassifiedGodDelete; | 465 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
460 | 466 | ||
461 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 467 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
462 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 468 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
@@ -495,11 +501,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
495 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 501 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
496 | public event SimWideDeletesDelegate OnSimWideDeletes; | 502 | public event SimWideDeletesDelegate OnSimWideDeletes; |
497 | public event SendPostcard OnSendPostcard; | 503 | public event SendPostcard OnSendPostcard; |
504 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
498 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 505 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
499 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 506 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
500 | public event GodlikeMessage onGodlikeMessage; | 507 | public event GodlikeMessage onGodlikeMessage; |
501 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 508 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
502 | 509 | public event GenericCall2 OnUpdateThrottles; | |
503 | #pragma warning restore 67 | 510 | #pragma warning restore 67 |
504 | 511 | ||
505 | #endregion | 512 | #endregion |
@@ -522,6 +529,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
522 | public virtual UUID AgentId | 529 | public virtual UUID AgentId |
523 | { | 530 | { |
524 | get { return m_uuid; } | 531 | get { return m_uuid; } |
532 | set { m_uuid = value; } | ||
525 | } | 533 | } |
526 | 534 | ||
527 | public UUID SessionId | 535 | public UUID SessionId |
@@ -627,6 +635,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
627 | public virtual void SetChildAgentThrottle(byte[] throttle) | 635 | public virtual void SetChildAgentThrottle(byte[] throttle) |
628 | { | 636 | { |
629 | } | 637 | } |
638 | |||
639 | public virtual void SetChildAgentThrottle(byte[] throttle, float factor) | ||
640 | { | ||
641 | |||
642 | } | ||
643 | |||
644 | public void SetAgentThrottleSilent(int throttle, int setting) | ||
645 | { | ||
646 | |||
647 | |||
648 | } | ||
630 | public byte[] GetThrottlesPacked(float multiplier) | 649 | public byte[] GetThrottlesPacked(float multiplier) |
631 | { | 650 | { |
632 | return new byte[0]; | 651 | return new byte[0]; |
@@ -665,6 +684,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
665 | 684 | ||
666 | } | 685 | } |
667 | 686 | ||
687 | public virtual bool CanSendLayerData() | ||
688 | { | ||
689 | return false; | ||
690 | } | ||
691 | |||
668 | public virtual void SendLayerData(float[] map) | 692 | public virtual void SendLayerData(float[] map) |
669 | { | 693 | { |
670 | } | 694 | } |
@@ -772,6 +796,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
772 | { | 796 | { |
773 | } | 797 | } |
774 | 798 | ||
799 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) | ||
800 | { | ||
801 | } | ||
802 | |||
775 | public virtual void SendRemoveInventoryItem(UUID itemID) | 803 | public virtual void SendRemoveInventoryItem(UUID itemID) |
776 | { | 804 | { |
777 | } | 805 | } |
@@ -788,7 +816,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
788 | { | 816 | { |
789 | } | 817 | } |
790 | 818 | ||
791 | public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) | 819 | public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) |
792 | { | 820 | { |
793 | } | 821 | } |
794 | public virtual void SendAbortXferPacket(ulong xferID) | 822 | public virtual void SendAbortXferPacket(ulong xferID) |
@@ -933,10 +961,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
933 | 961 | ||
934 | public void Close() | 962 | public void Close() |
935 | { | 963 | { |
936 | Close(false); | 964 | Close(true, false); |
937 | } | 965 | } |
938 | 966 | ||
939 | public void Close(bool force) | 967 | public void Close(bool sendStop, bool force) |
940 | { | 968 | { |
941 | // Remove ourselves from the scene | 969 | // Remove ourselves from the scene |
942 | m_scene.RemoveClient(AgentId, false); | 970 | m_scene.RemoveClient(AgentId, false); |
@@ -1269,5 +1297,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
1269 | { | 1297 | { |
1270 | } | 1298 | } |
1271 | 1299 | ||
1300 | public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) | ||
1301 | { | ||
1302 | } | ||
1303 | |||
1304 | public int GetAgentThrottleSilent(int throttle) | ||
1305 | { | ||
1306 | return 0; | ||
1307 | } | ||
1308 | |||
1272 | } | 1309 | } |
1273 | } | 1310 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 9232db9..9dc4489 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -167,10 +167,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
167 | npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, | 167 | npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, |
168 | int.MaxValue); | 168 | int.MaxValue); |
169 | 169 | ||
170 | m_log.DebugFormat( | 170 | // m_log.DebugFormat( |
171 | "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", | 171 | // "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", |
172 | firstname, lastname, npcAvatar.AgentId, owner, | 172 | // firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName); |
173 | senseAsAgent, position, scene.RegionInfo.RegionName); | ||
174 | 173 | ||
175 | AgentCircuitData acd = new AgentCircuitData(); | 174 | AgentCircuitData acd = new AgentCircuitData(); |
176 | acd.AgentID = npcAvatar.AgentId; | 175 | acd.AgentID = npcAvatar.AgentId; |
@@ -192,36 +191,31 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
192 | } | 191 | } |
193 | */ | 192 | */ |
194 | 193 | ||
195 | lock (m_avatars) | 194 | // ManualResetEvent ev = new ManualResetEvent(false); |
196 | { | ||
197 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, | ||
198 | acd); | ||
199 | scene.AddNewAgent(npcAvatar, PresenceType.Npc); | ||
200 | 195 | ||
201 | ScenePresence sp; | 196 | // Util.FireAndForget(delegate(object x) { |
202 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 197 | lock (m_avatars) |
203 | { | 198 | { |
204 | /* | 199 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); |
205 | m_log.DebugFormat( | 200 | scene.AddNewAgent(npcAvatar, PresenceType.Npc); |
206 | "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", | ||
207 | sp.Name, sp.UUID); | ||
208 | */ | ||
209 | 201 | ||
210 | sp.CompleteMovement(npcAvatar, false); | 202 | ScenePresence sp; |
211 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | 203 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) |
212 | m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | 204 | { |
213 | 205 | ||
214 | return npcAvatar.AgentId; | 206 | sp.CompleteMovement(npcAvatar, false); |
207 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | ||
208 | // m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | ||
209 | } | ||
215 | } | 210 | } |
216 | else | 211 | // ev.Set(); |
217 | { | 212 | // }); |
218 | m_log.WarnFormat( | ||
219 | "[NPC MODULE]: Could not find scene presence for NPC {0} {1}", | ||
220 | sp.Name, sp.UUID); | ||
221 | 213 | ||
222 | return UUID.Zero; | 214 | // ev.WaitOne(); |
223 | } | 215 | |
224 | } | 216 | // m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); |
217 | |||
218 | return npcAvatar.AgentId; | ||
225 | } | 219 | } |
226 | 220 | ||
227 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, | 221 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, |
@@ -436,9 +430,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
436 | { | 430 | { |
437 | NPCAvatar av; | 431 | NPCAvatar av; |
438 | if (m_avatars.TryGetValue(npcID, out av)) | 432 | if (m_avatars.TryGetValue(npcID, out av)) |
433 | { | ||
434 | if (npcID == callerID) | ||
435 | return true; | ||
439 | return CheckPermissions(av, callerID); | 436 | return CheckPermissions(av, callerID); |
437 | } | ||
440 | else | 438 | else |
439 | { | ||
441 | return false; | 440 | return false; |
441 | } | ||
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 77dfd40..a892cf4 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -112,7 +112,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
112 | // ScenePresence.SendInitialData() to reset our entire appearance. | 112 | // ScenePresence.SendInitialData() to reset our entire appearance. |
113 | m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); | 113 | m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); |
114 | 114 | ||
115 | m_afMod.SetAppearance(sp, originalTe, null, null); | 115 | m_afMod.SetAppearance(sp, originalTe, null, new WearableCacheItem[0] ); |
116 | 116 | ||
117 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); | 117 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); |
118 | 118 | ||
@@ -483,4 +483,4 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
483 | Assert.That(npc.ParentID, Is.EqualTo(0)); | 483 | Assert.That(npc.ParentID, Is.EqualTo(0)); |
484 | } | 484 | } |
485 | } | 485 | } |
486 | } \ No newline at end of file | 486 | } |