aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-28 00:00:12 +0000
committerJustin Clark-Casey (justincc)2012-01-28 00:00:12 +0000
commit7837c611fb483dc776b531306d3d791e8f177aab (patch)
tree01c728a0f46a209eb0267bc166f70260748f4ca8 /OpenSim/Region/ScriptEngine
parentIncrement LPS script stat for OSSL functions that were not already doing this (diff)
downloadopensim-SC_OLD-7837c611fb483dc776b531306d3d791e8f177aab.zip
opensim-SC_OLD-7837c611fb483dc776b531306d3d791e8f177aab.tar.gz
opensim-SC_OLD-7837c611fb483dc776b531306d3d791e8f177aab.tar.bz2
opensim-SC_OLD-7837c611fb483dc776b531306d3d791e8f177aab.tar.xz
Add OS_NPC_SENSE_AS_AGENT option to osNpcCreate().
This allows NPCs to be sensed as agents by LSL sensors rather than as a specific NPC type (which is currently an OpenSimulator-only extension). Wiki doc on this and other recent NPC functions will follow soon
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs1
3 files changed, 18 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a2f5c92..b1583eb 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, true); 2236 return NpcCreate(firstname, lastname, position, notecard, false, true);
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)
@@ -2241,10 +2241,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2241 CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); 2241 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
2242 m_host.AddScriptLPS(1); 2242 m_host.AddScriptLPS(1);
2243 2243
2244 return NpcCreate(firstname, lastname, position, notecard, (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0); 2244 return NpcCreate(
2245 firstname, lastname, position, notecard,
2246 (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0,
2247 (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0);
2245 } 2248 }
2246 2249
2247 private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) 2250 private LSL_Key NpcCreate(
2251 string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent)
2248 { 2252 {
2249 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2253 INPCModule module = World.RequestModuleInterface<INPCModule>();
2250 if (module != null) 2254 if (module != null)
@@ -2281,7 +2285,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2281 lastname, 2285 lastname,
2282 new Vector3((float) position.x, (float) position.y, (float) position.z), 2286 new Vector3((float) position.x, (float) position.y, (float) position.z),
2283 ownerID, 2287 ownerID,
2284 World,appearance); 2288 senseAsAgent,
2289 World,
2290 appearance);
2285 2291
2286 return new LSL_Key(x.ToString()); 2292 return new LSL_Key(x.ToString());
2287 } 2293 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 8356dce..3e0e452 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -447,9 +447,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
447 447
448 Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence) 448 Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence)
449 { 449 {
450 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) 450 if ((ts.type & NPC) == 0
451 && presence.PresenceType == PresenceType.Npc
452 && !npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent)
451 return; 453 return;
452 if ((ts.type & AGENT) == 0 && presence.PresenceType == PresenceType.User) 454
455 if ((ts.type & AGENT) == 0
456 && (presence.PresenceType == PresenceType.User
457 || npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent))
453 return; 458 return;
454 459
455 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) 460 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index ab2c543..a69b4cb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -616,6 +616,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
616 616
617 public const int OS_NPC_CREATOR_OWNED = 0x1; 617 public const int OS_NPC_CREATOR_OWNED = 0x1;
618 public const int OS_NPC_NOT_OWNED = 0x2; 618 public const int OS_NPC_NOT_OWNED = 0x2;
619 public const int OS_NPC_SENSE_AS_AGENT = 0x4;
619 620
620 public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; 621 public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED";
621 public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; 622 public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED";