From 794363421d3739f1f1920b69ab1aaa438fa2b891 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 1 Aug 2012 00:39:37 +0100 Subject: Look up the NPC module when the SensorRepeat class is created, rather than on every single sensor sweep. --- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') 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 m_CmdManager = CmdManager; maximumRange = CmdManager.m_ScriptEngine.Config.GetDouble("SensorMaxRange", 96.0d); maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 16); + m_npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); } + private INPCModule m_npcModule; + private Object SenseLock = new Object(); private const int AGENT = 1; @@ -450,8 +453,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins private List doAgentSensor(SenseRepeatClass ts) { - INPCModule npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); - List sensedEntities = new List(); // If nobody about quit fast @@ -484,7 +485,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0); Vector3 toRegionPos; double dis; - + Action senseEntity = new Action(presence => { // m_log.DebugFormat( @@ -493,7 +494,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins if ((ts.type & NPC) == 0 && (ts.type & OS_NPC) == 0 && presence.PresenceType == PresenceType.Npc) { - INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); + INPC npcData = m_npcModule.GetNPC(presence.UUID, presence.Scene); if (npcData == null || !npcData.SenseAsAgent) { // m_log.DebugFormat( @@ -511,7 +512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins } else { - INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); + INPC npcData = m_npcModule.GetNPC(presence.UUID, presence.Scene); if (npcData != null && npcData.SenseAsAgent) { // m_log.DebugFormat( -- cgit v1.1