diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 82 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 15 |
2 files changed, 66 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8999f00..62cd75f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2098,6 +2098,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2098 | return NpcCreate(firstname, lastname, position, notecard, false); | 2098 | return NpcCreate(firstname, lastname, position, notecard, false); |
2099 | } | 2099 | } |
2100 | 2100 | ||
2101 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) | ||
2102 | { | ||
2103 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | ||
2104 | return NpcCreate(firstname, lastname, position, notecard, (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0); | ||
2105 | } | ||
2106 | |||
2101 | private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) | 2107 | private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) |
2102 | { | 2108 | { |
2103 | string groupTitle = String.Empty; | 2109 | string groupTitle = String.Empty; |
@@ -2175,11 +2181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2175 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2181 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2176 | return new LSL_Key(UUID.Zero.ToString()); | 2182 | return new LSL_Key(UUID.Zero.ToString()); |
2177 | 2183 | ||
2178 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2184 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2179 | return new LSL_Key(UUID.Zero.ToString()); | ||
2180 | |||
2181 | UUID ownerID = npcModule.GetOwner(npcId); | ||
2182 | if (ownerID != UUID.Zero && ownerID != m_host.OwnerID) | ||
2183 | return new LSL_Key(UUID.Zero.ToString()); | 2185 | return new LSL_Key(UUID.Zero.ToString()); |
2184 | 2186 | ||
2185 | return SaveAppearanceToNotecard(npcId, notecard); | 2187 | return SaveAppearanceToNotecard(npcId, notecard); |
@@ -2200,6 +2202,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2200 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2202 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2201 | return; | 2203 | return; |
2202 | 2204 | ||
2205 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) | ||
2206 | return; | ||
2207 | |||
2203 | string appearanceSerialized = LoadNotecard(notecard); | 2208 | string appearanceSerialized = LoadNotecard(notecard); |
2204 | OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); | 2209 | OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); |
2205 | // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); | 2210 | // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); |
@@ -2223,7 +2228,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2223 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2228 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2224 | return new LSL_Vector(0, 0, 0); | 2229 | return new LSL_Vector(0, 0, 0); |
2225 | 2230 | ||
2226 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2231 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2227 | return new LSL_Vector(0, 0, 0); | 2232 | return new LSL_Vector(0, 0, 0); |
2228 | 2233 | ||
2229 | Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; | 2234 | Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; |
@@ -2243,6 +2248,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2243 | UUID npcId; | 2248 | UUID npcId; |
2244 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2249 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2245 | return; | 2250 | return; |
2251 | |||
2252 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2253 | return; | ||
2246 | 2254 | ||
2247 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); | 2255 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); |
2248 | module.MoveToTarget(npcId, World, pos, false, true); | 2256 | module.MoveToTarget(npcId, World, pos, false, true); |
@@ -2260,6 +2268,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2260 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2268 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2261 | return; | 2269 | return; |
2262 | 2270 | ||
2271 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2272 | return; | ||
2273 | |||
2263 | Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z); | 2274 | Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z); |
2264 | module.MoveToTarget( | 2275 | module.MoveToTarget( |
2265 | new UUID(npc.m_string), | 2276 | new UUID(npc.m_string), |
@@ -2281,7 +2292,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2281 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2292 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2282 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2293 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); |
2283 | 2294 | ||
2284 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2295 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2285 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2296 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); |
2286 | 2297 | ||
2287 | ScenePresence sp = World.GetScenePresence(npcId); | 2298 | ScenePresence sp = World.GetScenePresence(npcId); |
@@ -2304,7 +2315,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2304 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2315 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2305 | return; | 2316 | return; |
2306 | 2317 | ||
2307 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2318 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2308 | return; | 2319 | return; |
2309 | 2320 | ||
2310 | ScenePresence sp = World.GetScenePresence(npcId); | 2321 | ScenePresence sp = World.GetScenePresence(npcId); |
@@ -2318,7 +2329,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2318 | 2329 | ||
2319 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2330 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2320 | if (module != null) | 2331 | if (module != null) |
2321 | module.StopMoveToTarget(new UUID(npc.m_string), World); | 2332 | { |
2333 | UUID npcId = new UUID(npc.m_string); | ||
2334 | |||
2335 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2336 | return; | ||
2337 | |||
2338 | module.StopMoveToTarget(npcId, World); | ||
2339 | } | ||
2322 | } | 2340 | } |
2323 | 2341 | ||
2324 | public void osNpcSay(LSL_Key npc, string message) | 2342 | public void osNpcSay(LSL_Key npc, string message) |
@@ -2328,7 +2346,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2328 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2346 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2329 | if (module != null) | 2347 | if (module != null) |
2330 | { | 2348 | { |
2331 | module.Say(new UUID(npc.m_string), World, message); | 2349 | UUID npcId = new UUID(npc.m_string); |
2350 | |||
2351 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2352 | return; | ||
2353 | |||
2354 | module.Say(npcId, World, message); | ||
2332 | } | 2355 | } |
2333 | } | 2356 | } |
2334 | 2357 | ||
@@ -2339,7 +2362,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2339 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2362 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2340 | if (module != null) | 2363 | if (module != null) |
2341 | { | 2364 | { |
2342 | module.Sit(new UUID(npc.m_string), new UUID(target.m_string), World); | 2365 | UUID npcId = new UUID(npc.m_string); |
2366 | |||
2367 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2368 | return; | ||
2369 | |||
2370 | module.Sit(npcId, new UUID(target.m_string), World); | ||
2343 | } | 2371 | } |
2344 | } | 2372 | } |
2345 | 2373 | ||
@@ -2350,7 +2378,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2350 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2378 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2351 | if (module != null) | 2379 | if (module != null) |
2352 | { | 2380 | { |
2353 | module.Stand(new UUID(npc.m_string), World); | 2381 | UUID npcId = new UUID(npc.m_string); |
2382 | |||
2383 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2384 | return; | ||
2385 | |||
2386 | module.Stand(npcId, World); | ||
2354 | } | 2387 | } |
2355 | } | 2388 | } |
2356 | 2389 | ||
@@ -2361,7 +2394,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2361 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2394 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2362 | if (module != null) | 2395 | if (module != null) |
2363 | { | 2396 | { |
2364 | module.DeleteNPC(new UUID(npc.m_string), m_host.OwnerID, World); | 2397 | UUID npcId = new UUID(npc.m_string); |
2398 | |||
2399 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2400 | return; | ||
2401 | |||
2402 | module.DeleteNPC(npcId, World); | ||
2365 | } | 2403 | } |
2366 | } | 2404 | } |
2367 | 2405 | ||
@@ -2373,12 +2411,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2373 | if (module != null) | 2411 | if (module != null) |
2374 | { | 2412 | { |
2375 | UUID npcID = new UUID(npc.m_string); | 2413 | UUID npcID = new UUID(npc.m_string); |
2376 | if (module.IsNPC(npcID, m_host.ParentGroup.Scene)) | 2414 | |
2377 | { | 2415 | if (module.CheckPermissions(npcID, m_host.OwnerID)) |
2378 | UUID ownerID = module.GetOwner(npcID); | 2416 | AvatarPlayAnimation(npcID.ToString(), animation); |
2379 | if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) | ||
2380 | AvatarPlayAnimation(npcID.ToString(), animation); | ||
2381 | } | ||
2382 | } | 2417 | } |
2383 | } | 2418 | } |
2384 | 2419 | ||
@@ -2390,12 +2425,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2390 | if (module != null) | 2425 | if (module != null) |
2391 | { | 2426 | { |
2392 | UUID npcID = new UUID(npc.m_string); | 2427 | UUID npcID = new UUID(npc.m_string); |
2393 | if (module.IsNPC(npcID, m_host.ParentGroup.Scene)) | 2428 | |
2394 | { | 2429 | if (module.CheckPermissions(npcID, m_host.OwnerID)) |
2395 | UUID ownerID = module.GetOwner(npcID); | 2430 | AvatarPlayAnimation(npcID.ToString(), animation); |
2396 | if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) | ||
2397 | AvatarStopAnimation(npcID.ToString(), animation); | ||
2398 | } | ||
2399 | } | 2431 | } |
2400 | } | 2432 | } |
2401 | 2433 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index ac1c1a9..dddf913 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -468,12 +468,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
468 | toRegionPos = presence.AbsolutePosition; | 468 | toRegionPos = presence.AbsolutePosition; |
469 | dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); | 469 | dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); |
470 | 470 | ||
471 | if (presence.PresenceType == PresenceType.Npc && npcModule != null) | 471 | // Disabled for now since all osNpc* methods check for appropriate ownership permission. |
472 | { | 472 | // Perhaps could be re-enabled as an NPC setting at some point since being able to make NPCs not |
473 | UUID npcOwner = npcModule.GetOwner(presence.UUID); | 473 | // sensed might be useful. |
474 | if (npcOwner != UUID.Zero && npcOwner != SensePoint.OwnerID) | 474 | // if (presence.PresenceType == PresenceType.Npc && npcModule != null) |
475 | return; | 475 | // { |
476 | } | 476 | // UUID npcOwner = npcModule.GetOwner(presence.UUID); |
477 | // if (npcOwner != UUID.Zero && npcOwner != SensePoint.OwnerID) | ||
478 | // return; | ||
479 | // } | ||
477 | 480 | ||
478 | // are they in range | 481 | // are they in range |
479 | if (dis <= ts.range) | 482 | if (dis <= ts.range) |