aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-01 23:41:29 +0100
committerJustin Clark-Casey (justincc)2011-08-01 23:41:29 +0100
commit59f548cda82facef003fb7309180412254a234a1 (patch)
treeee736eca64d23b35dbd3aa0e18f1b2311804ff43 /OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
parentMove common gemo/agent map name code into CreateGeom() (diff)
downloadopensim-SC-59f548cda82facef003fb7309180412254a234a1.zip
opensim-SC-59f548cda82facef003fb7309180412254a234a1.tar.gz
opensim-SC-59f548cda82facef003fb7309180412254a234a1.tar.bz2
opensim-SC-59f548cda82facef003fb7309180412254a234a1.tar.xz
Get osNpcCreate appearance working with avatars that are currently in the scene.
Had to stop using AvatarService for now since it doesn't store baked texture IDs (which is why this was failing). Also failing because cloning appearance was also cloning the AvatarApperance.Owner field, which we weren't then changing. Extended TestCreate() to check this.
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs23
1 files changed, 21 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 899e721..bc151ed 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -27,11 +27,13 @@
27 27
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using log4net;
30using Nini.Config; 31using Nini.Config;
31using NUnit.Framework; 32using NUnit.Framework;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
35using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar; 37using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar;
36using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
@@ -58,14 +60,31 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
58 config.Configs["AvatarService"].Set("LocalServiceModule", "OpenSim.Services.AvatarService.dll:AvatarService"); 60 config.Configs["AvatarService"].Set("LocalServiceModule", "OpenSim.Services.AvatarService.dll:AvatarService");
59 config.Configs["AvatarService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 61 config.Configs["AvatarService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
60 62
63 AvatarFactoryModule afm = new AvatarFactoryModule();
61 TestScene scene = SceneSetupHelpers.SetupScene(); 64 TestScene scene = SceneSetupHelpers.SetupScene();
62 SceneSetupHelpers.SetupSceneModules(scene, config, new NPCModule(), new LocalAvatarServicesConnector()); 65 SceneSetupHelpers.SetupSceneModules(scene, config, afm, new NPCModule(), new LocalAvatarServicesConnector());
66 TestClient originalClient = SceneSetupHelpers.AddClient(scene, TestHelper.ParseTail(0x1));
67// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
68
69 // 8 is the index of the first baked texture in AvatarAppearance
70 UUID originalFace8TextureId = TestHelper.ParseTail(0x10);
71 Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero);
72 Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8);
73 originalTef.TextureID = originalFace8TextureId;
74
75 // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
76 // ScenePresence.SendInitialData() to reset our entire appearance.
77 scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId));
78
79 afm.SetAppearance(originalClient, originalTe, null);
63 80
64 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 81 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
65 UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, UUID.Zero); 82 UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, originalClient.AgentId);
66 83
67 ScenePresence npc = scene.GetScenePresence(npcId); 84 ScenePresence npc = scene.GetScenePresence(npcId);
85
68 Assert.That(npc, Is.Not.Null); 86 Assert.That(npc, Is.Not.Null);
87 Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
69 } 88 }
70 } 89 }
71} \ No newline at end of file 90} \ No newline at end of file