public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return 0;
IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>();
if (parcelManagement != null)
{
LandData land = parcelManagement.GetLandObject((float)pos.x, (float)pos.y).LandData;
if (land == null)
{
return 0;
}
IPrimCountModule primCountsModule = World.RequestModuleInterface<IPrimCountModule>();
if (primCountsModule != null)
{
IPrimCounts primCounts = primCountsModule.GetPrimCounts(land.GlobalID);
if (sim_wide != 0)
{
if (category == 0)
{
return primCounts.Simulator;
}
return 0;
}
switch (category)
{
case 0:
return primCounts.Total;//land.
case 1:
return primCounts.Owner;
case 2:
return primCounts.Group;
case 3:
return primCounts.Others;
case 4:
return primCounts.Selected;
case 5:
return primCounts.Temporary;//land.
}
}
}
return 0;
}