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=5872iar_mods
parent
f574d3c8fc
commit
c906128191
|
@ -121,8 +121,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
|
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}",
|
"[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
|
||||||
firstname, lastname, npcAvatar.AgentId, position, scene.RegionInfo.RegionName);
|
firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
AgentCircuitData acd = new AgentCircuitData();
|
AgentCircuitData acd = new AgentCircuitData();
|
||||||
acd.AgentID = npcAvatar.AgentId;
|
acd.AgentID = npcAvatar.AgentId;
|
||||||
|
|
|
@ -2233,7 +2233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
|
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
|
||||||
m_host.AddScriptLPS(1);
|
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)
|
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(
|
return NpcCreate(
|
||||||
firstname, lastname, position, notecard,
|
firstname, lastname, position, notecard,
|
||||||
(options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0,
|
(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(
|
private LSL_Key NpcCreate(
|
||||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.ScriptEngine.Shared;
|
using OpenSim.Region.ScriptEngine.Shared;
|
||||||
|
@ -41,6 +40,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
{
|
{
|
||||||
public class SensorRepeat
|
public class SensorRepeat
|
||||||
{
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public AsyncCommandManager m_CmdManager;
|
public AsyncCommandManager m_CmdManager;
|
||||||
|
|
||||||
public SensorRepeat(AsyncCommandManager CmdManager)
|
public SensorRepeat(AsyncCommandManager CmdManager)
|
||||||
|
@ -447,12 +448,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
|
|
||||||
Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
|
Action<ScenePresence> senseEntity = new Action<ScenePresence>(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)
|
if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
|
||||||
{
|
{
|
||||||
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
|
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
|
||||||
if (npcData == null || !npcData.SenseAsAgent)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((ts.type & AGENT) == 0)
|
if ((ts.type & AGENT) == 0)
|
||||||
{
|
{
|
||||||
|
@ -464,9 +474,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
{
|
{
|
||||||
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
|
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
|
||||||
if (npcData != null && npcData.SenseAsAgent)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0)
|
if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue