diff options
author | Justin Clark-Casey (justincc) | 2012-07-04 21:36:44 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-04 21:36:44 +0100 |
commit | 857494f6bdef5aef8cfcbee84ca668c2371bfdf0 (patch) | |
tree | 97ff5c649d83d71cd1e44d6c983b11dd6ef8c403 | |
parent | refactor: replace use of LSL_Api.GetTaskInventoryItem() with existing GetInve... (diff) | |
download | opensim-SC_OLD-857494f6bdef5aef8cfcbee84ca668c2371bfdf0.zip opensim-SC_OLD-857494f6bdef5aef8cfcbee84ca668c2371bfdf0.tar.gz opensim-SC_OLD-857494f6bdef5aef8cfcbee84ca668c2371bfdf0.tar.bz2 opensim-SC_OLD-857494f6bdef5aef8cfcbee84ca668c2371bfdf0.tar.xz |
refactor: In llRemoteLoadScriptPin() use existing GetInventoryItem()
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 813fffd..a1620e7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6644,9 +6644,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6644 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) | 6644 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) |
6645 | { | 6645 | { |
6646 | m_host.AddScriptLPS(1); | 6646 | m_host.AddScriptLPS(1); |
6647 | bool found = false; | 6647 | |
6648 | UUID destId = UUID.Zero; | 6648 | UUID destId = UUID.Zero; |
6649 | UUID srcId = UUID.Zero; | ||
6650 | 6649 | ||
6651 | if (!UUID.TryParse(target, out destId)) | 6650 | if (!UUID.TryParse(target, out destId)) |
6652 | { | 6651 | { |
@@ -6661,31 +6660,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6661 | } | 6660 | } |
6662 | 6661 | ||
6663 | // copy the first script found with this inventory name | 6662 | // copy the first script found with this inventory name |
6664 | lock (m_host.TaskInventory) | 6663 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); |
6665 | { | ||
6666 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
6667 | { | ||
6668 | if (inv.Value.Name == name) | ||
6669 | { | ||
6670 | // make sure the object is a script | ||
6671 | if (10 == inv.Value.Type) | ||
6672 | { | ||
6673 | found = true; | ||
6674 | srcId = inv.Key; | ||
6675 | break; | ||
6676 | } | ||
6677 | } | ||
6678 | } | ||
6679 | } | ||
6680 | 6664 | ||
6681 | if (!found) | 6665 | // make sure the object is a script |
6666 | if (item == null || item.Type != 10) | ||
6682 | { | 6667 | { |
6683 | llSay(0, "Could not find script " + name); | 6668 | llSay(0, "Could not find script " + name); |
6684 | return; | 6669 | return; |
6685 | } | 6670 | } |
6686 | 6671 | ||
6687 | // the rest of the permission checks are done in RezScript, so check the pin there as well | 6672 | // the rest of the permission checks are done in RezScript, so check the pin there as well |
6688 | World.RezScriptFromPrim(srcId, m_host, destId, pin, running, start_param); | 6673 | World.RezScriptFromPrim(item.ItemID, m_host, destId, pin, running, start_param); |
6689 | 6674 | ||
6690 | // this will cause the delay even if the script pin or permissions were wrong - seems ok | 6675 | // this will cause the delay even if the script pin or permissions were wrong - seems ok |
6691 | ScriptSleep(3000); | 6676 | ScriptSleep(3000); |