refactor: use existing GetInventoryItem() in GetScriptByName(), itself renamed from ScriptByName()
parent
cf8adbe007
commit
fffd2fe10d
|
@ -181,7 +181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if ((item = ScriptByName(name)) != UUID.Zero)
|
||||
if ((item = GetScriptByName(name)) != UUID.Zero)
|
||||
m_ScriptEngine.ResetScript(item);
|
||||
else
|
||||
ShoutError("llResetOtherScript: script "+name+" not found");
|
||||
|
@ -193,7 +193,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if ((item = ScriptByName(name)) != UUID.Zero)
|
||||
if ((item = GetScriptByName(name)) != UUID.Zero)
|
||||
{
|
||||
return m_ScriptEngine.GetScriptState(item) ?1:0;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
// These functions are supposed to be robust,
|
||||
// so get the state one step at a time.
|
||||
|
||||
if ((item = ScriptByName(name)) != UUID.Zero)
|
||||
if ((item = GetScriptByName(name)) != UUID.Zero)
|
||||
{
|
||||
m_ScriptEngine.SetScriptState(item, run == 0 ? false : true);
|
||||
}
|
||||
|
@ -10218,18 +10218,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return new LSL_List();
|
||||
}
|
||||
|
||||
internal UUID ScriptByName(string name)
|
||||
internal UUID GetScriptByName(string name)
|
||||
{
|
||||
lock (m_host.TaskInventory)
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||
{
|
||||
if (item.Type == 10 && item.Name == name)
|
||||
return item.ItemID;
|
||||
}
|
||||
}
|
||||
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
|
||||
|
||||
return UUID.Zero;
|
||||
if (item == null || item.Type != 10)
|
||||
return UUID.Zero;
|
||||
|
||||
return item.ItemID;
|
||||
}
|
||||
|
||||
internal void ShoutError(string msg)
|
||||
|
|
Loading…
Reference in New Issue