aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
authorDiva Canto2012-03-08 18:29:08 -0800
committerDiva Canto2012-03-08 18:29:08 -0800
commitc22446ede08c720b4c20b87cd144c77882e44ffe (patch)
tree139c4135772cba2bc958f500d19c281e5f3d5061 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
parentHG inventory/asset transfers: serialize asset posts. I'm using the same patte... (diff)
parentRemove a race condition from SP.Set_AbsolutePosition where we assume the Pare... (diff)
downloadopensim-SC_OLD-c22446ede08c720b4c20b87cd144c77882e44ffe.zip
opensim-SC_OLD-c22446ede08c720b4c20b87cd144c77882e44ffe.tar.gz
opensim-SC_OLD-c22446ede08c720b4c20b87cd144c77882e44ffe.tar.bz2
opensim-SC_OLD-c22446ede08c720b4c20b87cd144c77882e44ffe.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs87
1 files changed, 46 insertions, 41 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0003515..786ae6e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2771,64 +2771,69 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2771 { 2771 {
2772 m_host.AddScriptLPS(1); 2772 m_host.AddScriptLPS(1);
2773 2773
2774 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s)) 2774 Util.FireAndForget(delegate (object x)
2775 return; 2775 {
2776 float dist = (float)llVecDist(llGetPos(), pos); 2776 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
2777 return;
2778 float dist = (float)llVecDist(llGetPos(), pos);
2777 2779
2778 if (dist > m_ScriptDistanceFactor * 10.0f) 2780 if (dist > m_ScriptDistanceFactor * 10.0f)
2779 return; 2781 return;
2780 2782
2781 TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 2783 //Clone is thread-safe
2784 TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
2782 2785
2783 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) 2786 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
2784 {
2785 if (inv.Value.Name == inventory)
2786 { 2787 {
2787 // make sure we're an object. 2788 if (inv.Value.Name == inventory)
2788 if (inv.Value.InvType != (int)InventoryType.Object)
2789 { 2789 {
2790 llSay(0, "Unable to create requested object. Object is missing from database."); 2790 // make sure we're an object.
2791 return; 2791 if (inv.Value.InvType != (int)InventoryType.Object)
2792 } 2792 {
2793 llSay(0, "Unable to create requested object. Object is missing from database.");
2794 return;
2795 }
2793 2796
2794 Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); 2797 Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
2795 Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); 2798 Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
2796 2799
2797 // need the magnitude later 2800 // need the magnitude later
2798 float velmag = (float)Util.GetMagnitude(llvel); 2801 // float velmag = (float)Util.GetMagnitude(llvel);
2799 2802
2800 SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param); 2803 SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param);
2801 2804
2802 // If either of these are null, then there was an unknown error. 2805 // If either of these are null, then there was an unknown error.
2803 if (new_group == null) 2806 if (new_group == null)
2804 continue; 2807 continue;
2805 2808
2806 // objects rezzed with this method are die_at_edge by default. 2809 // objects rezzed with this method are die_at_edge by default.
2807 new_group.RootPart.SetDieAtEdge(true); 2810 new_group.RootPart.SetDieAtEdge(true);
2808 2811
2809 new_group.ResumeScripts(); 2812 new_group.ResumeScripts();
2810 2813
2811 m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( 2814 m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
2812 "object_rez", new Object[] { 2815 "object_rez", new Object[] {
2813 new LSL_String( 2816 new LSL_String(
2814 new_group.RootPart.UUID.ToString()) }, 2817 new_group.RootPart.UUID.ToString()) },
2815 new DetectParams[0])); 2818 new DetectParams[0]));
2816 2819
2817 float groupmass = new_group.GetMass(); 2820 float groupmass = new_group.GetMass();
2818 2821
2819 if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero) 2822 if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero)
2820 { 2823 {
2821 //Recoil. 2824 //Recoil.
2822 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); 2825 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
2826 }
2827 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2828 return;
2823 } 2829 }
2824 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2825 ScriptSleep((int)((groupmass * velmag) / 10));
2826 ScriptSleep(100);
2827 return;
2828 } 2830 }
2829 }
2830 2831
2831 llSay(0, "Could not find object " + inventory); 2832 llSay(0, "Could not find object " + inventory);
2833 });
2834
2835 //ScriptSleep((int)((groupmass * velmag) / 10));
2836 ScriptSleep(100);
2832 } 2837 }
2833 2838
2834 public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) 2839 public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)