aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-02-16 00:15:39 +0000
committerJustin Clark-Casey (justincc)2012-02-16 00:22:39 +0000
commitc906128191a6801df46d5542c441ef37c5c456a9 (patch)
tree148519a768001b58aa7c4013257753ba6909f0e3 /OpenSim/Region/ScriptEngine
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-c906128191a6801df46d5542c441ef37c5c456a9.zip
opensim-SC-c906128191a6801df46d5542c441ef37c5c456a9.tar.gz
opensim-SC-c906128191a6801df46d5542c441ef37c5c456a9.tar.bz2
opensim-SC-c906128191a6801df46d5542c441ef37c5c456a9.tar.xz
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
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs17
2 files changed, 18 insertions, 3 deletions
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
2233 CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); 2233 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
2234 m_host.AddScriptLPS(1); 2234 m_host.AddScriptLPS(1);
2235 2235
2236 return NpcCreate(firstname, lastname, position, notecard, false, true); 2236 return NpcCreate(firstname, lastname, position, notecard, false, false);
2237 } 2237 }
2238 2238
2239 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) 2239 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
2244 return NpcCreate( 2244 return NpcCreate(
2245 firstname, lastname, position, notecard, 2245 firstname, lastname, position, notecard,
2246 (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0, 2246 (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0,
2247 (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0); 2247 (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0);
2248 } 2248 }
2249 2249
2250 private LSL_Key NpcCreate( 2250 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;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using log4net; 33using log4net;
34
35using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.ScriptEngine.Shared; 36using OpenSim.Region.ScriptEngine.Shared;
@@ -41,6 +40,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
41{ 40{
42 public class SensorRepeat 41 public class SensorRepeat
43 { 42 {
43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
44 public AsyncCommandManager m_CmdManager; 45 public AsyncCommandManager m_CmdManager;
45 46
46 public SensorRepeat(AsyncCommandManager CmdManager) 47 public SensorRepeat(AsyncCommandManager CmdManager)
@@ -447,11 +448,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
447 448
448 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence => 449 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
449 { 450 {
451// m_log.DebugFormat(
452// "[SENSOR REPEAT]: Inspecting scene presence {0}, type {1} on sensor sweep for {2}, type {3}",
453// presence.Name, presence.PresenceType, ts.name, ts.type);
454
450 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) 455 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
451 { 456 {
452 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); 457 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
453 if (npcData == null || !npcData.SenseAsAgent) 458 if (npcData == null || !npcData.SenseAsAgent)
459 {
460// m_log.DebugFormat(
461// "[SENSOR REPEAT]: Discarding NPC {0} from agent sense sweep for script item id {1}",
462// presence.Name, ts.itemID);
454 return; 463 return;
464 }
455 } 465 }
456 466
457 if ((ts.type & AGENT) == 0) 467 if ((ts.type & AGENT) == 0)
@@ -464,7 +474,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
464 { 474 {
465 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); 475 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
466 if (npcData != null && npcData.SenseAsAgent) 476 if (npcData != null && npcData.SenseAsAgent)
477 {
478// m_log.DebugFormat(
479// "[SENSOR REPEAT]: Discarding NPC {0} from non-agent sense sweep for script item id {1}",
480// presence.Name, ts.itemID);
467 return; 481 return;
482 }
468 } 483 }
469 } 484 }
470 485