diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index e92f072183..d02a3055b8 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
// one and we're done otherwise, ask for a rebake
if (checkonly) return false;
- m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake",face.TextureID);
+ m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake", face.TextureID);
client.SendRebakeAvatarTextures(face.TextureID);
}
}
- m_log.DebugFormat("[AVFACTORY]: completed texture check for {0}", client.AgentId);
+ m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", client.AgentId);
// If we only found default textures, then the appearance is not cached
return (defonly ? false : true);
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index accd09443c..a4861ec0d5 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
if (m_UserCache.ContainsKey(id))
return;
+// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
+
UserData user = new UserData();
user.Id = id;
-
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
if (account != null)
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
index 22795fc97d..d0e56098c7 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
@@ -36,4 +36,4 @@ namespace OpenSim.Region.Framework.Interfaces
void QueueAppearanceSend(UUID agentid);
void QueueAppearanceSave(UUID agentid);
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index bdf3d1dcd8..ad41e88db5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2593,8 +2593,10 @@ namespace OpenSim.Region.Framework.Scenes
{
string homeURL = string.Empty;
string first = aCircuit.firstname, last = aCircuit.lastname;
+
if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
+
if (aCircuit.lastname.StartsWith("@"))
{
string[] parts = aCircuit.firstname.Split('.');
@@ -2604,6 +2606,7 @@ namespace OpenSim.Region.Framework.Scenes
last = parts[1];
}
}
+
uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
}
}
@@ -3389,7 +3392,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
-
// In all cases, add or update the circuit data with the new agent circuit data and teleport flags
agent.teleportFlags = teleportFlags;
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 80aafd0733..83b761c7a2 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1944,10 +1944,9 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
}
-
-
SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
}
+
/*
public void SitRayCastAvatarPosition(SceneObjectPart part)
{
@@ -2380,7 +2379,6 @@ namespace OpenSim.Region.Framework.Scenes
///
public void SendTerseUpdateToClient(IClientAPI remoteClient)
{
-
// If the client is inactive, it's getting its updates from another
// server.
if (remoteClient.IsActive)
@@ -2495,7 +2493,7 @@ namespace OpenSim.Region.Framework.Scenes
}
// If we aren't using a cached appearance, then clear out the baked textures
- if (! cachedappearance)
+ if (!cachedappearance)
{
m_appearance.ResetAppearance();
if (m_scene.AvatarFactory != null)
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
index 7304145c1b..77e7acf15e 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
{
bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(client);
MainConsole.Instance.OutputFormat(
- "{0} baked apperance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt");
+ "{0} baked appearance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt");
}
});
}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index c471636743..48d236fc58 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -25,10 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+using System;
using System.Collections.Generic;
+using System.Reflection;
using System.Threading;
-using OpenMetaverse;
+using log4net;
using Nini.Config;
+using OpenMetaverse;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.CoreModules.Avatar.NPC;
@@ -40,6 +43,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{
public class NPCModule : IRegionModule, INPCModule
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
// private const bool m_enabled = false;
private Mutex m_createMutex;
@@ -59,6 +64,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
private UUID p_cloneAppearanceFrom;
private UUID p_returnUuid;
+ public void Initialise(Scene scene, IConfigSource source)
+ {
+ m_createMutex = new Mutex(false);
+
+ m_timer = new Timer(500);
+ m_timer.Elapsed += m_timer_Elapsed;
+ m_timer.Start();
+
+ scene.RegisterModuleInterface(this);
+ }
+
private AvatarAppearance GetAppearance(UUID target, Scene scene)
{
if (m_appearanceCache.ContainsKey(target))
@@ -76,6 +92,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
{
+ m_log.DebugFormat(
+ "[NPC MODULE]: Queueing request to create NPC {0} {1} at {2} in {3} cloning appearance of {4}",
+ firstname, lastname, position, scene.RegionInfo.RegionName, cloneAppearanceFrom);
+
// Block.
m_createMutex.WaitOne();
@@ -137,46 +157,67 @@ namespace OpenSim.Region.OptionalModules.World.NPC
}
}
-
- public void Initialise(Scene scene, IConfigSource source)
- {
- m_createMutex = new Mutex(false);
-
- m_timer = new Timer(500);
- m_timer.Elapsed += m_timer_Elapsed;
- m_timer.Start();
-
- scene.RegisterModuleInterface(this);
- }
-
void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
- lock (p_lock)
+ try
{
- if (p_inUse)
+ lock (p_lock)
{
- p_inUse = false;
-
- NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
- npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
-
- p_scene.AddNewClient(npcAvatar);
-
- ScenePresence sp;
- if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
+ if (p_inUse)
{
- AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene);
+ p_inUse = false;
+
+ NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
+ npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
+
+ m_log.DebugFormat(
+ "[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}",
+ p_firstname, p_lastname, npcAvatar.AgentId, p_position, p_scene.RegionInfo.RegionName);
+
+ AgentCircuitData acd = new AgentCircuitData();
+ acd.AgentID = npcAvatar.AgentId;
+ acd.firstname = p_firstname;
+ acd.lastname = p_lastname;
+ acd.ServiceURLs = new Dictionary();
+
+ AvatarAppearance originalAppearance = GetAppearance(p_cloneAppearanceFrom, p_scene);
+ AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true);
+ acd.Appearance = npcAppearance;
+
+ p_scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
+ p_scene.AddNewClient(npcAvatar);
+
+ ScenePresence sp;
+ if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
+ {
+ m_log.DebugFormat(
+ "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
+
+ // Shouldn't call this - temporary.
+ sp.CompleteMovement(npcAvatar);
+
+ // sp.SendAppearanceToAllOtherAgents();
+ //
+ // // Send animations back to the avatar as well
+ // sp.Animator.SendAnimPack();
+ }
+ else
+ {
+ m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
+ }
+
+ m_avatars.Add(npcAvatar.AgentId, npcAvatar);
+
+ p_returnUuid = npcAvatar.AgentId;
- sp.Appearance.SetTextureEntries(x.Texture);
- sp.Appearance.SetVisualParams((byte[])x.VisualParams.Clone());
- sp.SendAppearanceToAllOtherAgents();
+ m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", p_returnUuid);
}
-
- m_avatars.Add(npcAvatar.AgentId, npcAvatar);
-
- p_returnUuid = npcAvatar.AgentId;
}
}
+ catch (Exception ex)
+ {
+ m_log.ErrorFormat("[NPC MODULE]: NPC creation failed with exception {0} {1}", ex.Message, ex.StackTrace);
+ }
}
public void PostInitialise()