aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorroot2011-06-30 00:26:03 +0100
committerroot2011-06-30 00:26:03 +0100
commit5f927dc104aac48707c0ea2ff77a3410c3857ecc (patch)
tree123324ae910db49349e7b07749f49cd172a3d037 /OpenSim/Region/OptionalModules
parentRemove friends debug spam (diff)
parentDon't follow inventory links of links. (diff)
downloadopensim-SC_OLD-5f927dc104aac48707c0ea2ff77a3410c3857ecc.zip
opensim-SC_OLD-5f927dc104aac48707c0ea2ff77a3410c3857ecc.tar.gz
opensim-SC_OLD-5f927dc104aac48707c0ea2ff77a3410c3857ecc.tar.bz2
opensim-SC_OLD-5f927dc104aac48707c0ea2ff77a3410c3857ecc.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs107
7 files changed, 83 insertions, 40 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
index 7304145..77e7acf 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
113 { 113 {
114 bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(client); 114 bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(client);
115 MainConsole.Instance.OutputFormat( 115 MainConsole.Instance.OutputFormat(
116 "{0} baked apperance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt"); 116 "{0} baked appearance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt");
117 } 117 }
118 }); 118 });
119 } 119 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 4f1097e..4f86e42 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -417,9 +417,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
417 public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param, 417 public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
418 UUID agentID, Caps caps) 418 UUID agentID, Caps caps)
419 { 419 {
420// m_log.DebugFormat( 420 m_log.DebugFormat(
421// "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}", 421 "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}",
422// scene.RegionInfo.RegionName, agentID); 422 scene.RegionInfo.RegionName, agentID);
423 423
424 ScenePresence avatar = scene.GetScenePresence(agentID); 424 ScenePresence avatar = scene.GetScenePresence(agentID);
425 string avatarName = avatar.Name; 425 string avatarName = avatar.Name;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 2bf8489..0800e98 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
70 // if groups aren't enabled, we're not needed. 70 // if groups aren't enabled, we're not needed.
71 // if we're not specified as the connector to use, then we're not wanted 71 // if we're not specified as the connector to use, then we're not wanted
72 if ((groupsConfig.GetBoolean("Enabled", false) == false) 72 if ((groupsConfig.GetBoolean("Enabled", false) == false)
73 || (groupsConfig.GetString("MessagingModule", "Default") != Name)) 73 || (groupsConfig.GetString("MessagingModule", "GroupsMessagingModule") != Name))
74 { 74 {
75 m_groupMessagingEnabled = false; 75 m_groupMessagingEnabled = false;
76 return; 76 return;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 02751ea..42008da 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -200,7 +200,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
200 // if groups aren't enabled, we're not needed. 200 // if groups aren't enabled, we're not needed.
201 // if we're not specified as the connector to use, then we're not wanted 201 // if we're not specified as the connector to use, then we're not wanted
202 if ((groupsConfig.GetBoolean("Enabled", false) == false) 202 if ((groupsConfig.GetBoolean("Enabled", false) == false)
203 || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name)) 203 || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name))
204 { 204 {
205 m_connectorEnabled = false; 205 m_connectorEnabled = false;
206 return; 206 return;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 2631ac1..a08bcd0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -109,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
109 // if groups aren't enabled, we're not needed. 109 // if groups aren't enabled, we're not needed.
110 // if we're not specified as the connector to use, then we're not wanted 110 // if we're not specified as the connector to use, then we're not wanted
111 if ((groupsConfig.GetBoolean("Enabled", false) == false) 111 if ((groupsConfig.GetBoolean("Enabled", false) == false)
112 || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name)) 112 || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name))
113 { 113 {
114 m_connectorEnabled = false; 114 m_connectorEnabled = false;
115 return; 115 return;
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index eed6450..05c729a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -36,6 +36,7 @@ using log4net;
36using Nini.Config; 36using Nini.Config;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
39using OpenSim.Services.Interfaces;
39 40
40using OpenSim.Framework; 41using OpenSim.Framework;
41using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
@@ -175,6 +176,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
175 176
176 m_scene.EventManager.TriggerOnChatBroadcast(this, c); 177 m_scene.EventManager.TriggerOnChatBroadcast(this, c);
177 m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName); 178 m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName);
179 m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo);
178 } 180 }
179 } 181 }
180 182
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index c471636..48d236f 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -25,10 +25,13 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
29using System.Threading; 31using System.Threading;
30using OpenMetaverse; 32using log4net;
31using Nini.Config; 33using Nini.Config;
34using OpenMetaverse;
32using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.CoreModules.Avatar.NPC; 37using OpenSim.Region.CoreModules.Avatar.NPC;
@@ -40,6 +43,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
40{ 43{
41 public class NPCModule : IRegionModule, INPCModule 44 public class NPCModule : IRegionModule, INPCModule
42 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
43 // private const bool m_enabled = false; 48 // private const bool m_enabled = false;
44 49
45 private Mutex m_createMutex; 50 private Mutex m_createMutex;
@@ -59,6 +64,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
59 private UUID p_cloneAppearanceFrom; 64 private UUID p_cloneAppearanceFrom;
60 private UUID p_returnUuid; 65 private UUID p_returnUuid;
61 66
67 public void Initialise(Scene scene, IConfigSource source)
68 {
69 m_createMutex = new Mutex(false);
70
71 m_timer = new Timer(500);
72 m_timer.Elapsed += m_timer_Elapsed;
73 m_timer.Start();
74
75 scene.RegisterModuleInterface<INPCModule>(this);
76 }
77
62 private AvatarAppearance GetAppearance(UUID target, Scene scene) 78 private AvatarAppearance GetAppearance(UUID target, Scene scene)
63 { 79 {
64 if (m_appearanceCache.ContainsKey(target)) 80 if (m_appearanceCache.ContainsKey(target))
@@ -76,6 +92,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
76 92
77 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) 93 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
78 { 94 {
95 m_log.DebugFormat(
96 "[NPC MODULE]: Queueing request to create NPC {0} {1} at {2} in {3} cloning appearance of {4}",
97 firstname, lastname, position, scene.RegionInfo.RegionName, cloneAppearanceFrom);
98
79 // Block. 99 // Block.
80 m_createMutex.WaitOne(); 100 m_createMutex.WaitOne();
81 101
@@ -137,46 +157,67 @@ namespace OpenSim.Region.OptionalModules.World.NPC
137 } 157 }
138 } 158 }
139 159
140
141 public void Initialise(Scene scene, IConfigSource source)
142 {
143 m_createMutex = new Mutex(false);
144
145 m_timer = new Timer(500);
146 m_timer.Elapsed += m_timer_Elapsed;
147 m_timer.Start();
148
149 scene.RegisterModuleInterface<INPCModule>(this);
150 }
151
152 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 160 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
153 { 161 {
154 lock (p_lock) 162 try
155 { 163 {
156 if (p_inUse) 164 lock (p_lock)
157 { 165 {
158 p_inUse = false; 166 if (p_inUse)
159
160 NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
161 npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
162
163 p_scene.AddNewClient(npcAvatar);
164
165 ScenePresence sp;
166 if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
167 { 167 {
168 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); 168 p_inUse = false;
169 169
170 sp.Appearance.SetTextureEntries(x.Texture); 170 NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
171 sp.Appearance.SetVisualParams((byte[])x.VisualParams.Clone()); 171 npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
172 sp.SendAppearanceToAllOtherAgents(); 172
173 m_log.DebugFormat(
174 "[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}",
175 p_firstname, p_lastname, npcAvatar.AgentId, p_position, p_scene.RegionInfo.RegionName);
176
177 AgentCircuitData acd = new AgentCircuitData();
178 acd.AgentID = npcAvatar.AgentId;
179 acd.firstname = p_firstname;
180 acd.lastname = p_lastname;
181 acd.ServiceURLs = new Dictionary<string, object>();
182
183 AvatarAppearance originalAppearance = GetAppearance(p_cloneAppearanceFrom, p_scene);
184 AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true);
185 acd.Appearance = npcAppearance;
186
187 p_scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
188 p_scene.AddNewClient(npcAvatar);
189
190 ScenePresence sp;
191 if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
192 {
193 m_log.DebugFormat(
194 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
195
196 // Shouldn't call this - temporary.
197 sp.CompleteMovement(npcAvatar);
198
199 // sp.SendAppearanceToAllOtherAgents();
200 //
201 // // Send animations back to the avatar as well
202 // sp.Animator.SendAnimPack();
203 }
204 else
205 {
206 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
207 }
208
209 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
210
211 p_returnUuid = npcAvatar.AgentId;
212
213 m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", p_returnUuid);
173 } 214 }
174
175 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
176
177 p_returnUuid = npcAvatar.AgentId;
178 } 215 }
179 } 216 }
217 catch (Exception ex)
218 {
219 m_log.ErrorFormat("[NPC MODULE]: NPC creation failed with exception {0} {1}", ex.Message, ex.StackTrace);
220 }
180 } 221 }
181 222
182 public void PostInitialise() 223 public void PostInitialise()