From 63a1cab7fea2784f99aa2ef027ef878536973dc4 Mon Sep 17 00:00:00 2001 From: idb Date: Fri, 13 Feb 2009 21:56:50 +0000 Subject: [PATCH] Correct llGetNumberOfPrims to include sitting avatars in the count. --- .../Shared/Api/Implementation/LSL_Api.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index cd17399aba..ed9d3eeb14 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6725,7 +6725,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetNumberOfPrims() { m_host.AddScriptLPS(1); - return m_host.ParentGroup.PrimCount; + List presences = World.GetScenePresences(); + if (presences.Count == 0) + return 0; + + int avatarCount = 0; + foreach (ScenePresence presence in presences) + { + if (!presence.IsChildAgent && presence.ParentID != 0) + { + if (m_host.ParentGroup.HasChildPrim(presence.ParentID)) + { + avatarCount++; + } + } + } + + return m_host.ParentGroup.PrimCount + avatarCount; } /// @@ -8632,7 +8648,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - return part.ParentGroup.Children.Count; + return part.ParentGroup.PrimCount; } }