diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 91a7b87..ac1c1a9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -26,10 +26,13 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using log4net; | ||
32 | 34 | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
33 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Region.ScriptEngine.Shared; | 37 | using OpenSim.Region.ScriptEngine.Shared; |
35 | using OpenSim.Region.ScriptEngine.Shared.Api; | 38 | using OpenSim.Region.ScriptEngine.Shared.Api; |
@@ -51,6 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
51 | 54 | ||
52 | private const int AGENT = 1; | 55 | private const int AGENT = 1; |
53 | private const int AGENT_BY_USERNAME = 0x10; | 56 | private const int AGENT_BY_USERNAME = 0x10; |
57 | private const int NPC = 0x20; | ||
54 | private const int ACTIVE = 2; | 58 | private const int ACTIVE = 2; |
55 | private const int PASSIVE = 4; | 59 | private const int PASSIVE = 4; |
56 | private const int SCRIPTED = 8; | 60 | private const int SCRIPTED = 8; |
@@ -203,7 +207,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
203 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); | 207 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); |
204 | 208 | ||
205 | // Is the sensor type is AGENT and not SCRIPTED then include agents | 209 | // Is the sensor type is AGENT and not SCRIPTED then include agents |
206 | if ((ts.type & (AGENT | AGENT_BY_USERNAME)) != 0 && (ts.type & SCRIPTED) == 0) | 210 | if ((ts.type & (AGENT | AGENT_BY_USERNAME | NPC)) != 0 && (ts.type & SCRIPTED) == 0) |
207 | { | 211 | { |
208 | sensedEntities.AddRange(doAgentSensor(ts)); | 212 | sensedEntities.AddRange(doAgentSensor(ts)); |
209 | } | 213 | } |
@@ -415,6 +419,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
415 | 419 | ||
416 | private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) | 420 | private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) |
417 | { | 421 | { |
422 | INPCModule npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>(); | ||
423 | |||
418 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); | 424 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); |
419 | 425 | ||
420 | // If nobody about quit fast | 426 | // If nobody about quit fast |
@@ -446,7 +452,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
446 | 452 | ||
447 | Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence) | 453 | Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence) |
448 | { | 454 | { |
449 | if (presence.PresenceType == PresenceType.Npc) | 455 | if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) |
456 | return; | ||
457 | if ((ts.type & AGENT) == 0 && presence.PresenceType == PresenceType.User) | ||
450 | return; | 458 | return; |
451 | 459 | ||
452 | if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) | 460 | if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) |
@@ -460,6 +468,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
460 | toRegionPos = presence.AbsolutePosition; | 468 | toRegionPos = presence.AbsolutePosition; |
461 | dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); | 469 | dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); |
462 | 470 | ||
471 | if (presence.PresenceType == PresenceType.Npc && npcModule != null) | ||
472 | { | ||
473 | UUID npcOwner = npcModule.GetOwner(presence.UUID); | ||
474 | if (npcOwner != UUID.Zero && npcOwner != SensePoint.OwnerID) | ||
475 | return; | ||
476 | } | ||
477 | |||
463 | // are they in range | 478 | // are they in range |
464 | if (dis <= ts.range) | 479 | if (dis <= ts.range) |
465 | { | 480 | { |