aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs117
1 files changed, 56 insertions, 61 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..d7a629b 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)
@@ -3820,7 +3825,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3820 List<String> nametable = new List<String>(); 3825 List<String> nametable = new List<String>();
3821 World.ForEachRootScenePresence(delegate(ScenePresence presence) 3826 World.ForEachRootScenePresence(delegate(ScenePresence presence)
3822 { 3827 {
3823 if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) 3828 SceneObjectPart sitPart = presence.ParentPart;
3829 if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId))
3824 nametable.Add(presence.ControllingClient.Name); 3830 nametable.Add(presence.ControllingClient.Name);
3825 }); 3831 });
3826 3832
@@ -4308,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4308 4314
4309 if (m_host.RegionHandle == presence.RegionHandle) 4315 if (m_host.RegionHandle == presence.RegionHandle)
4310 { 4316 {
4311 Dictionary<UUID, string> animationstateNames = AnimationSet.Animations.AnimStateNames; 4317 Dictionary<UUID, string> animationstateNames = DefaultAvatarAnimations.AnimStateNames;
4312 4318
4313 if (presence != null) 4319 if (presence != null)
4314 { 4320 {
@@ -4388,22 +4394,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4388 4394
4389 // Find pushee position 4395 // Find pushee position
4390 // Pushee Linked? 4396 // Pushee Linked?
4391 if (pusheeav.ParentID != 0) 4397 SceneObjectPart sitPart = pusheeav.ParentPart;
4392 { 4398 if (sitPart != null)
4393 SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID); 4399 PusheePos = sitPart.AbsolutePosition;
4394 if (parentobj != null)
4395 {
4396 PusheePos = parentobj.AbsolutePosition;
4397 }
4398 else
4399 {
4400 PusheePos = pusheeav.AbsolutePosition;
4401 }
4402 }
4403 else 4400 else
4404 {
4405 PusheePos = pusheeav.AbsolutePosition; 4401 PusheePos = pusheeav.AbsolutePosition;
4406 }
4407 } 4402 }
4408 4403
4409 if (!pusheeIsAvatar) 4404 if (!pusheeIsAvatar)
@@ -5598,14 +5593,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5598 flags |= ScriptBaseClass.AGENT_IN_AIR; 5593 flags |= ScriptBaseClass.AGENT_IN_AIR;
5599 } 5594 }
5600 5595
5601 if (agent.ParentID != 0) 5596 if (agent.ParentPart != null)
5602 { 5597 {
5603 flags |= ScriptBaseClass.AGENT_ON_OBJECT; 5598 flags |= ScriptBaseClass.AGENT_ON_OBJECT;
5604 flags |= ScriptBaseClass.AGENT_SITTING; 5599 flags |= ScriptBaseClass.AGENT_SITTING;
5605 } 5600 }
5606 5601
5607 if (agent.Animator.Animations.DefaultAnimation.AnimID 5602 if (agent.Animator.Animations.DefaultAnimation.AnimID
5608 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 5603 == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
5609 { 5604 {
5610 flags |= ScriptBaseClass.AGENT_SITTING; 5605 flags |= ScriptBaseClass.AGENT_SITTING;
5611 } 5606 }
@@ -7687,7 +7682,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7687 World.ForEachRootScenePresence(delegate(ScenePresence presence) 7682 World.ForEachRootScenePresence(delegate(ScenePresence presence)
7688 { 7683 {
7689 if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) 7684 if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
7690 avatarCount++; 7685 avatarCount++;
7691 }); 7686 });
7692 7687
7693 return m_host.ParentGroup.PrimCount + avatarCount; 7688 return m_host.ParentGroup.PrimCount + avatarCount;
@@ -7719,7 +7714,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7719 LSL_Vector lower; 7714 LSL_Vector lower;
7720 LSL_Vector upper; 7715 LSL_Vector upper;
7721 if (presence.Animator.Animations.DefaultAnimation.AnimID 7716 if (presence.Animator.Animations.DefaultAnimation.AnimID
7722 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 7717 == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
7723 { 7718 {
7724 // This is for ground sitting avatars 7719 // This is for ground sitting avatars
7725 float height = presence.Appearance.AvatarHeight / 2.66666667f; 7720 float height = presence.Appearance.AvatarHeight / 2.66666667f;