diff options
author | UbitUmarov | 2015-09-29 22:15:56 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-29 22:15:56 +0100 |
commit | 1124d14eb0414c94173f2bb1b0ff1cdbca1886be (patch) | |
tree | dc93cefcc4e3f188e721b3add2c5fd67055165d9 /OpenSim/Region | |
parent | clean some spacing issues (diff) | |
download | opensim-SC-1124d14eb0414c94173f2bb1b0ff1cdbca1886be.zip opensim-SC-1124d14eb0414c94173f2bb1b0ff1cdbca1886be.tar.gz opensim-SC-1124d14eb0414c94173f2bb1b0ff1cdbca1886be.tar.bz2 opensim-SC-1124d14eb0414c94173f2bb1b0ff1cdbca1886be.tar.xz |
remove some restrictions on NPCs creation
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 60 |
1 files changed, 19 insertions, 41 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4984ae5..7a53646 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2578,7 +2578,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2578 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2578 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
2579 | m_host.AddScriptLPS(1); | 2579 | m_host.AddScriptLPS(1); |
2580 | 2580 | ||
2581 | return NpcCreate(firstname, lastname, position, notecard, true, false); | 2581 | return NpcCreate(firstname, lastname, position, notecard, false, false); |
2582 | } | 2582 | } |
2583 | 2583 | ||
2584 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) | 2584 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) |
@@ -2589,39 +2589,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2589 | return NpcCreate( | 2589 | return NpcCreate( |
2590 | firstname, lastname, position, notecard, | 2590 | firstname, lastname, position, notecard, |
2591 | (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0, | 2591 | (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0, |
2592 | false); | 2592 | (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0); |
2593 | // (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0); | ||
2594 | } | 2593 | } |
2595 | 2594 | ||
2596 | private LSL_Key NpcCreate( | 2595 | private LSL_Key NpcCreate( |
2597 | string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent) | 2596 | string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent) |
2598 | { | 2597 | { |
2599 | if (!owned) | ||
2600 | OSSLError("Unowned NPCs are unsupported"); | ||
2601 | |||
2602 | string groupTitle = String.Empty; | 2598 | string groupTitle = String.Empty; |
2603 | 2599 | ||
2604 | if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) | 2600 | if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) |
2605 | return new LSL_Key(UUID.Zero.ToString()); | 2601 | return new LSL_Key(UUID.Zero.ToString()); |
2606 | 2602 | ||
2607 | if (firstname != String.Empty || lastname != String.Empty) | ||
2608 | { | ||
2609 | if (firstname != "Shown outfit:") | ||
2610 | groupTitle = "- NPC -"; | ||
2611 | } | ||
2612 | |||
2613 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2603 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2614 | if (module != null) | 2604 | if (module != null) |
2615 | { | 2605 | { |
2616 | AvatarAppearance appearance = null; | 2606 | AvatarAppearance appearance = null; |
2617 | 2607 | ||
2618 | // UUID id; | 2608 | UUID id; |
2619 | // if (UUID.TryParse(notecard, out id)) | 2609 | if (UUID.TryParse(notecard, out id)) |
2620 | // { | 2610 | { |
2621 | // ScenePresence clonePresence = World.GetScenePresence(id); | 2611 | ScenePresence clonePresence = World.GetScenePresence(id); |
2622 | // if (clonePresence != null) | 2612 | if (clonePresence != null) |
2623 | // appearance = clonePresence.Appearance; | 2613 | appearance = clonePresence.Appearance; |
2624 | // } | 2614 | } |
2625 | 2615 | ||
2626 | if (appearance == null) | 2616 | if (appearance == null) |
2627 | { | 2617 | { |
@@ -2960,32 +2950,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2960 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); | 2950 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); |
2961 | m_host.AddScriptLPS(1); | 2951 | m_host.AddScriptLPS(1); |
2962 | 2952 | ||
2963 | ManualResetEvent ev = new ManualResetEvent(false); | 2953 | try |
2964 | 2954 | { | |
2965 | Util.FireAndForget(delegate(object x) { | 2955 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2966 | try | 2956 | if (module != null) |
2967 | { | 2957 | { |
2968 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2958 | UUID npcId = new UUID(npc.m_string); |
2969 | if (module != null) | ||
2970 | { | ||
2971 | UUID npcId = new UUID(npc.m_string); | ||
2972 | 2959 | ||
2973 | ILandObject l = World.LandChannel.GetLandObject(m_host.GroupPosition.X, m_host.GroupPosition.Y); | 2960 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) |
2974 | if (l == null || m_host.OwnerID != l.LandData.OwnerID) | 2961 | return; |
2975 | { | ||
2976 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2977 | return; | ||
2978 | } | ||
2979 | 2962 | ||
2980 | module.DeleteNPC(npcId, World); | 2963 | module.DeleteNPC(npcId, World); |
2981 | } | ||
2982 | } | 2964 | } |
2983 | finally | 2965 | } |
2984 | { | 2966 | catch { } |
2985 | ev.Set(); | ||
2986 | } | ||
2987 | }); | ||
2988 | ev.WaitOne(); | ||
2989 | } | 2967 | } |
2990 | 2968 | ||
2991 | public void osNpcPlayAnimation(LSL_Key npc, string animation) | 2969 | public void osNpcPlayAnimation(LSL_Key npc, string animation) |