aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC
diff options
context:
space:
mode:
authorUbitUmarov2015-09-01 14:54:35 +0100
committerUbitUmarov2015-09-01 14:54:35 +0100
commit371c9dd2af01a2e7422ec901ee1f80757284a78c (patch)
tree058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/OptionalModules/World/NPC
parentremove lixo (diff)
parentdont change camera on crossings (diff)
downloadopensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz
bad merge?
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs53
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs62
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs4
3 files changed, 82 insertions, 37 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index fb644b7..dc1ea95 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -61,10 +61,16 @@ 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<<<<<<< HEAD
64 private readonly UUID m_uuid; 65 private readonly UUID m_uuid;
66=======
67 private UUID m_uuid = UUID.Random();
68>>>>>>> avn/ubitvar
65 private readonly Scene m_scene; 69 private readonly Scene m_scene;
66 private readonly UUID m_ownerID; 70 private readonly UUID m_ownerID;
67 71
72 public List<uint> SelectedObjects {get; private set;}
73
68 public NPCAvatar( 74 public NPCAvatar(
69 string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene) 75 string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene)
70 { 76 {
@@ -94,6 +100,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
94 get { return m_scene; } 100 get { return m_scene; }
95 } 101 }
96 102
103 public int PingTimeMS { get { return 0; } }
104
97 public UUID OwnerID 105 public UUID OwnerID
98 { 106 {
99 get { return m_ownerID; } 107 get { return m_ownerID; }
@@ -248,7 +256,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
248#pragma warning disable 67 256#pragma warning disable 67
249 public event Action<IClientAPI> OnLogout; 257 public event Action<IClientAPI> OnLogout;
250 public event ObjectPermissions OnObjectPermissions; 258 public event ObjectPermissions OnObjectPermissions;
251 259 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
252 public event MoneyTransferRequest OnMoneyTransferRequest; 260 public event MoneyTransferRequest OnMoneyTransferRequest;
253 public event ParcelBuy OnParcelBuy; 261 public event ParcelBuy OnParcelBuy;
254 public event Action<IClientAPI> OnConnectionClosed; 262 public event Action<IClientAPI> OnConnectionClosed;
@@ -268,6 +276,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
268 public event ObjectDrop OnObjectDrop; 276 public event ObjectDrop OnObjectDrop;
269 public event StartAnim OnStartAnim; 277 public event StartAnim OnStartAnim;
270 public event StopAnim OnStopAnim; 278 public event StopAnim OnStopAnim;
279 public event ChangeAnim OnChangeAnim;
271 public event LinkObjects OnLinkObjects; 280 public event LinkObjects OnLinkObjects;
272 public event DelinkObjects OnDelinkObjects; 281 public event DelinkObjects OnDelinkObjects;
273 public event RequestMapBlocks OnRequestMapBlocks; 282 public event RequestMapBlocks OnRequestMapBlocks;
@@ -318,6 +327,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
318 public event UpdatePrimTexture OnUpdatePrimTexture; 327 public event UpdatePrimTexture OnUpdatePrimTexture;
319 public event UpdateVector OnUpdatePrimGroupPosition; 328 public event UpdateVector OnUpdatePrimGroupPosition;
320 public event UpdateVector OnUpdatePrimSinglePosition; 329 public event UpdateVector OnUpdatePrimSinglePosition;
330 public event ClientChangeObject onClientChangeObject;
321 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 331 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
322 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; 332 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
323 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 333 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
@@ -456,7 +466,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
456 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 466 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
457 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 467 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
458 public event ClassifiedDelete OnClassifiedDelete; 468 public event ClassifiedDelete OnClassifiedDelete;
459 public event ClassifiedDelete OnClassifiedGodDelete; 469 public event ClassifiedGodDelete OnClassifiedGodDelete;
460 470
461 public event EventNotificationAddRequest OnEventNotificationAddRequest; 471 public event EventNotificationAddRequest OnEventNotificationAddRequest;
462 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 472 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
@@ -495,11 +505,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC
495 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 505 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
496 public event SimWideDeletesDelegate OnSimWideDeletes; 506 public event SimWideDeletesDelegate OnSimWideDeletes;
497 public event SendPostcard OnSendPostcard; 507 public event SendPostcard OnSendPostcard;
508 public event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
498 public event MuteListEntryUpdate OnUpdateMuteListEntry; 509 public event MuteListEntryUpdate OnUpdateMuteListEntry;
499 public event MuteListEntryRemove OnRemoveMuteListEntry; 510 public event MuteListEntryRemove OnRemoveMuteListEntry;
500 public event GodlikeMessage onGodlikeMessage; 511 public event GodlikeMessage onGodlikeMessage;
501 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 512 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
502 513 public event GenericCall2 OnUpdateThrottles;
503#pragma warning restore 67 514#pragma warning restore 67
504 515
505 #endregion 516 #endregion
@@ -522,6 +533,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
522 public virtual UUID AgentId 533 public virtual UUID AgentId
523 { 534 {
524 get { return m_uuid; } 535 get { return m_uuid; }
536 set { m_uuid = value; }
525 } 537 }
526 538
527 public UUID SessionId 539 public UUID SessionId
@@ -627,6 +639,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
627 public virtual void SetChildAgentThrottle(byte[] throttle) 639 public virtual void SetChildAgentThrottle(byte[] throttle)
628 { 640 {
629 } 641 }
642
643 public virtual void SetChildAgentThrottle(byte[] throttle, float factor)
644 {
645
646 }
647
648 public void SetAgentThrottleSilent(int throttle, int setting)
649 {
650
651
652 }
630 public byte[] GetThrottlesPacked(float multiplier) 653 public byte[] GetThrottlesPacked(float multiplier)
631 { 654 {
632 return new byte[0]; 655 return new byte[0];
@@ -665,6 +688,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
665 688
666 } 689 }
667 690
691 public virtual bool CanSendLayerData()
692 {
693 return false;
694 }
695
668 public virtual void SendLayerData(float[] map) 696 public virtual void SendLayerData(float[] map)
669 { 697 {
670 } 698 }
@@ -772,6 +800,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
772 { 800 {
773 } 801 }
774 802
803 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId)
804 {
805 }
806
775 public virtual void SendRemoveInventoryItem(UUID itemID) 807 public virtual void SendRemoveInventoryItem(UUID itemID)
776 { 808 {
777 } 809 }
@@ -788,7 +820,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
788 { 820 {
789 } 821 }
790 822
791 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) 823 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory)
792 { 824 {
793 } 825 }
794 public virtual void SendAbortXferPacket(ulong xferID) 826 public virtual void SendAbortXferPacket(ulong xferID)
@@ -933,10 +965,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
933 965
934 public void Close() 966 public void Close()
935 { 967 {
936 Close(false); 968 Close(true, false);
937 } 969 }
938 970
939 public void Close(bool force) 971 public void Close(bool sendStop, bool force)
940 { 972 {
941 // Remove ourselves from the scene 973 // Remove ourselves from the scene
942 m_scene.RemoveClient(AgentId, false); 974 m_scene.RemoveClient(AgentId, false);
@@ -1269,5 +1301,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1269 { 1301 {
1270 } 1302 }
1271 1303
1304 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
1305 {
1306 }
1307
1308 public int GetAgentThrottleSilent(int throttle)
1309 {
1310 return 0;
1311 }
1312
1272 } 1313 }
1273} 1314}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 9232db9..2977195 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
@@ -457,8 +457,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC
457 /// <returns>true if they do, false if they don't.</returns> 457 /// <returns>true if they do, false if they don't.</returns>
458 private bool CheckPermissions(NPCAvatar av, UUID callerID) 458 private bool CheckPermissions(NPCAvatar av, UUID callerID)
459 { 459 {
460<<<<<<< HEAD
460 return callerID == UUID.Zero || av.OwnerID == UUID.Zero || 461 return callerID == UUID.Zero || av.OwnerID == UUID.Zero ||
461 av.OwnerID == callerID || av.AgentId == callerID; 462 av.OwnerID == callerID || av.AgentId == callerID;
463=======
464 return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID;
465>>>>>>> avn/ubitvar
462 } 466 }
463 } 467 }
464} 468}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 0bebb58..2345e38 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
113 // ScenePresence.SendInitialData() to reset our entire appearance. 113 // ScenePresence.SendInitialData() to reset our entire appearance.
114 m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); 114 m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
115 115
116 m_afMod.SetAppearance(sp, originalTe, null, null); 116 m_afMod.SetAppearance(sp, originalTe, null, new WearableCacheItem[0] );
117 117
118 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); 118 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
119 119
@@ -484,4 +484,4 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
484 Assert.That(npc.ParentID, Is.EqualTo(0)); 484 Assert.That(npc.ParentID, Is.EqualTo(0));
485 } 485 }
486 } 486 }
487} \ No newline at end of file 487}