aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-05-01 22:24:21 +0100
committerJustin Clark-Casey (justincc)2014-05-01 22:24:21 +0100
commitc31d93cb6f478062332c6a04fd1c357bb11205ee (patch)
treef0894436d88091db8b134ca99501589432a99673 /OpenSim/Region/OptionalModules/World
parentminor: Use Vector2.Zero constant and only set in condition branch where it wa... (diff)
downloadopensim-SC_OLD-c31d93cb6f478062332c6a04fd1c357bb11205ee.zip
opensim-SC_OLD-c31d93cb6f478062332c6a04fd1c357bb11205ee.tar.gz
opensim-SC_OLD-c31d93cb6f478062332c6a04fd1c357bb11205ee.tar.bz2
opensim-SC_OLD-c31d93cb6f478062332c6a04fd1c357bb11205ee.tar.xz
Fix issue where only one of multiple attachments on the same attachpoint for NPCs would be seen by other viewers.
It appears that at least Singularity 1.8.5 (but probably others) rely on attachment FromItemIDs being different to display more than one. This commit resolves this by generating random IDs instead of always using UUID.Zero for NPCs. Resolves http://opensimulator.org/mantis/view.php?id=7110
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs3
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs53
2 files changed, 54 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 8a2da6e..03c6265 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -178,8 +178,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
178 acd.lastname = lastname; 178 acd.lastname = lastname;
179 acd.ServiceURLs = new Dictionary<string, object>(); 179 acd.ServiceURLs = new Dictionary<string, object>();
180 180
181 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, 181 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
182 true);
183 acd.Appearance = npcAppearance; 182 acd.Appearance = npcAppearance;
184 183
185 /* 184 /*
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index ddd4525..e82351e 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -199,6 +199,59 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
199 } 199 }
200 200
201 [Test] 201 [Test]
202 public void TestCreateWithMultiAttachments()
203 {
204 TestHelpers.InMethod();
205// TestHelpers.EnableLogging();
206
207 SetUpScene();
208// m_attMod.DebugLevel = 1;
209
210 UUID userId = TestHelpers.ParseTail(0x1);
211 UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
212 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
213
214 InventoryItemBase att1Item
215 = UserInventoryHelpers.CreateInventoryItem(
216 m_scene, "att1", TestHelpers.ParseTail(0x2), TestHelpers.ParseTail(0x3), sp.UUID, InventoryType.Object);
217 InventoryItemBase att2Item
218 = UserInventoryHelpers.CreateInventoryItem(
219 m_scene, "att2", TestHelpers.ParseTail(0x12), TestHelpers.ParseTail(0x13), sp.UUID, InventoryType.Object);
220
221 m_attMod.RezSingleAttachmentFromInventory(sp, att1Item.ID, (uint)AttachmentPoint.Chest);
222 m_attMod.RezSingleAttachmentFromInventory(sp, att2Item.ID, (uint)AttachmentPoint.Chest | 0x80);
223
224 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
225
226 ScenePresence npc = m_scene.GetScenePresence(npcId);
227
228 // Check scene presence status
229 Assert.That(npc.HasAttachments(), Is.True);
230 List<SceneObjectGroup> attachments = npc.GetAttachments();
231 Assert.That(attachments.Count, Is.EqualTo(2));
232
233 // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item
234 // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC.
235// Assert.That(attSo.Name, Is.EqualTo(attName));
236
237 TestAttachedObject(attachments[0], AttachmentPoint.Chest, npc.UUID);
238 TestAttachedObject(attachments[1], AttachmentPoint.Chest, npc.UUID);
239
240 // Attached objects on the same point must have different FromItemIDs to be shown to other avatars, at least
241 // on Singularity 1.8.5. Otherwise, only one (the first ObjectUpdate sent) appears.
242 Assert.AreNotEqual(attachments[0].FromItemID, attachments[1].FromItemID);
243 }
244
245 private void TestAttachedObject(SceneObjectGroup attSo, AttachmentPoint attPoint, UUID ownerId)
246 {
247 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)attPoint));
248 Assert.That(attSo.IsAttachment);
249 Assert.That(attSo.UsesPhysics, Is.False);
250 Assert.That(attSo.IsTemporary, Is.False);
251 Assert.That(attSo.OwnerID, Is.EqualTo(ownerId));
252 }
253
254 [Test]
202 public void TestLoadAppearance() 255 public void TestLoadAppearance()
203 { 256 {
204 TestHelpers.InMethod(); 257 TestHelpers.InMethod();