Fix llGetLinkKey and llGetNumberOfPrims to play nice with avatars in the linkset (emulated)

avinationmerge
meta7 2010-08-22 09:32:40 -07:00
parent 3ffdadef70
commit 46412f4931
1 changed files with 2 additions and 8 deletions

View File

@ -3988,7 +3988,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (linknum > m_host.ParentGroup.PrimCount || (linknum == 1 && m_host.ParentGroup.PrimCount == 1)) if (linknum > m_host.ParentGroup.PrimCount || (linknum == 1 && m_host.ParentGroup.PrimCount == 1))
{ {
linknum -= (m_host.ParentGroup.PrimCount) + 1; linknum -= (m_host.ParentGroup.PrimCount) + 1;
if (linknum > 0) linknum--; //for linksets
List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET); List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET);
if (avatars.Count > linknum) if (avatars.Count > linknum)
@ -7807,12 +7806,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetNumberOfPrims() public LSL_Integer llGetNumberOfPrims()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
int avatarCount = 0; int avatarCount = m_host.ParentGroup.GetLinkedAvatars().Count;
World.ForEachScenePresence(delegate(ScenePresence presence)
{
if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
avatarCount++;
});
return m_host.ParentGroup.PrimCount + avatarCount; return m_host.ParentGroup.PrimCount + avatarCount;
} }