diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 22 |
1 files changed, 20 insertions, 2 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 | ||