diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 20 |
2 files changed, 40 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index bb0ba3d..c1a700a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2067,10 +2067,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2067 | return retVal; | 2067 | return retVal; |
2068 | } | 2068 | } |
2069 | 2069 | ||
2070 | public LSL_Key osNpcCreateOwned(string firstname, string lastname, LSL_Vector position, string notecard) | ||
2071 | { | ||
2072 | CheckThreatLevel(ThreatLevel.High, "osNpcCreateOwned"); | ||
2073 | return NpcCreate(firstname, lastname, position, notecard, true); | ||
2074 | } | ||
2075 | |||
2070 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) | 2076 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) |
2071 | { | 2077 | { |
2072 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2078 | CheckThreatLevel(ThreatLevel.High, "osNpcCreated"); |
2079 | return NpcCreate(firstname, lastname, position, notecard, false); | ||
2080 | } | ||
2073 | 2081 | ||
2082 | private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) | ||
2083 | { | ||
2074 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2084 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2075 | if (module != null) | 2085 | if (module != null) |
2076 | { | 2086 | { |
@@ -2099,11 +2109,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2099 | if (appearance == null) | 2109 | if (appearance == null) |
2100 | return new LSL_Key(UUID.Zero.ToString()); | 2110 | return new LSL_Key(UUID.Zero.ToString()); |
2101 | 2111 | ||
2112 | UUID ownerID = UUID.Zero; | ||
2113 | if (owned) | ||
2114 | ownerID = m_host.OwnerID; | ||
2102 | UUID x = module.CreateNPC(firstname, | 2115 | UUID x = module.CreateNPC(firstname, |
2103 | lastname, | 2116 | lastname, |
2104 | new Vector3((float) position.x, (float) position.y, (float) position.z), | 2117 | new Vector3((float) position.x, (float) position.y, (float) position.z), |
2105 | World, | 2118 | ownerID, |
2106 | appearance); | 2119 | World,appearance); |
2107 | 2120 | ||
2108 | return new LSL_Key(x.ToString()); | 2121 | return new LSL_Key(x.ToString()); |
2109 | } | 2122 | } |
@@ -2132,6 +2145,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2132 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2145 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) |
2133 | return new LSL_Key(UUID.Zero.ToString()); | 2146 | return new LSL_Key(UUID.Zero.ToString()); |
2134 | 2147 | ||
2148 | UUID ownerID = npcModule.GetOwner(npcId); | ||
2149 | if (ownerID != UUID.Zero && ownerID != m_host.OwnerID) | ||
2150 | return new LSL_Key(UUID.Zero.ToString()); | ||
2151 | |||
2135 | return SaveAppearanceToNotecard(npcId, notecard); | 2152 | return SaveAppearanceToNotecard(npcId, notecard); |
2136 | } | 2153 | } |
2137 | 2154 | ||
@@ -2311,7 +2328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2311 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2328 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2312 | if (module != null) | 2329 | if (module != null) |
2313 | { | 2330 | { |
2314 | module.DeleteNPC(new UUID(npc.m_string), World); | 2331 | module.DeleteNPC(new UUID(npc.m_string), m_host.OwnerID, World); |
2315 | } | 2332 | } |
2316 | } | 2333 | } |
2317 | 2334 | ||
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 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using log4net; | ||
32 | 34 | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
33 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Region.ScriptEngine.Shared; | 37 | using OpenSim.Region.ScriptEngine.Shared; |
35 | using OpenSim.Region.ScriptEngine.Shared.Api; | 38 | using 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 | { |