From c906128191a6801df46d5542c441ef37c5c456a9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 16 Feb 2012 00:15:39 +0000 Subject: Fix some logic mistakes where firstly osNpcCreate() without options was creating npcs sensed as agents and secondly the OS_NPC_SENSE_AS_AGENT option was having the opposite effect. Hopefully makes progress on addressing http://opensimulator.org/mantis/view.php?id=5872 --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b1583eb..646a97b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2233,7 +2233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); m_host.AddScriptLPS(1); - return NpcCreate(firstname, lastname, position, notecard, false, true); + return NpcCreate(firstname, lastname, position, notecard, false, false); } public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) @@ -2244,7 +2244,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return NpcCreate( firstname, lastname, position, notecard, (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0, - (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0); + (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0); } private LSL_Key NpcCreate( diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 850f50b..5c1bdff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -31,7 +31,6 @@ using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework; using log4net; - using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.ScriptEngine.Shared; @@ -41,6 +40,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { public class SensorRepeat { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public AsyncCommandManager m_CmdManager; public SensorRepeat(AsyncCommandManager CmdManager) @@ -447,11 +448,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins Action senseEntity = new Action(presence => { +// m_log.DebugFormat( +// "[SENSOR REPEAT]: Inspecting scene presence {0}, type {1} on sensor sweep for {2}, type {3}", +// presence.Name, presence.PresenceType, ts.name, ts.type); + if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) { INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); if (npcData == null || !npcData.SenseAsAgent) + { +// m_log.DebugFormat( +// "[SENSOR REPEAT]: Discarding NPC {0} from agent sense sweep for script item id {1}", +// presence.Name, ts.itemID); return; + } } if ((ts.type & AGENT) == 0) @@ -464,7 +474,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); if (npcData != null && npcData.SenseAsAgent) + { +// m_log.DebugFormat( +// "[SENSOR REPEAT]: Discarding NPC {0} from non-agent sense sweep for script item id {1}", +// presence.Name, ts.itemID); return; + } } } -- cgit v1.1