diff options
author | UbitUmarov | 2015-09-30 02:45:11 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-30 02:45:11 +0100 |
commit | feb78b29104cc1c7f5d327bab45edd4d00a88944 (patch) | |
tree | 86a1e500e2824d5ca741c8af676dee38f8e63cf4 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | remove some restrictions on NPCs creation (diff) | |
download | opensim-SC_OLD-feb78b29104cc1c7f5d327bab45edd4d00a88944.zip opensim-SC_OLD-feb78b29104cc1c7f5d327bab45edd4d00a88944.tar.gz opensim-SC_OLD-feb78b29104cc1c7f5d327bab45edd4d00a88944.tar.bz2 opensim-SC_OLD-feb78b29104cc1c7f5d327bab45edd4d00a88944.tar.xz |
add several options for NPC creation so abusive use can be reduced (restrictive by default) UNTESTED
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7a53646..fae0bda 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -141,8 +141,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
141 | internal float m_ScriptDelayFactor = 1.0f; | 141 | internal float m_ScriptDelayFactor = 1.0f; |
142 | internal float m_ScriptDistanceFactor = 1.0f; | 142 | internal float m_ScriptDistanceFactor = 1.0f; |
143 | internal bool m_debuggerSafe = false; | 143 | internal bool m_debuggerSafe = false; |
144 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); | 144 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); |
145 | |||
146 | protected IUrlModule m_UrlModule = null; | 145 | protected IUrlModule m_UrlModule = null; |
147 | 146 | ||
148 | public void Initialize( | 147 | public void Initialize( |
@@ -196,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
196 | default: | 195 | default: |
197 | break; | 196 | break; |
198 | } | 197 | } |
199 | } | 198 | } |
200 | 199 | ||
201 | public override Object InitializeLifetimeService() | 200 | public override Object InitializeLifetimeService() |
202 | { | 201 | { |
@@ -2577,8 +2576,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2577 | { | 2576 | { |
2578 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2577 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
2579 | m_host.AddScriptLPS(1); | 2578 | m_host.AddScriptLPS(1); |
2579 | |||
2580 | // have to get the npc module also here to set the default Not Owned | ||
2581 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2582 | if(module == null) | ||
2583 | return new LSL_Key(UUID.Zero.ToString()); | ||
2584 | |||
2585 | bool owned = (module.NPCOptionFlags & NPCOptionsFlags.AllowNotOwned) == 0; | ||
2580 | 2586 | ||
2581 | return NpcCreate(firstname, lastname, position, notecard, false, false); | 2587 | return NpcCreate(firstname, lastname, position, notecard, owned, false); |
2582 | } | 2588 | } |
2583 | 2589 | ||
2584 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) | 2590 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) |
@@ -2595,7 +2601,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2595 | private LSL_Key NpcCreate( | 2601 | private LSL_Key NpcCreate( |
2596 | string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent) | 2602 | string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent) |
2597 | { | 2603 | { |
2598 | string groupTitle = String.Empty; | ||
2599 | 2604 | ||
2600 | if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) | 2605 | if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) |
2601 | return new LSL_Key(UUID.Zero.ToString()); | 2606 | return new LSL_Key(UUID.Zero.ToString()); |
@@ -2603,14 +2608,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2603 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2608 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2604 | if (module != null) | 2609 | if (module != null) |
2605 | { | 2610 | { |
2611 | string groupTitle = String.Empty; | ||
2606 | AvatarAppearance appearance = null; | 2612 | AvatarAppearance appearance = null; |
2607 | 2613 | ||
2608 | UUID id; | 2614 | // check creation options |
2609 | if (UUID.TryParse(notecard, out id)) | 2615 | NPCOptionsFlags createFlags = module.NPCOptionFlags; |
2616 | |||
2617 | if((createFlags & NPCOptionsFlags.AllowNotOwned) == 0 && !owned) | ||
2618 | { | ||
2619 | OSSLError("Not owned NPCs disabled"); | ||
2620 | owned = true; // we should get here... | ||
2621 | } | ||
2622 | |||
2623 | if((createFlags & NPCOptionsFlags.AllowSenseAsAvatar) == 0 && senseAsAgent) | ||
2610 | { | 2624 | { |
2611 | ScenePresence clonePresence = World.GetScenePresence(id); | 2625 | OSSLError("NPC allow sense as Avatar disabled"); |
2612 | if (clonePresence != null) | 2626 | senseAsAgent = false; |
2613 | appearance = clonePresence.Appearance; | 2627 | } |
2628 | |||
2629 | if((createFlags & NPCOptionsFlags.NoNPCGroup) == 0) | ||
2630 | { | ||
2631 | if (firstname != String.Empty || lastname != String.Empty) | ||
2632 | { | ||
2633 | if (firstname != "Shown outfit:") | ||
2634 | groupTitle = "- NPC -"; | ||
2635 | } | ||
2636 | } | ||
2637 | |||
2638 | if((createFlags & NPCOptionsFlags.AllowCloneOtherAvatars) != 0) | ||
2639 | { | ||
2640 | UUID id; | ||
2641 | if (UUID.TryParse(notecard, out id)) | ||
2642 | { | ||
2643 | ScenePresence clonePresence = World.GetScenePresence(id); | ||
2644 | if (clonePresence != null) | ||
2645 | appearance = clonePresence.Appearance; | ||
2646 | } | ||
2614 | } | 2647 | } |
2615 | 2648 | ||
2616 | if (appearance == null) | 2649 | if (appearance == null) |