aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs107
7 files changed, 85 insertions, 43 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index e92f072..d02a305 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -162,12 +162,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
162 // one and we're done otherwise, ask for a rebake 162 // one and we're done otherwise, ask for a rebake
163 if (checkonly) return false; 163 if (checkonly) return false;
164 164
165 m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake",face.TextureID); 165 m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake", face.TextureID);
166 client.SendRebakeAvatarTextures(face.TextureID); 166 client.SendRebakeAvatarTextures(face.TextureID);
167 } 167 }
168 } 168 }
169 169
170 m_log.DebugFormat("[AVFACTORY]: completed texture check for {0}", client.AgentId); 170 m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", client.AgentId);
171 171
172 // If we only found default textures, then the appearance is not cached 172 // If we only found default textures, then the appearance is not cached
173 return (defonly ? false : true); 173 return (defonly ? false : true);
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index accd094..a4861ec 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -297,9 +297,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
297 if (m_UserCache.ContainsKey(id)) 297 if (m_UserCache.ContainsKey(id))
298 return; 298 return;
299 299
300// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
301
300 UserData user = new UserData(); 302 UserData user = new UserData();
301 user.Id = id; 303 user.Id = id;
302
303 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); 304 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
304 305
305 if (account != null) 306 if (account != null)
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
index 22795fc..d0e5609 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
@@ -36,4 +36,4 @@ namespace OpenSim.Region.Framework.Interfaces
36 void QueueAppearanceSend(UUID agentid); 36 void QueueAppearanceSend(UUID agentid);
37 void QueueAppearanceSave(UUID agentid); 37 void QueueAppearanceSave(UUID agentid);
38 } 38 }
39} 39} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index bdf3d1d..ad41e88 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2593,8 +2593,10 @@ namespace OpenSim.Region.Framework.Scenes
2593 { 2593 {
2594 string homeURL = string.Empty; 2594 string homeURL = string.Empty;
2595 string first = aCircuit.firstname, last = aCircuit.lastname; 2595 string first = aCircuit.firstname, last = aCircuit.lastname;
2596
2596 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 2597 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
2597 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 2598 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
2599
2598 if (aCircuit.lastname.StartsWith("@")) 2600 if (aCircuit.lastname.StartsWith("@"))
2599 { 2601 {
2600 string[] parts = aCircuit.firstname.Split('.'); 2602 string[] parts = aCircuit.firstname.Split('.');
@@ -2604,6 +2606,7 @@ namespace OpenSim.Region.Framework.Scenes
2604 last = parts[1]; 2606 last = parts[1];
2605 } 2607 }
2606 } 2608 }
2609
2607 uMan.AddUser(aCircuit.AgentID, first, last, homeURL); 2610 uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
2608 } 2611 }
2609 } 2612 }
@@ -3389,7 +3392,6 @@ namespace OpenSim.Region.Framework.Scenes
3389 } 3392 }
3390 } 3393 }
3391 3394
3392
3393 // In all cases, add or update the circuit data with the new agent circuit data and teleport flags 3395 // In all cases, add or update the circuit data with the new agent circuit data and teleport flags
3394 agent.teleportFlags = teleportFlags; 3396 agent.teleportFlags = teleportFlags;
3395 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3397 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 80aafd0..83b761c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1944,10 +1944,9 @@ namespace OpenSim.Region.Framework.Scenes
1944 m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); 1944 m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
1945 } 1945 }
1946 1946
1947
1948
1949 SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity); 1947 SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
1950 } 1948 }
1949
1951 /* 1950 /*
1952 public void SitRayCastAvatarPosition(SceneObjectPart part) 1951 public void SitRayCastAvatarPosition(SceneObjectPart part)
1953 { 1952 {
@@ -2380,7 +2379,6 @@ namespace OpenSim.Region.Framework.Scenes
2380 /// <param name="remoteClient"></param> 2379 /// <param name="remoteClient"></param>
2381 public void SendTerseUpdateToClient(IClientAPI remoteClient) 2380 public void SendTerseUpdateToClient(IClientAPI remoteClient)
2382 { 2381 {
2383
2384 // If the client is inactive, it's getting its updates from another 2382 // If the client is inactive, it's getting its updates from another
2385 // server. 2383 // server.
2386 if (remoteClient.IsActive) 2384 if (remoteClient.IsActive)
@@ -2495,7 +2493,7 @@ namespace OpenSim.Region.Framework.Scenes
2495 } 2493 }
2496 2494
2497 // If we aren't using a cached appearance, then clear out the baked textures 2495 // If we aren't using a cached appearance, then clear out the baked textures
2498 if (! cachedappearance) 2496 if (!cachedappearance)
2499 { 2497 {
2500 m_appearance.ResetAppearance(); 2498 m_appearance.ResetAppearance();
2501 if (m_scene.AvatarFactory != null) 2499 if (m_scene.AvatarFactory != null)
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/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()