diff options
author | UbitUmarov | 2012-03-09 03:00:31 +0000 |
---|---|---|
committer | UbitUmarov | 2012-03-09 03:00:31 +0000 |
commit | fc4dc7708dc07dc41791de64d7a6b2586d3170b5 (patch) | |
tree | 2b807fd97cdef06e671b52f3e735b849b05f9cfc /OpenSim/Region/OptionalModules | |
parent | more changes on undo/redo group scaling seems to work better (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-fc4dc7708dc07dc41791de64d7a6b2586d3170b5.zip opensim-SC_OLD-fc4dc7708dc07dc41791de64d7a6b2586d3170b5.tar.gz opensim-SC_OLD-fc4dc7708dc07dc41791de64d7a6b2586d3170b5.tar.bz2 opensim-SC_OLD-fc4dc7708dc07dc41791de64d7a6b2586d3170b5.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/OptionalModules')
9 files changed, 134 insertions, 94 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 7d7c5c5..0f62b2a 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
70 | m_client = client; | 70 | m_client = client; |
71 | m_scene = scene; | 71 | m_scene = scene; |
72 | 72 | ||
73 | Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false); | 73 | Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true); |
74 | } | 74 | } |
75 | 75 | ||
76 | private void SendServerCommand(string command) | 76 | private void SendServerCommand(string command) |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index eb39026..a7c5020 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
57 | 57 | ||
58 | m_listener.Start(50); | 58 | m_listener.Start(50); |
59 | 59 | ||
60 | Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); | 60 | Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); |
61 | m_baseScene = baseScene; | 61 | m_baseScene = baseScene; |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs index 439096a..c897aa5 100644 --- a/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs | |||
@@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Agent.TextureSender | |||
92 | m_scene = scene; | 92 | m_scene = scene; |
93 | 93 | ||
94 | MainConsole.Instance.Commands.AddCommand( | 94 | MainConsole.Instance.Commands.AddCommand( |
95 | "j2k", | 95 | "Assets", |
96 | false, | 96 | false, |
97 | "j2k decode", | 97 | "j2k decode", |
98 | "j2k decode <ID>", | 98 | "j2k decode <ID>", |
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 261029c..a7ebecc 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -82,19 +82,19 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
82 | m_scenes[scene.RegionInfo.RegionID] = scene; | 82 | m_scenes[scene.RegionInfo.RegionID] = scene; |
83 | 83 | ||
84 | scene.AddCommand( | 84 | scene.AddCommand( |
85 | this, "image queues clear", | 85 | "Comms", this, "image queues clear", |
86 | "image queues clear <first-name> <last-name>", | 86 | "image queues clear <first-name> <last-name>", |
87 | "Clear the image queues (textures downloaded via UDP) for a particular client.", | 87 | "Clear the image queues (textures downloaded via UDP) for a particular client.", |
88 | (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd))); | 88 | (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd))); |
89 | 89 | ||
90 | scene.AddCommand( | 90 | scene.AddCommand( |
91 | this, "image queues show", | 91 | "Comms", this, "image queues show", |
92 | "image queues show <first-name> <last-name>", | 92 | "image queues show <first-name> <last-name>", |
93 | "Show the image queues (textures downloaded via UDP) for a particular client.", | 93 | "Show the image queues (textures downloaded via UDP) for a particular client.", |
94 | (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); | 94 | (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); |
95 | 95 | ||
96 | scene.AddCommand( | 96 | scene.AddCommand( |
97 | this, "show pqueues", | 97 | "Comms", this, "show pqueues", |
98 | "show pqueues [full]", | 98 | "show pqueues [full]", |
99 | "Show priority queue data for each client", | 99 | "Show priority queue data for each client", |
100 | "Without the 'full' option, only root agents are shown." | 100 | "Without the 'full' option, only root agents are shown." |
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
102 | (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd))); | 102 | (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd))); |
103 | 103 | ||
104 | scene.AddCommand( | 104 | scene.AddCommand( |
105 | this, "show queues", | 105 | "Comms", this, "show queues", |
106 | "show queues [full]", | 106 | "show queues [full]", |
107 | "Show queue data for each client", | 107 | "Show queue data for each client", |
108 | "Without the 'full' option, only root agents are shown." | 108 | "Without the 'full' option, only root agents are shown." |
@@ -110,13 +110,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
110 | (mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd))); | 110 | (mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd))); |
111 | 111 | ||
112 | scene.AddCommand( | 112 | scene.AddCommand( |
113 | this, "show image queues", | 113 | "Comms", this, "show image queues", |
114 | "show image queues <first-name> <last-name>", | 114 | "show image queues <first-name> <last-name>", |
115 | "Show the image queues (textures downloaded via UDP) for a particular client.", | 115 | "Show the image queues (textures downloaded via UDP) for a particular client.", |
116 | (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); | 116 | (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); |
117 | 117 | ||
118 | scene.AddCommand( | 118 | scene.AddCommand( |
119 | this, "show throttles", | 119 | "Comms", this, "show throttles", |
120 | "show throttles [full]", | 120 | "show throttles [full]", |
121 | "Show throttle settings for each client and for the server overall", | 121 | "Show throttle settings for each client and for the server overall", |
122 | "Without the 'full' option, only root agents are shown." | 122 | "Without the 'full' option, only root agents are shown." |
@@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
124 | (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); | 124 | (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); |
125 | 125 | ||
126 | scene.AddCommand( | 126 | scene.AddCommand( |
127 | this, "emergency-monitoring", | 127 | "Comms", this, "emergency-monitoring", |
128 | "emergency-monitoring", | 128 | "emergency-monitoring", |
129 | "Go on/off emergency monitoring mode", | 129 | "Go on/off emergency monitoring mode", |
130 | "Go on/off emergency monitoring mode", | 130 | "Go on/off emergency monitoring mode", |
diff --git a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs index a5207eb..41ec14f 100644 --- a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs | |||
@@ -88,7 +88,7 @@ namespace OpenSim.Region.OptionalModules.Asset | |||
88 | m_scene = scene; | 88 | m_scene = scene; |
89 | 89 | ||
90 | MainConsole.Instance.Commands.AddCommand( | 90 | MainConsole.Instance.Commands.AddCommand( |
91 | "asset", | 91 | "Assets", |
92 | false, | 92 | false, |
93 | "show asset", | 93 | "show asset", |
94 | "show asset <ID>", | 94 | "show asset <ID>", |
@@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.Asset | |||
96 | HandleShowAsset); | 96 | HandleShowAsset); |
97 | 97 | ||
98 | MainConsole.Instance.Commands.AddCommand( | 98 | MainConsole.Instance.Commands.AddCommand( |
99 | "asset", false, "dump asset", | 99 | "Assets", false, "dump asset", |
100 | "dump asset <id>", | 100 | "dump asset <id>", |
101 | "Dump an asset", | 101 | "Dump an asset", |
102 | HandleDumpAsset); | 102 | HandleDumpAsset); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 2369d94..6bb6729 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | |||
@@ -94,13 +94,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
94 | m_scenes[scene.RegionInfo.RegionID] = scene; | 94 | m_scenes[scene.RegionInfo.RegionID] = scene; |
95 | 95 | ||
96 | scene.AddCommand( | 96 | scene.AddCommand( |
97 | this, "show appearance", | 97 | "Users", this, "show appearance", |
98 | "show appearance [<first-name> <last-name>]", | 98 | "show appearance [<first-name> <last-name>]", |
99 | "Synonym for 'appearance show'", | 99 | "Synonym for 'appearance show'", |
100 | HandleShowAppearanceCommand); | 100 | HandleShowAppearanceCommand); |
101 | 101 | ||
102 | scene.AddCommand( | 102 | scene.AddCommand( |
103 | this, "appearance show", | 103 | "Users", this, "appearance show", |
104 | "appearance show [<first-name> <last-name>]", | 104 | "appearance show [<first-name> <last-name>]", |
105 | "Show appearance information for each avatar in the simulator.", | 105 | "Show appearance information for each avatar in the simulator.", |
106 | "This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. " | 106 | "This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. " |
@@ -110,14 +110,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
110 | HandleShowAppearanceCommand); | 110 | HandleShowAppearanceCommand); |
111 | 111 | ||
112 | scene.AddCommand( | 112 | scene.AddCommand( |
113 | this, "appearance send", | 113 | "Users", this, "appearance send", |
114 | "appearance send [<first-name> <last-name>]", | 114 | "appearance send [<first-name> <last-name>]", |
115 | "Send appearance data for each avatar in the simulator to other viewers.", | 115 | "Send appearance data for each avatar in the simulator to other viewers.", |
116 | "Optionally, you can specify that only a particular avatar's appearance data is sent.", | 116 | "Optionally, you can specify that only a particular avatar's appearance data is sent.", |
117 | HandleSendAppearanceCommand); | 117 | HandleSendAppearanceCommand); |
118 | 118 | ||
119 | scene.AddCommand( | 119 | scene.AddCommand( |
120 | this, "appearance rebake", | 120 | "Users", this, "appearance rebake", |
121 | "appearance rebake <first-name> <last-name>", | 121 | "appearance rebake <first-name> <last-name>", |
122 | "Send a request to the user's viewer for it to rebake and reupload its appearance textures.", | 122 | "Send a request to the user's viewer for it to rebake and reupload its appearance textures.", |
123 | "This is currently done for all baked texture references previously received, whether the simulator can find the asset or not." | 123 | "This is currently done for all baked texture references previously received, whether the simulator can find the asset or not." |
@@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance | |||
127 | HandleRebakeAppearanceCommand); | 127 | HandleRebakeAppearanceCommand); |
128 | 128 | ||
129 | scene.AddCommand( | 129 | scene.AddCommand( |
130 | this, "appearance find", | 130 | "Users", this, "appearance find", |
131 | "appearance find <uuid-or-start-of-uuid>", | 131 | "appearance find <uuid-or-start-of-uuid>", |
132 | "Find out which avatar uses the given asset as a baked texture, if any.", | 132 | "Find out which avatar uses the given asset as a baked texture, if any.", |
133 | "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.", | 133 | "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.", |
diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs index 23ef757..a3f68e5 100755 --- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs +++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs | |||
@@ -100,22 +100,22 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters | |||
100 | { | 100 | { |
101 | if (!m_commandsLoaded) | 101 | if (!m_commandsLoaded) |
102 | { | 102 | { |
103 | MainConsole.Instance.Commands.AddCommand("Physics", false, "physics set", | 103 | MainConsole.Instance.Commands.AddCommand( |
104 | "physics set", | 104 | "Regions", false, "physics set", |
105 | "Set physics parameter from currently selected region" + Environment.NewLine | 105 | setInvocation, |
106 | + "Invocation: " + setInvocation, | 106 | "Set physics parameter from currently selected region", |
107 | ProcessPhysicsSet); | 107 | ProcessPhysicsSet); |
108 | 108 | ||
109 | MainConsole.Instance.Commands.AddCommand("Physics", false, "physics get", | 109 | MainConsole.Instance.Commands.AddCommand( |
110 | "physics get", | 110 | "Regions", false, "physics get", |
111 | "Get physics parameter from currently selected region" + Environment.NewLine | 111 | getInvocation, |
112 | + "Invocation: " + getInvocation, | 112 | "Get physics parameter from currently selected region", |
113 | ProcessPhysicsGet); | 113 | ProcessPhysicsGet); |
114 | 114 | ||
115 | MainConsole.Instance.Commands.AddCommand("Physics", false, "physics list", | 115 | MainConsole.Instance.Commands.AddCommand( |
116 | "physics list", | 116 | "Regions", false, "physics list", |
117 | "List settable physics parameters" + Environment.NewLine | 117 | listInvocation, |
118 | + "Invocation: " + listInvocation, | 118 | "List settable physics parameters", |
119 | ProcessPhysicsList); | 119 | ProcessPhysicsList); |
120 | 120 | ||
121 | m_commandsLoaded = true; | 121 | m_commandsLoaded = true; |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 78e9b29..68f21c8 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -88,25 +88,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
88 | 88 | ||
89 | public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) | 89 | public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) |
90 | { | 90 | { |
91 | ScenePresence sp = scene.GetScenePresence(agentId); | 91 | ScenePresence npc = scene.GetScenePresence(agentId); |
92 | if (sp == null || sp.IsChildAgent) | 92 | if (npc == null || npc.IsChildAgent) |
93 | return false; | 93 | return false; |
94 | 94 | ||
95 | lock (m_avatars) | 95 | lock (m_avatars) |
96 | if (!m_avatars.ContainsKey(agentId)) | 96 | if (!m_avatars.ContainsKey(agentId)) |
97 | return false; | 97 | return false; |
98 | 98 | ||
99 | // Delete existing sp attachments | 99 | // Delete existing npc attachments |
100 | scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); | 100 | scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); |
101 | |||
102 | AvatarAppearance app = new AvatarAppearance(appearance, true); | ||
103 | sp.Appearance = app; | ||
104 | 101 | ||
105 | // Set new sp appearance. Also sends to clients. | 102 | // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments |
106 | scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, app); | 103 | AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); |
104 | npc.Appearance = npcAppearance; | ||
107 | 105 | ||
108 | // Rez needed sp attachments | 106 | // Rez needed npc attachments |
109 | scene.AttachmentsModule.RezAttachments(sp); | 107 | scene.AttachmentsModule.RezAttachments(npc); |
108 | |||
109 | IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>(); | ||
110 | module.SendAppearance(npc.UUID); | ||
110 | 111 | ||
111 | return true; | 112 | return true; |
112 | } | 113 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index d507822..9a7e9e8 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -50,10 +50,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
50 | [TestFixture] | 50 | [TestFixture] |
51 | public class NPCModuleTests | 51 | public class NPCModuleTests |
52 | { | 52 | { |
53 | private TestScene scene; | 53 | private TestScene m_scene; |
54 | private AvatarFactoryModule afm; | 54 | private AvatarFactoryModule m_afMod; |
55 | private UserManagementModule umm; | 55 | private UserManagementModule m_umMod; |
56 | private AttachmentsModule am; | 56 | private AttachmentsModule m_attMod; |
57 | private NPCModule m_npcMod; | ||
57 | 58 | ||
58 | [TestFixtureSetUp] | 59 | [TestFixtureSetUp] |
59 | public void FixtureInit() | 60 | public void FixtureInit() |
@@ -79,12 +80,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
79 | config.AddConfig("Modules"); | 80 | config.AddConfig("Modules"); |
80 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | 81 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); |
81 | 82 | ||
82 | afm = new AvatarFactoryModule(); | 83 | m_afMod = new AvatarFactoryModule(); |
83 | umm = new UserManagementModule(); | 84 | m_umMod = new UserManagementModule(); |
84 | am = new AttachmentsModule(); | 85 | m_attMod = new AttachmentsModule(); |
86 | m_npcMod = new NPCModule(); | ||
85 | 87 | ||
86 | scene = SceneHelpers.SetupScene(); | 88 | m_scene = SceneHelpers.SetupScene(); |
87 | SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); | 89 | SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); |
88 | } | 90 | } |
89 | 91 | ||
90 | [Test] | 92 | [Test] |
@@ -93,7 +95,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
93 | TestHelpers.InMethod(); | 95 | TestHelpers.InMethod(); |
94 | // log4net.Config.XmlConfigurator.Configure(); | 96 | // log4net.Config.XmlConfigurator.Configure(); |
95 | 97 | ||
96 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 98 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
97 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); | 99 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); |
98 | 100 | ||
99 | // 8 is the index of the first baked texture in AvatarAppearance | 101 | // 8 is the index of the first baked texture in AvatarAppearance |
@@ -104,18 +106,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
104 | 106 | ||
105 | // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell | 107 | // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell |
106 | // ScenePresence.SendInitialData() to reset our entire appearance. | 108 | // ScenePresence.SendInitialData() to reset our entire appearance. |
107 | scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); | 109 | m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); |
108 | 110 | ||
109 | afm.SetAppearance(sp, originalTe, null); | 111 | m_afMod.SetAppearance(sp, originalTe, null); |
110 | 112 | ||
111 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 113 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); |
112 | UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); | ||
113 | 114 | ||
114 | ScenePresence npc = scene.GetScenePresence(npcId); | 115 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
115 | 116 | ||
116 | Assert.That(npc, Is.Not.Null); | 117 | Assert.That(npc, Is.Not.Null); |
117 | Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); | 118 | Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); |
118 | Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); | 119 | Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); |
119 | } | 120 | } |
120 | 121 | ||
121 | [Test] | 122 | [Test] |
@@ -124,42 +125,83 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
124 | TestHelpers.InMethod(); | 125 | TestHelpers.InMethod(); |
125 | // log4net.Config.XmlConfigurator.Configure(); | 126 | // log4net.Config.XmlConfigurator.Configure(); |
126 | 127 | ||
127 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 128 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
128 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); | 129 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); |
129 | 130 | ||
130 | Vector3 startPos = new Vector3(128, 128, 30); | 131 | Vector3 startPos = new Vector3(128, 128, 30); |
131 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 132 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); |
132 | UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); | ||
133 | 133 | ||
134 | npcModule.DeleteNPC(npcId, scene); | 134 | m_npcMod.DeleteNPC(npcId, m_scene); |
135 | 135 | ||
136 | ScenePresence deletedNpc = scene.GetScenePresence(npcId); | 136 | ScenePresence deletedNpc = m_scene.GetScenePresence(npcId); |
137 | 137 | ||
138 | Assert.That(deletedNpc, Is.Null); | 138 | Assert.That(deletedNpc, Is.Null); |
139 | } | 139 | } |
140 | 140 | ||
141 | [Test] | 141 | [Test] |
142 | public void TestAttachments() | 142 | public void TestCreateWithAttachments() |
143 | { | 143 | { |
144 | TestHelpers.InMethod(); | 144 | TestHelpers.InMethod(); |
145 | // log4net.Config.XmlConfigurator.Configure(); | 145 | // log4net.Config.XmlConfigurator.Configure(); |
146 | 146 | ||
147 | UUID userId = TestHelpers.ParseTail(0x1); | 147 | UUID userId = TestHelpers.ParseTail(0x1); |
148 | UserAccountHelpers.CreateUserWithInventory(scene, userId); | 148 | UserAccountHelpers.CreateUserWithInventory(m_scene, userId); |
149 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); | 149 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); |
150 | 150 | ||
151 | UUID attItemId = TestHelpers.ParseTail(0x2); | 151 | UUID attItemId = TestHelpers.ParseTail(0x2); |
152 | UUID attAssetId = TestHelpers.ParseTail(0x3); | 152 | UUID attAssetId = TestHelpers.ParseTail(0x3); |
153 | string attName = "att"; | 153 | string attName = "att"; |
154 | 154 | ||
155 | UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); | 155 | UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); |
156 | 156 | ||
157 | am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); | 157 | m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); |
158 | 158 | ||
159 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 159 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); |
160 | UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); | ||
161 | 160 | ||
162 | ScenePresence npc = scene.GetScenePresence(npcId); | 161 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
162 | |||
163 | // Check scene presence status | ||
164 | Assert.That(npc.HasAttachments(), Is.True); | ||
165 | List<SceneObjectGroup> attachments = npc.GetAttachments(); | ||
166 | Assert.That(attachments.Count, Is.EqualTo(1)); | ||
167 | SceneObjectGroup attSo = attachments[0]; | ||
168 | |||
169 | // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item | ||
170 | // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC. | ||
171 | // Assert.That(attSo.Name, Is.EqualTo(attName)); | ||
172 | |||
173 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); | ||
174 | Assert.That(attSo.IsAttachment); | ||
175 | Assert.That(attSo.UsesPhysics, Is.False); | ||
176 | Assert.That(attSo.IsTemporary, Is.False); | ||
177 | Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID)); | ||
178 | } | ||
179 | |||
180 | [Test] | ||
181 | public void TestLoadAppearance() | ||
182 | { | ||
183 | TestHelpers.InMethod(); | ||
184 | // log4net.Config.XmlConfigurator.Configure(); | ||
185 | |||
186 | UUID userId = TestHelpers.ParseTail(0x1); | ||
187 | UserAccountHelpers.CreateUserWithInventory(m_scene, userId); | ||
188 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); | ||
189 | |||
190 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); | ||
191 | |||
192 | // Now add the attachment to the original avatar and use that to load a new appearance | ||
193 | // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here | ||
194 | UUID attItemId = TestHelpers.ParseTail(0x2); | ||
195 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
196 | string attName = "att"; | ||
197 | |||
198 | UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); | ||
199 | |||
200 | m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); | ||
201 | |||
202 | m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene); | ||
203 | |||
204 | ScenePresence npc = m_scene.GetScenePresence(npcId); | ||
163 | 205 | ||
164 | // Check scene presence status | 206 | // Check scene presence status |
165 | Assert.That(npc.HasAttachments(), Is.True); | 207 | Assert.That(npc.HasAttachments(), Is.True); |
@@ -184,31 +226,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
184 | TestHelpers.InMethod(); | 226 | TestHelpers.InMethod(); |
185 | // log4net.Config.XmlConfigurator.Configure(); | 227 | // log4net.Config.XmlConfigurator.Configure(); |
186 | 228 | ||
187 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 229 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
188 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); | 230 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); |
189 | 231 | ||
190 | Vector3 startPos = new Vector3(128, 128, 30); | 232 | Vector3 startPos = new Vector3(128, 128, 30); |
191 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 233 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); |
192 | UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); | ||
193 | 234 | ||
194 | ScenePresence npc = scene.GetScenePresence(npcId); | 235 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
195 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 236 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
196 | 237 | ||
197 | // For now, we'll make the scene presence fly to simplify this test, but this needs to change. | 238 | // For now, we'll make the scene presence fly to simplify this test, but this needs to change. |
198 | npc.Flying = true; | 239 | npc.Flying = true; |
199 | 240 | ||
200 | scene.Update(); | 241 | m_scene.Update(); |
201 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 242 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
202 | 243 | ||
203 | Vector3 targetPos = startPos + new Vector3(0, 10, 0); | 244 | Vector3 targetPos = startPos + new Vector3(0, 10, 0); |
204 | npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); | 245 | m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); |
205 | 246 | ||
206 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 247 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
207 | //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); | 248 | //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); |
208 | Assert.That( | 249 | Assert.That( |
209 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); | 250 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); |
210 | 251 | ||
211 | scene.Update(); | 252 | m_scene.Update(); |
212 | 253 | ||
213 | // We should really check the exact figure. | 254 | // We should really check the exact figure. |
214 | Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); | 255 | Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); |
@@ -217,7 +258,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
217 | Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); | 258 | Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); |
218 | 259 | ||
219 | for (int i = 0; i < 10; i++) | 260 | for (int i = 0; i < 10; i++) |
220 | scene.Update(); | 261 | m_scene.Update(); |
221 | 262 | ||
222 | double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); | 263 | double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); |
223 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); | 264 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); |
@@ -227,14 +268,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
227 | // Try a second movement | 268 | // Try a second movement |
228 | startPos = npc.AbsolutePosition; | 269 | startPos = npc.AbsolutePosition; |
229 | targetPos = startPos + new Vector3(10, 0, 0); | 270 | targetPos = startPos + new Vector3(10, 0, 0); |
230 | npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); | 271 | m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); |
231 | 272 | ||
232 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 273 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
233 | // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); | 274 | // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); |
234 | Assert.That( | 275 | Assert.That( |
235 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); | 276 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); |
236 | 277 | ||
237 | scene.Update(); | 278 | m_scene.Update(); |
238 | 279 | ||
239 | // We should really check the exact figure. | 280 | // We should really check the exact figure. |
240 | Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X)); | 281 | Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X)); |
@@ -243,7 +284,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
243 | Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); | 284 | Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); |
244 | 285 | ||
245 | for (int i = 0; i < 10; i++) | 286 | for (int i = 0; i < 10; i++) |
246 | scene.Update(); | 287 | m_scene.Update(); |
247 | 288 | ||
248 | distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); | 289 | distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); |
249 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); | 290 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); |
@@ -256,17 +297,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
256 | TestHelpers.InMethod(); | 297 | TestHelpers.InMethod(); |
257 | // log4net.Config.XmlConfigurator.Configure(); | 298 | // log4net.Config.XmlConfigurator.Configure(); |
258 | 299 | ||
259 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 300 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
260 | 301 | ||
261 | Vector3 startPos = new Vector3(128, 128, 30); | 302 | Vector3 startPos = new Vector3(128, 128, 30); |
262 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 303 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); |
263 | UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); | ||
264 | 304 | ||
265 | ScenePresence npc = scene.GetScenePresence(npcId); | 305 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
266 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 306 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); |
267 | 307 | ||
268 | part.SitTargetPosition = new Vector3(0, 0, 1); | 308 | part.SitTargetPosition = new Vector3(0, 0, 1); |
269 | npcModule.Sit(npc.UUID, part.UUID, scene); | 309 | m_npcMod.Sit(npc.UUID, part.UUID, m_scene); |
270 | 310 | ||
271 | Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); | 311 | Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); |
272 | Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); | 312 | Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); |
@@ -274,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
274 | npc.AbsolutePosition, | 314 | npc.AbsolutePosition, |
275 | Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); | 315 | Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); |
276 | 316 | ||
277 | npcModule.Stand(npc.UUID, scene); | 317 | m_npcMod.Stand(npc.UUID, m_scene); |
278 | 318 | ||
279 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 319 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
280 | Assert.That(npc.ParentID, Is.EqualTo(0)); | 320 | Assert.That(npc.ParentID, Is.EqualTo(0)); |
@@ -286,19 +326,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
286 | TestHelpers.InMethod(); | 326 | TestHelpers.InMethod(); |
287 | // log4net.Config.XmlConfigurator.Configure(); | 327 | // log4net.Config.XmlConfigurator.Configure(); |
288 | 328 | ||
289 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 329 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
290 | 330 | ||
291 | // FIXME: To get this to work for now, we are going to place the npc right next to the target so that | 331 | // FIXME: To get this to work for now, we are going to place the npc right next to the target so that |
292 | // the autopilot doesn't trigger | 332 | // the autopilot doesn't trigger |
293 | Vector3 startPos = new Vector3(1, 1, 1); | 333 | Vector3 startPos = new Vector3(1, 1, 1); |
294 | 334 | ||
295 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 335 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); |
296 | UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); | ||
297 | 336 | ||
298 | ScenePresence npc = scene.GetScenePresence(npcId); | 337 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
299 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 338 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); |
300 | 339 | ||
301 | npcModule.Sit(npc.UUID, part.UUID, scene); | 340 | m_npcMod.Sit(npc.UUID, part.UUID, m_scene); |
302 | 341 | ||
303 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 342 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
304 | Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); | 343 | Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); |
@@ -311,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
311 | npc.AbsolutePosition, | 350 | npc.AbsolutePosition, |
312 | Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); | 351 | Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); |
313 | 352 | ||
314 | npcModule.Stand(npc.UUID, scene); | 353 | m_npcMod.Stand(npc.UUID, m_scene); |
315 | 354 | ||
316 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 355 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
317 | Assert.That(npc.ParentID, Is.EqualTo(0)); | 356 | Assert.That(npc.ParentID, Is.EqualTo(0)); |