add AGENT_LIST_EXCLUDENPC bit mask option to llGetAgentList scope to exclude NPCs

0.9.0.1-postfixes
UbitUmarov 2017-11-14 03:49:32 +00:00
parent 98f90f4eed
commit 873d42005f
2 changed files with 11 additions and 0 deletions

View File

@ -6639,11 +6639,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// AGENT_LIST_PARCEL - all in the same parcel as the scripted object /// AGENT_LIST_PARCEL - all in the same parcel as the scripted object
/// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the /// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the
/// current parcel. /// current parcel.
/// AGENT_LIST_EXCLUDENPC ignore NPCs (bit mask)
/// </summary> /// </summary>
public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options) public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// do our bit masks part
bool noNPC = (scope & ScriptBaseClass.AGENT_LIST_EXCLUDENPC) !=0;
// remove bit masks part
scope &= ~ ScriptBaseClass.AGENT_LIST_EXCLUDENPC;
// the constants are 1, 2 and 4 so bits are being set, but you // the constants are 1, 2 and 4 so bits are being set, but you
// get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4 // get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4
bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION; bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION;
@ -6684,6 +6691,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.ForEachRootScenePresence( World.ForEachRootScenePresence(
delegate (ScenePresence ssp) delegate (ScenePresence ssp)
{ {
if(noNPC && ssp.IsNPC)
return;
// Gods are not listed in SL // Gods are not listed in SL
if (!ssp.IsDeleted && !ssp.IsViewerUIGod && !ssp.IsChildAgent) if (!ssp.IsDeleted && !ssp.IsViewerUIGod && !ssp.IsChildAgent)
{ {

View File

@ -660,6 +660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int AGENT_LIST_PARCEL = 1; public const int AGENT_LIST_PARCEL = 1;
public const int AGENT_LIST_PARCEL_OWNER = 2; public const int AGENT_LIST_PARCEL_OWNER = 2;
public const int AGENT_LIST_REGION = 4; public const int AGENT_LIST_REGION = 4;
public const int AGENT_LIST_EXCLUDENPC = 0x4000000; // our flag, not SL and it is a bit mask
// Can not be public const? // Can not be public const?
public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);