aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-08-01 00:39:37 +0100
committerJustin Clark-Casey (justincc)2012-08-01 00:39:37 +0100
commit794363421d3739f1f1920b69ab1aaa438fa2b891 (patch)
tree90acadc7f569c74e2a6cbbc443c30773379c2d82 /OpenSim/Region/ScriptEngine
parentChange exception log messages in XInventoryService connector to error rather ... (diff)
downloadopensim-SC_OLD-794363421d3739f1f1920b69ab1aaa438fa2b891.zip
opensim-SC_OLD-794363421d3739f1f1920b69ab1aaa438fa2b891.tar.gz
opensim-SC_OLD-794363421d3739f1f1920b69ab1aaa438fa2b891.tar.bz2
opensim-SC_OLD-794363421d3739f1f1920b69ab1aaa438fa2b891.tar.xz
Look up the NPC module when the SensorRepeat class is created, rather than on every single sensor sweep.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 06495bb..a626be8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -60,8 +60,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
60 m_CmdManager = CmdManager; 60 m_CmdManager = CmdManager;
61 maximumRange = CmdManager.m_ScriptEngine.Config.GetDouble("SensorMaxRange", 96.0d); 61 maximumRange = CmdManager.m_ScriptEngine.Config.GetDouble("SensorMaxRange", 96.0d);
62 maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 16); 62 maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 16);
63 m_npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>();
63 } 64 }
64 65
66 private INPCModule m_npcModule;
67
65 private Object SenseLock = new Object(); 68 private Object SenseLock = new Object();
66 69
67 private const int AGENT = 1; 70 private const int AGENT = 1;
@@ -450,8 +453,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
450 453
451 private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) 454 private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
452 { 455 {
453 INPCModule npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>();
454
455 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 456 List<SensedEntity> sensedEntities = new List<SensedEntity>();
456 457
457 // If nobody about quit fast 458 // If nobody about quit fast
@@ -484,7 +485,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
484 bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0); 485 bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0);
485 Vector3 toRegionPos; 486 Vector3 toRegionPos;
486 double dis; 487 double dis;
487 488
488 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence => 489 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
489 { 490 {
490// m_log.DebugFormat( 491// m_log.DebugFormat(
@@ -493,7 +494,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
493 494
494 if ((ts.type & NPC) == 0 && (ts.type & OS_NPC) == 0 && presence.PresenceType == PresenceType.Npc) 495 if ((ts.type & NPC) == 0 && (ts.type & OS_NPC) == 0 && presence.PresenceType == PresenceType.Npc)
495 { 496 {
496 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); 497 INPC npcData = m_npcModule.GetNPC(presence.UUID, presence.Scene);
497 if (npcData == null || !npcData.SenseAsAgent) 498 if (npcData == null || !npcData.SenseAsAgent)
498 { 499 {
499// m_log.DebugFormat( 500// m_log.DebugFormat(
@@ -511,7 +512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
511 } 512 }
512 else 513 else
513 { 514 {
514 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); 515 INPC npcData = m_npcModule.GetNPC(presence.UUID, presence.Scene);
515 if (npcData != null && npcData.SenseAsAgent) 516 if (npcData != null && npcData.SenseAsAgent)
516 { 517 {
517// m_log.DebugFormat( 518// m_log.DebugFormat(