diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
5 files changed, 70 insertions, 38 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e2a045b..40d9d6f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2077,16 +2077,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2077 | return retVal; | 2077 | return retVal; |
2078 | } | 2078 | } |
2079 | 2079 | ||
2080 | public LSL_Key osNpcCreateOwned(string firstname, string lastname, LSL_Vector position, string notecard) | 2080 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) |
2081 | { | 2081 | { |
2082 | CheckThreatLevel(ThreatLevel.High, "osNpcCreateOwned"); | 2082 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
2083 | return NpcCreate(firstname, lastname, position, notecard, true); | 2083 | return NpcCreate(firstname, lastname, position, notecard, true); |
2084 | } | 2084 | } |
2085 | 2085 | ||
2086 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) | 2086 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) |
2087 | { | 2087 | { |
2088 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2088 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
2089 | return NpcCreate(firstname, lastname, position, notecard, false); | 2089 | return NpcCreate(firstname, lastname, position, notecard, (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0); |
2090 | } | 2090 | } |
2091 | 2091 | ||
2092 | private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) | 2092 | private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) |
@@ -2152,11 +2152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2152 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2152 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2153 | return new LSL_Key(UUID.Zero.ToString()); | 2153 | return new LSL_Key(UUID.Zero.ToString()); |
2154 | 2154 | ||
2155 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2155 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2156 | return new LSL_Key(UUID.Zero.ToString()); | ||
2157 | |||
2158 | UUID ownerID = npcModule.GetOwner(npcId); | ||
2159 | if (ownerID != UUID.Zero && ownerID != m_host.OwnerID) | ||
2160 | return new LSL_Key(UUID.Zero.ToString()); | 2156 | return new LSL_Key(UUID.Zero.ToString()); |
2161 | 2157 | ||
2162 | return SaveAppearanceToNotecard(npcId, notecard); | 2158 | return SaveAppearanceToNotecard(npcId, notecard); |
@@ -2177,6 +2173,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2177 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2173 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2178 | return; | 2174 | return; |
2179 | 2175 | ||
2176 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) | ||
2177 | return; | ||
2178 | |||
2180 | string appearanceSerialized = LoadNotecard(notecard); | 2179 | string appearanceSerialized = LoadNotecard(notecard); |
2181 | OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); | 2180 | OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); |
2182 | // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); | 2181 | // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); |
@@ -2200,7 +2199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2200 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2199 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2201 | return new LSL_Vector(0, 0, 0); | 2200 | return new LSL_Vector(0, 0, 0); |
2202 | 2201 | ||
2203 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2202 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2204 | return new LSL_Vector(0, 0, 0); | 2203 | return new LSL_Vector(0, 0, 0); |
2205 | 2204 | ||
2206 | Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; | 2205 | Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; |
@@ -2220,6 +2219,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2220 | UUID npcId; | 2219 | UUID npcId; |
2221 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2220 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2222 | return; | 2221 | return; |
2222 | |||
2223 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2224 | return; | ||
2223 | 2225 | ||
2224 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); | 2226 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); |
2225 | module.MoveToTarget(npcId, World, pos, false, true); | 2227 | module.MoveToTarget(npcId, World, pos, false, true); |
@@ -2237,6 +2239,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2237 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2239 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2238 | return; | 2240 | return; |
2239 | 2241 | ||
2242 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2243 | return; | ||
2244 | |||
2240 | Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z); | 2245 | Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z); |
2241 | module.MoveToTarget( | 2246 | module.MoveToTarget( |
2242 | new UUID(npc.m_string), | 2247 | new UUID(npc.m_string), |
@@ -2258,7 +2263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2258 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2263 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2259 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2264 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); |
2260 | 2265 | ||
2261 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2266 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2262 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2267 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); |
2263 | 2268 | ||
2264 | ScenePresence sp = World.GetScenePresence(npcId); | 2269 | ScenePresence sp = World.GetScenePresence(npcId); |
@@ -2281,7 +2286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2281 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2286 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2282 | return; | 2287 | return; |
2283 | 2288 | ||
2284 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2289 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2285 | return; | 2290 | return; |
2286 | 2291 | ||
2287 | ScenePresence sp = World.GetScenePresence(npcId); | 2292 | ScenePresence sp = World.GetScenePresence(npcId); |
@@ -2295,7 +2300,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2295 | 2300 | ||
2296 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2301 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2297 | if (module != null) | 2302 | if (module != null) |
2298 | module.StopMoveToTarget(new UUID(npc.m_string), World); | 2303 | { |
2304 | UUID npcId = new UUID(npc.m_string); | ||
2305 | |||
2306 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2307 | return; | ||
2308 | |||
2309 | module.StopMoveToTarget(npcId, World); | ||
2310 | } | ||
2299 | } | 2311 | } |
2300 | 2312 | ||
2301 | public void osNpcSay(LSL_Key npc, string message) | 2313 | public void osNpcSay(LSL_Key npc, string message) |
@@ -2305,7 +2317,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2305 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2317 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2306 | if (module != null) | 2318 | if (module != null) |
2307 | { | 2319 | { |
2308 | module.Say(new UUID(npc.m_string), World, message); | 2320 | UUID npcId = new UUID(npc.m_string); |
2321 | |||
2322 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2323 | return; | ||
2324 | |||
2325 | module.Say(npcId, World, message); | ||
2309 | } | 2326 | } |
2310 | } | 2327 | } |
2311 | 2328 | ||
@@ -2316,7 +2333,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2316 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2333 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2317 | if (module != null) | 2334 | if (module != null) |
2318 | { | 2335 | { |
2319 | module.Sit(new UUID(npc.m_string), new UUID(target.m_string), World); | 2336 | UUID npcId = new UUID(npc.m_string); |
2337 | |||
2338 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2339 | return; | ||
2340 | |||
2341 | module.Sit(npcId, new UUID(target.m_string), World); | ||
2320 | } | 2342 | } |
2321 | } | 2343 | } |
2322 | 2344 | ||
@@ -2327,7 +2349,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2327 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2349 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2328 | if (module != null) | 2350 | if (module != null) |
2329 | { | 2351 | { |
2330 | module.Stand(new UUID(npc.m_string), World); | 2352 | UUID npcId = new UUID(npc.m_string); |
2353 | |||
2354 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2355 | return; | ||
2356 | |||
2357 | module.Stand(npcId, World); | ||
2331 | } | 2358 | } |
2332 | } | 2359 | } |
2333 | 2360 | ||
@@ -2338,7 +2365,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2338 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2365 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2339 | if (module != null) | 2366 | if (module != null) |
2340 | { | 2367 | { |
2341 | module.DeleteNPC(new UUID(npc.m_string), m_host.OwnerID, World); | 2368 | UUID npcId = new UUID(npc.m_string); |
2369 | |||
2370 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2371 | return; | ||
2372 | |||
2373 | module.DeleteNPC(npcId, World); | ||
2342 | } | 2374 | } |
2343 | } | 2375 | } |
2344 | 2376 | ||
@@ -2350,12 +2382,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2350 | if (module != null) | 2382 | if (module != null) |
2351 | { | 2383 | { |
2352 | UUID npcID = new UUID(npc.m_string); | 2384 | UUID npcID = new UUID(npc.m_string); |
2353 | if (module.IsNPC(npcID, m_host.ParentGroup.Scene)) | 2385 | |
2354 | { | 2386 | if (module.CheckPermissions(npcID, m_host.OwnerID)) |
2355 | UUID ownerID = module.GetOwner(npcID); | 2387 | AvatarPlayAnimation(npcID.ToString(), animation); |
2356 | if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) | ||
2357 | AvatarPlayAnimation(npcID.ToString(), animation); | ||
2358 | } | ||
2359 | } | 2388 | } |
2360 | } | 2389 | } |
2361 | 2390 | ||
@@ -2367,12 +2396,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2367 | if (module != null) | 2396 | if (module != null) |
2368 | { | 2397 | { |
2369 | UUID npcID = new UUID(npc.m_string); | 2398 | UUID npcID = new UUID(npc.m_string); |
2370 | if (module.IsNPC(npcID, m_host.ParentGroup.Scene)) | 2399 | |
2371 | { | 2400 | if (module.CheckPermissions(npcID, m_host.OwnerID)) |
2372 | UUID ownerID = module.GetOwner(npcID); | 2401 | AvatarPlayAnimation(npcID.ToString(), animation); |
2373 | if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) | ||
2374 | AvatarStopAnimation(npcID.ToString(), animation); | ||
2375 | } | ||
2376 | } | 2402 | } |
2377 | } | 2403 | } |
2378 | 2404 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 7d7813d..8356dce 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -463,12 +463,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
463 | toRegionPos = presence.AbsolutePosition; | 463 | toRegionPos = presence.AbsolutePosition; |
464 | dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); | 464 | dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); |
465 | 465 | ||
466 | if (presence.PresenceType == PresenceType.Npc && npcModule != null) | 466 | // Disabled for now since all osNpc* methods check for appropriate ownership permission. |
467 | { | 467 | // Perhaps could be re-enabled as an NPC setting at some point since being able to make NPCs not |
468 | UUID npcOwner = npcModule.GetOwner(presence.UUID); | 468 | // sensed might be useful. |
469 | if (npcOwner != UUID.Zero && npcOwner != SensePoint.OwnerID) | 469 | // if (presence.PresenceType == PresenceType.Npc && npcModule != null) |
470 | return; | 470 | // { |
471 | } | 471 | // UUID npcOwner = npcModule.GetOwner(presence.UUID); |
472 | // if (npcOwner != UUID.Zero && npcOwner != SensePoint.OwnerID) | ||
473 | // return; | ||
474 | // } | ||
472 | 475 | ||
473 | // are they in range | 476 | // are they in range |
474 | if (dis <= ts.range) | 477 | if (dis <= ts.range) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index f92f51f..af6be5f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -172,7 +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 | key osNpcCreate(string user, string name, vector position, string notecard, int options); |
176 | LSL_Key osNpcSaveAppearance(key npc, string notecard); | 176 | LSL_Key osNpcSaveAppearance(key npc, string notecard); |
177 | void osNpcLoadAppearance(key npc, string notecard); | 177 | void osNpcLoadAppearance(key npc, string notecard); |
178 | 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 b58cf57..176dc56 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -606,6 +606,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
606 | 606 | ||
607 | public const int OS_NPC_SIT_NOW = 0; | 607 | public const int OS_NPC_SIT_NOW = 0; |
608 | 608 | ||
609 | public const int OS_NPC_CREATOR_OWNED = 0x1; | ||
610 | public const int OS_NPC_NOT_OWNED = 0x2; | ||
611 | |||
609 | public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; | 612 | public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; |
610 | public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; | 613 | public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; |
611 | 614 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index a94392a..0c05ea4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -488,9 +488,9 @@ 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) | 491 | public key osNpcCreate(string user, string name, vector position, key cloneFrom, int options) |
492 | { | 492 | { |
493 | return m_OSSL_Functions.osNpcCreateOwned(user, name, position, cloneFrom); | 493 | return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom, options); |
494 | } | 494 | } |
495 | 495 | ||
496 | public key osNpcSaveAppearance(key npc, string notecard) | 496 | public key osNpcSaveAppearance(key npc, string notecard) |