refactor: In llRemoteLoadScriptPin() use existing GetInventoryItem()
parent
0acac2f890
commit
8c7f511e55
|
@ -6486,9 +6486,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
|
public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
bool found = false;
|
|
||||||
UUID destId = UUID.Zero;
|
UUID destId = UUID.Zero;
|
||||||
UUID srcId = UUID.Zero;
|
|
||||||
|
|
||||||
if (!UUID.TryParse(target, out destId))
|
if (!UUID.TryParse(target, out destId))
|
||||||
{
|
{
|
||||||
|
@ -6503,31 +6502,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the first script found with this inventory name
|
// copy the first script found with this inventory name
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (inv.Value.Name == name)
|
|
||||||
{
|
|
||||||
// make sure the object is a script
|
|
||||||
if (10 == inv.Value.Type)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
srcId = inv.Key;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
// make sure the object is a script
|
||||||
|
if (item == null || item.Type != 10)
|
||||||
{
|
{
|
||||||
llSay(0, "Could not find script " + name);
|
llSay(0, "Could not find script " + name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the rest of the permission checks are done in RezScript, so check the pin there as well
|
// the rest of the permission checks are done in RezScript, so check the pin there as well
|
||||||
World.RezScriptFromPrim(srcId, m_host, destId, pin, running, start_param);
|
World.RezScriptFromPrim(item.ItemID, m_host, destId, pin, running, start_param);
|
||||||
|
|
||||||
// this will cause the delay even if the script pin or permissions were wrong - seems ok
|
// this will cause the delay even if the script pin or permissions were wrong - seems ok
|
||||||
ScriptSleep(3000);
|
ScriptSleep(3000);
|
||||||
|
|
Loading…
Reference in New Issue