As per opensim-dev mailing list discussion, extend llGetDetectedType() to return OS_NPC if an OS npc is detected.
The detection will also return agent is the NPC has been created with the OS_NPC_SENSE_AS_AGENT option.0.7.4.1
parent
bcfc392edf
commit
ecf7bb268c
|
@ -35,6 +35,7 @@ using OpenMetaverse;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared
|
||||
{
|
||||
|
@ -82,6 +83,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
|
||||
public class DetectParams
|
||||
{
|
||||
public const int AGENT = 1;
|
||||
public const int ACTIVE = 2;
|
||||
public const int PASSIVE = 4;
|
||||
public const int SCRIPTED = 8;
|
||||
public const int OS_NPC = 0x01000000;
|
||||
|
||||
public DetectParams()
|
||||
{
|
||||
Key = UUID.Zero;
|
||||
|
@ -188,9 +195,25 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
presence.Velocity.Y,
|
||||
presence.Velocity.Z);
|
||||
|
||||
Type = 0x01; // Avatar
|
||||
if (presence.PresenceType != PresenceType.Npc)
|
||||
{
|
||||
Type = AGENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = OS_NPC;
|
||||
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
|
||||
|
||||
if (npcData.SenseAsAgent)
|
||||
{
|
||||
Type |= AGENT;
|
||||
}
|
||||
}
|
||||
|
||||
if (presence.Velocity != Vector3.Zero)
|
||||
Type |= 0x02; // Active
|
||||
Type |= ACTIVE;
|
||||
|
||||
Group = presence.ControllingClient.ActiveGroupId;
|
||||
|
||||
|
@ -205,15 +228,15 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
Name = part.Name;
|
||||
Owner = part.OwnerID;
|
||||
if (part.Velocity == Vector3.Zero)
|
||||
Type = 0x04; // Passive
|
||||
Type = PASSIVE;
|
||||
else
|
||||
Type = 0x02; // Passive
|
||||
Type = ACTIVE;
|
||||
|
||||
foreach (SceneObjectPart p in part.ParentGroup.Parts)
|
||||
{
|
||||
if (p.Inventory.ContainsScripts())
|
||||
{
|
||||
Type |= 0x08; // Scripted
|
||||
Type |= SCRIPTED; // Scripted
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue