aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins
diff options
context:
space:
mode:
authorMelanie2012-01-06 22:35:06 +0000
committerMelanie2012-01-06 22:35:06 +0000
commit7518b075b76fea062971a9e5fb716118130ebe43 (patch)
treedf4449fdfe02de0b706cac6024603e4ebabdb256 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins
parenteliminate a few tabs from OpenSimDefaults.ini (diff)
downloadopensim-SC-7518b075b76fea062971a9e5fb716118130ebe43.zip
opensim-SC-7518b075b76fea062971a9e5fb716118130ebe43.tar.gz
opensim-SC-7518b075b76fea062971a9e5fb716118130ebe43.tar.bz2
opensim-SC-7518b075b76fea062971a9e5fb716118130ebe43.tar.xz
Add osNpcCreateOwned to create an owned NPC. Those can be sensed only by the owner, can be destroyed only by the owner and only the owner can save their appearance. Added "NPC" as a flag to llSensor to sense NPCs and exclude them from "AGENT" results.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 3eeb23d..7d7813d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -26,10 +26,13 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using OpenMetaverse; 31using OpenMetaverse;
31using OpenSim.Framework; 32using OpenSim.Framework;
33using log4net;
32 34
35using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.ScriptEngine.Shared; 37using OpenSim.Region.ScriptEngine.Shared;
35using OpenSim.Region.ScriptEngine.Shared.Api; 38using OpenSim.Region.ScriptEngine.Shared.Api;
@@ -51,6 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
51 54
52 private const int AGENT = 1; 55 private const int AGENT = 1;
53 private const int AGENT_BY_USERNAME = 0x10; 56 private const int AGENT_BY_USERNAME = 0x10;
57 private const int NPC = 0x20;
54 private const int ACTIVE = 2; 58 private const int ACTIVE = 2;
55 private const int PASSIVE = 4; 59 private const int PASSIVE = 4;
56 private const int SCRIPTED = 8; 60 private const int SCRIPTED = 8;
@@ -203,7 +207,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
203 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 207 List<SensedEntity> sensedEntities = new List<SensedEntity>();
204 208
205 // Is the sensor type is AGENT and not SCRIPTED then include agents 209 // Is the sensor type is AGENT and not SCRIPTED then include agents
206 if ((ts.type & (AGENT | AGENT_BY_USERNAME)) != 0 && (ts.type & SCRIPTED) == 0) 210 if ((ts.type & (AGENT | AGENT_BY_USERNAME | NPC)) != 0 && (ts.type & SCRIPTED) == 0)
207 { 211 {
208 sensedEntities.AddRange(doAgentSensor(ts)); 212 sensedEntities.AddRange(doAgentSensor(ts));
209 } 213 }
@@ -413,6 +417,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
413 417
414 private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) 418 private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
415 { 419 {
420 INPCModule npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>();
421
416 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 422 List<SensedEntity> sensedEntities = new List<SensedEntity>();
417 423
418 // If nobody about quit fast 424 // If nobody about quit fast
@@ -441,6 +447,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
441 447
442 Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence) 448 Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence)
443 { 449 {
450 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
451 return;
452 if ((ts.type & AGENT) == 0 && presence.PresenceType == PresenceType.User)
453 return;
454
444 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) 455 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0)
445 return; 456 return;
446 457
@@ -452,6 +463,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
452 toRegionPos = presence.AbsolutePosition; 463 toRegionPos = presence.AbsolutePosition;
453 dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); 464 dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos));
454 465
466 if (presence.PresenceType == PresenceType.Npc && npcModule != null)
467 {
468 UUID npcOwner = npcModule.GetOwner(presence.UUID);
469 if (npcOwner != UUID.Zero && npcOwner != SensePoint.OwnerID)
470 return;
471 }
472
455 // are they in range 473 // are they in range
456 if (dis <= ts.range) 474 if (dis <= ts.range)
457 { 475 {