FireAndForget scripted rez - port from Avination
parent
5f1da80fc1
commit
883a4f6fff
|
@ -2771,6 +2771,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
Util.FireAndForget(delegate (object 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);
|
||||||
|
@ -2778,6 +2780,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (dist > m_ScriptDistanceFactor * 10.0f)
|
if (dist > m_ScriptDistanceFactor * 10.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//Clone is thread-safe
|
||||||
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
||||||
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
|
||||||
|
@ -2795,7 +2798,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
|
Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
|
||||||
|
|
||||||
// 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, inv.Value, llpos, Rot2Quaternion(rot), llvel, param);
|
||||||
|
|
||||||
|
@ -2822,13 +2825,15 @@ 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)
|
||||||
ScriptSleep((int)((groupmass * velmag) / 10));
|
|
||||||
ScriptSleep(100);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
llSay(0, "Could not find object " + inventory);
|
llSay(0, "Could not find object " + inventory);
|
||||||
|
});
|
||||||
|
|
||||||
|
//ScriptSleep((int)((groupmass * velmag) / 10));
|
||||||
|
ScriptSleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
|
public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
|
||||||
|
|
Loading…
Reference in New Issue