Use GetInventoryItem() in llRezAtRoot rather than iterating through a cloned dictionary
parent
2f998fce1f
commit
7b327848d0
|
@ -2738,24 +2738,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
Util.FireAndForget(delegate (object x)
|
Util.FireAndForget(x =>
|
||||||
{
|
{
|
||||||
if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
|
if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float dist = (float)llVecDist(llGetPos(), pos);
|
float dist = (float)llVecDist(llGetPos(), pos);
|
||||||
|
|
||||||
if (dist > m_ScriptDistanceFactor * 10.0f)
|
if (dist > m_ScriptDistanceFactor * 10.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Clone is thread-safe
|
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory);
|
||||||
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
|
||||||
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
|
if (item == null)
|
||||||
{
|
{
|
||||||
if (inv.Value.Name == inventory)
|
llSay(0, "Could not find object " + inventory);
|
||||||
{
|
return;
|
||||||
// make sure we're an object.
|
}
|
||||||
if (inv.Value.InvType != (int)InventoryType.Object)
|
|
||||||
|
if (item.InvType != (int)InventoryType.Object)
|
||||||
{
|
{
|
||||||
llSay(0, "Unable to create requested object. Object is missing from database.");
|
llSay(0, "Unable to create requested object. Object is missing from database.");
|
||||||
return;
|
return;
|
||||||
|
@ -2767,11 +2768,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// need the magnitude later
|
// need the magnitude later
|
||||||
// float velmag = (float)Util.GetMagnitude(llvel);
|
// float velmag = (float)Util.GetMagnitude(llvel);
|
||||||
|
|
||||||
SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param);
|
SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param);
|
||||||
|
|
||||||
// If either of these are null, then there was an unknown error.
|
// If either of these are null, then there was an unknown error.
|
||||||
if (new_group == null)
|
if (new_group == null)
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
// objects rezzed with this method are die_at_edge by default.
|
// objects rezzed with this method are die_at_edge by default.
|
||||||
new_group.RootPart.SetDieAtEdge(true);
|
new_group.RootPart.SetDieAtEdge(true);
|
||||||
|
@ -2794,11 +2795,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
|
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
|
||||||
}
|
}
|
||||||
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
|
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
llSay(0, "Could not find object " + inventory);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//ScriptSleep((int)((groupmass * velmag) / 10));
|
//ScriptSleep((int)((groupmass * velmag) / 10));
|
||||||
|
|
Loading…
Reference in New Issue