aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs76
1 files changed, 36 insertions, 40 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index cf65abb..0a25454 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2738,67 +2738,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2738 { 2738 {
2739 m_host.AddScriptLPS(1); 2739 m_host.AddScriptLPS(1);
2740 2740
2741 Util.FireAndForget(delegate (object x) 2741 Util.FireAndForget(x =>
2742 { 2742 {
2743 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s)) 2743 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
2744 return; 2744 return;
2745
2745 float dist = (float)llVecDist(llGetPos(), pos); 2746 float dist = (float)llVecDist(llGetPos(), pos);
2746 2747
2747 if (dist > m_ScriptDistanceFactor * 10.0f) 2748 if (dist > m_ScriptDistanceFactor * 10.0f)
2748 return; 2749 return;
2749 2750
2750 //Clone is thread-safe 2751 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory);
2751 TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
2752 2752
2753 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) 2753 if (item == null)
2754 { 2754 {
2755 if (inv.Value.Name == inventory) 2755 llSay(0, "Could not find object " + inventory);
2756 { 2756 return;
2757 // make sure we're an object. 2757 }
2758 if (inv.Value.InvType != (int)InventoryType.Object)
2759 {
2760 llSay(0, "Unable to create requested object. Object is missing from database.");
2761 return;
2762 }
2763 2758
2764 Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); 2759 if (item.InvType != (int)InventoryType.Object)
2765 Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); 2760 {
2761 llSay(0, "Unable to create requested object. Object is missing from database.");
2762 return;
2763 }
2766 2764
2767 // need the magnitude later 2765 Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
2768 // float velmag = (float)Util.GetMagnitude(llvel); 2766 Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
2769 2767
2770 SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param); 2768 // need the magnitude later
2769 // float velmag = (float)Util.GetMagnitude(llvel);
2771 2770
2772 // If either of these are null, then there was an unknown error. 2771 SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param);
2773 if (new_group == null)
2774 continue;
2775 2772
2776 // objects rezzed with this method are die_at_edge by default. 2773 // If either of these are null, then there was an unknown error.
2777 new_group.RootPart.SetDieAtEdge(true); 2774 if (new_group == null)
2775 return;
2778 2776
2779 new_group.ResumeScripts(); 2777 // objects rezzed with this method are die_at_edge by default.
2778 new_group.RootPart.SetDieAtEdge(true);
2780 2779
2781 m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( 2780 new_group.ResumeScripts();
2782 "object_rez", new Object[] {
2783 new LSL_String(
2784 new_group.RootPart.UUID.ToString()) },
2785 new DetectParams[0]));
2786 2781
2787 float groupmass = new_group.GetMass(); 2782 m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
2783 "object_rez", new Object[] {
2784 new LSL_String(
2785 new_group.RootPart.UUID.ToString()) },
2786 new DetectParams[0]));
2788 2787
2789 PhysicsActor pa = new_group.RootPart.PhysActor; 2788 float groupmass = new_group.GetMass();
2790 2789
2791 if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) 2790 PhysicsActor pa = new_group.RootPart.PhysActor;
2792 {
2793 //Recoil.
2794 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
2795 }
2796 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2797 return;
2798 }
2799 }
2800 2791
2801 llSay(0, "Could not find object " + inventory); 2792 if (pa != null && pa.IsPhysical && llvel != Vector3.Zero)
2793 {
2794 //Recoil.
2795 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
2796 }
2797 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2802 }); 2798 });
2803 2799
2804 //ScriptSleep((int)((groupmass * velmag) / 10)); 2800 //ScriptSleep((int)((groupmass * velmag) / 10));