* Tweak the caps manager so that the NPCAvatar works again.

trunk
Teravus Ovares 2009-08-01 14:26:00 +00:00
parent 4ce5c894cf
commit 4cbf0444df
5 changed files with 52 additions and 13 deletions

View File

@ -581,7 +581,10 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
lock (m_landIDList) lock (m_landIDList)
{ {
if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
return m_landList[m_landIDList[x / 4, y / 4]]; return m_landList[m_landIDList[x / 4, y / 4]];
else
return null;
} }
} }

View File

@ -360,15 +360,33 @@ namespace OpenSim.Region.Framework.Scenes
} }
// we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be // we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be
// So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/ // So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/
if (m_regionInfo != null)
{
neighbours = neighbours =
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
}
else
{
m_log.Debug("[ENABLENEIGHBOURCHILDAGENTS]: m_regionInfo was null in EnableNeighbourChildAgents, is this a NPC?");
}
/// We need to find the difference between the new regions where there are no child agents /// We need to find the difference between the new regions where there are no child agents
/// and the regions where there are already child agents. We only send notification to the former. /// and the regions where there are already child agents. We only send notification to the former.
List<ulong> neighbourHandles = NeighbourHandles(neighbours); // on this region List<ulong> neighbourHandles = NeighbourHandles(neighbours); // on this region
neighbourHandles.Add(avatar.Scene.RegionInfo.RegionHandle); // add this region too neighbourHandles.Add(avatar.Scene.RegionInfo.RegionHandle); // add this region too
List<ulong> previousRegionNeighbourHandles List<ulong> previousRegionNeighbourHandles ;
= new List<ulong>(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID).Keys);
if (avatar.Scene.CapsModule != null)
{
previousRegionNeighbourHandles =
new List<ulong>(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID).Keys);
}
else
{
previousRegionNeighbourHandles = new List<ulong>();
}
List<ulong> newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles); List<ulong> newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles);
List<ulong> oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles); List<ulong> oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles);
@ -381,8 +399,12 @@ namespace OpenSim.Region.Framework.Scenes
avatar.DropOldNeighbours(oldRegions); avatar.DropOldNeighbours(oldRegions);
/// Collect as many seeds as possible /// Collect as many seeds as possible
Dictionary<ulong, string> seeds Dictionary<ulong, string> seeds;
if (avatar.Scene.CapsModule != null)
seeds
= new Dictionary<ulong, string>(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID)); = new Dictionary<ulong, string>(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID));
else
seeds = new Dictionary<ulong, string>();
//m_log.Debug(" !!! No. of seeds: " + seeds.Count); //m_log.Debug(" !!! No. of seeds: " + seeds.Count);
if (!seeds.ContainsKey(avatar.Scene.RegionInfo.RegionHandle)) if (!seeds.ContainsKey(avatar.Scene.RegionInfo.RegionHandle))
@ -419,8 +441,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
} }
if (avatar.Scene.CapsModule != null)
{
// These two are the same thing! // These two are the same thing!
avatar.Scene.CapsModule.SetChildrenSeed(avatar.UUID, seeds); avatar.Scene.CapsModule.SetChildrenSeed(avatar.UUID, seeds);
}
avatar.KnownRegions = seeds; avatar.KnownRegions = seeds;
//avatar.Scene.DumpChildrenSeeds(avatar.UUID); //avatar.Scene.DumpChildrenSeeds(avatar.UUID);
//avatar.DumpKnownRegions(); //avatar.DumpKnownRegions();

View File

@ -538,7 +538,13 @@ namespace OpenSim.Region.Framework.Scenes
public void AdjustKnownSeeds() public void AdjustKnownSeeds()
{ {
Dictionary<ulong, string> seeds = Scene.CapsModule.GetChildrenSeeds(UUID); Dictionary<ulong, string> seeds;
if (Scene.CapsModule != null)
seeds = Scene.CapsModule.GetChildrenSeeds(UUID);
else
seeds = new Dictionary<ulong, string>();
List<ulong> old = new List<ulong>(); List<ulong> old = new List<ulong>();
foreach (ulong handle in seeds.Keys) foreach (ulong handle in seeds.Keys)
{ {
@ -552,7 +558,10 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
DropOldNeighbours(old); DropOldNeighbours(old);
if (Scene.CapsModule != null)
Scene.CapsModule.SetChildrenSeed(UUID, seeds); Scene.CapsModule.SetChildrenSeed(UUID, seeds);
KnownRegions = seeds; KnownRegions = seeds;
//m_log.Debug(" ++++++++++AFTER+++++++++++++ "); //m_log.Debug(" ++++++++++AFTER+++++++++++++ ");
//DumpKnownRegions(); //DumpKnownRegions();

View File

@ -1044,7 +1044,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public bool AddGenericPacketHandler(string MethodName, GenericMessage handler) public bool AddGenericPacketHandler(string MethodName, GenericMessage handler)
{ {
throw new NotImplementedException(); //throw new NotImplementedException();
return false;
} }
public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name) public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name)

View File

@ -42,8 +42,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
// { // {
// NPCAvatar testAvatar = new NPCAvatar("Jack", "NPC", new Vector3(128, 128, 40), scene); // NPCAvatar testAvatar = new NPCAvatar("Jack", "NPC", new Vector3(128, 128, 40), scene);
// NPCAvatar testAvatar2 = new NPCAvatar("Jill", "NPC", new Vector3(136, 128, 40), scene); // NPCAvatar testAvatar2 = new NPCAvatar("Jill", "NPC", new Vector3(136, 128, 40), scene);
// scene.AddNewClient(testAvatar, false); // scene.AddNewClient(testAvatar);
// scene.AddNewClient(testAvatar2, false); // scene.AddNewClient(testAvatar2);
// } // }
} }