diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
5 files changed, 45 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 8cc6554..120ae2c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2076,10 +2076,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2076 | return retVal; | 2076 | return retVal; |
2077 | } | 2077 | } |
2078 | 2078 | ||
2079 | public LSL_Key osNpcCreateOwned(string firstname, string lastname, LSL_Vector position, string notecard) | ||
2080 | { | ||
2081 | CheckThreatLevel(ThreatLevel.High, "osNpcCreateOwned"); | ||
2082 | return NpcCreate(firstname, lastname, position, notecard, true); | ||
2083 | } | ||
2084 | |||
2079 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) | 2085 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) |
2080 | { | 2086 | { |
2081 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2087 | CheckThreatLevel(ThreatLevel.High, "osNpcCreated"); |
2088 | return NpcCreate(firstname, lastname, position, notecard, false); | ||
2089 | } | ||
2082 | 2090 | ||
2091 | private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) | ||
2092 | { | ||
2083 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2093 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2084 | if (module != null) | 2094 | if (module != null) |
2085 | { | 2095 | { |
@@ -2108,9 +2118,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2108 | if (appearance == null) | 2118 | if (appearance == null) |
2109 | return new LSL_Key(UUID.Zero.ToString()); | 2119 | return new LSL_Key(UUID.Zero.ToString()); |
2110 | 2120 | ||
2121 | UUID ownerID = UUID.Zero; | ||
2122 | if (owned) | ||
2123 | ownerID = m_host.OwnerID; | ||
2111 | UUID x = module.CreateNPC(firstname, | 2124 | UUID x = module.CreateNPC(firstname, |
2112 | lastname, | 2125 | lastname, |
2113 | new Vector3((float) position.x, (float) position.y, (float) position.z), | 2126 | new Vector3((float) position.x, (float) position.y, (float) position.z), |
2127 | ownerID, | ||
2114 | World,appearance); | 2128 | World,appearance); |
2115 | 2129 | ||
2116 | return new LSL_Key(x.ToString()); | 2130 | return new LSL_Key(x.ToString()); |
@@ -2140,6 +2154,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2140 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2154 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) |
2141 | return new LSL_Key(UUID.Zero.ToString()); | 2155 | return new LSL_Key(UUID.Zero.ToString()); |
2142 | 2156 | ||
2157 | UUID ownerID = npcModule.GetOwner(npcId); | ||
2158 | if (ownerID != UUID.Zero && ownerID != m_host.OwnerID) | ||
2159 | return new LSL_Key(UUID.Zero.ToString()); | ||
2160 | |||
2143 | return SaveAppearanceToNotecard(npcId, notecard); | 2161 | return SaveAppearanceToNotecard(npcId, notecard); |
2144 | } | 2162 | } |
2145 | 2163 | ||
@@ -2319,7 +2337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2319 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2337 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2320 | if (module != null) | 2338 | if (module != null) |
2321 | { | 2339 | { |
2322 | module.DeleteNPC(new UUID(npc.m_string), World); | 2340 | module.DeleteNPC(new UUID(npc.m_string), m_host.OwnerID, World); |
2323 | } | 2341 | } |
2324 | } | 2342 | } |
2325 | 2343 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 91a7b87..ac1c1a9 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 | } |
@@ -415,6 +419,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
415 | 419 | ||
416 | private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) | 420 | private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) |
417 | { | 421 | { |
422 | INPCModule npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>(); | ||
423 | |||
418 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); | 424 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); |
419 | 425 | ||
420 | // If nobody about quit fast | 426 | // If nobody about quit fast |
@@ -446,7 +452,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
446 | 452 | ||
447 | Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence) | 453 | Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence) |
448 | { | 454 | { |
449 | if (presence.PresenceType == PresenceType.Npc) | 455 | if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) |
456 | return; | ||
457 | if ((ts.type & AGENT) == 0 && presence.PresenceType == PresenceType.User) | ||
450 | return; | 458 | return; |
451 | 459 | ||
452 | if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) | 460 | if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) |
@@ -460,6 +468,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
460 | toRegionPos = presence.AbsolutePosition; | 468 | toRegionPos = presence.AbsolutePosition; |
461 | dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); | 469 | dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); |
462 | 470 | ||
471 | if (presence.PresenceType == PresenceType.Npc && npcModule != null) | ||
472 | { | ||
473 | UUID npcOwner = npcModule.GetOwner(presence.UUID); | ||
474 | if (npcOwner != UUID.Zero && npcOwner != SensePoint.OwnerID) | ||
475 | return; | ||
476 | } | ||
477 | |||
463 | // are they in range | 478 | // are they in range |
464 | if (dis <= ts.range) | 479 | if (dis <= ts.range) |
465 | { | 480 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index a49feb0..a815c5b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -172,6 +172,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
172 | LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); | 172 | LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); |
173 | 173 | ||
174 | key osNpcCreate(string user, string name, vector position, string notecard); | 174 | key osNpcCreate(string user, string name, vector position, string notecard); |
175 | key osNpcCreateOwned(string user, string name, vector position, string notecard); | ||
175 | LSL_Key osNpcSaveAppearance(key npc, string notecard); | 176 | LSL_Key osNpcSaveAppearance(key npc, string notecard); |
176 | void osNpcLoadAppearance(key npc, string notecard); | 177 | void osNpcLoadAppearance(key npc, string notecard); |
177 | vector osNpcGetPos(key npc); | 178 | vector osNpcGetPos(key npc); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 0ad3f78..3c258d8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
52 | public const int AGENT = 1; | 52 | public const int AGENT = 1; |
53 | public const int AGENT_BY_LEGACY_NAME = 1; | 53 | public const int AGENT_BY_LEGACY_NAME = 1; |
54 | public const int AGENT_BY_USERNAME = 0x10; | 54 | public const int AGENT_BY_USERNAME = 0x10; |
55 | public const int NPC = 0x20; | ||
55 | public const int ACTIVE = 2; | 56 | public const int ACTIVE = 2; |
56 | public const int PASSIVE = 4; | 57 | public const int PASSIVE = 4; |
57 | public const int SCRIPTED = 8; | 58 | public const int SCRIPTED = 8; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 0d7d5ea..6572def 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -488,6 +488,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
488 | return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); | 488 | return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); |
489 | } | 489 | } |
490 | 490 | ||
491 | public key osNpcCreateOwned(string user, string name, vector position, key cloneFrom) | ||
492 | { | ||
493 | return m_OSSL_Functions.osNpcCreateOwned(user, name, position, cloneFrom); | ||
494 | } | ||
495 | |||
491 | public key osNpcSaveAppearance(key npc, string notecard) | 496 | public key osNpcSaveAppearance(key npc, string notecard) |
492 | { | 497 | { |
493 | return m_OSSL_Functions.osNpcSaveAppearance(npc, notecard); | 498 | return m_OSSL_Functions.osNpcSaveAppearance(npc, notecard); |
@@ -818,4 +823,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
818 | return m_OSSL_Functions.osUnixTimeToTimestamp(time); | 823 | return m_OSSL_Functions.osUnixTimeToTimestamp(time); |
819 | } | 824 | } |
820 | } | 825 | } |
821 | } \ No newline at end of file | 826 | } |