diff options
author | Melanie | 2012-06-15 15:48:34 +0100 |
---|---|---|
committer | Melanie | 2012-06-15 15:48:34 +0100 |
commit | ff21007b93cfea55f6b66bb08d0ab0810fcc77b5 (patch) | |
tree | 3c91c2946b92676c16d0b84ded23315a9ad718bd /OpenSim/Region | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Reapply the one change that was in the revert that was actually function, not (diff) | |
download | opensim-SC-ff21007b93cfea55f6b66bb08d0ab0810fcc77b5.zip opensim-SC-ff21007b93cfea55f6b66bb08d0ab0810fcc77b5.tar.gz opensim-SC-ff21007b93cfea55f6b66bb08d0ab0810fcc77b5.tar.bz2 opensim-SC-ff21007b93cfea55f6b66bb08d0ab0810fcc77b5.tar.xz |
Merge branch 'avination' into careminster
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region')
3 files changed, 588 insertions, 94 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5aeee52..8ed58a6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3030,10 +3030,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3030 | { | 3030 | { |
3031 | if (!m_rootPart.BlockGrab) | 3031 | if (!m_rootPart.BlockGrab) |
3032 | { | 3032 | { |
3033 | Vector3 llmoveforce = pos - AbsolutePosition; | 3033 | /* Vector3 llmoveforce = pos - AbsolutePosition; |
3034 | Vector3 grabforce = llmoveforce; | 3034 | Vector3 grabforce = llmoveforce; |
3035 | grabforce = (grabforce / 10) * pa.Mass; | 3035 | grabforce = (grabforce / 10) * pa.Mass; |
3036 | pa.AddForce(grabforce, true); | 3036 | */ |
3037 | // empirically convert distance diference to a impulse | ||
3038 | Vector3 grabforce = pos - AbsolutePosition; | ||
3039 | grabforce = grabforce * (pa.Mass/ 10.0f); | ||
3040 | pa.AddForce(grabforce, false); | ||
3037 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); | 3041 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); |
3038 | } | 3042 | } |
3039 | } | 3043 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 310e21a..1fc9790 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2394,7 +2394,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2394 | 2394 | ||
2395 | Vector3 up = new Vector3((float)x, (float)y, (float)z); | 2395 | Vector3 up = new Vector3((float)x, (float)y, (float)z); |
2396 | Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; | 2396 | Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; |
2397 | |||
2397 | m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; | 2398 | m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; |
2399 | |||
2400 | // m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset; | ||
2398 | Rotation = sitTargetOrient; | 2401 | Rotation = sitTargetOrient; |
2399 | ParentPosition = part.AbsolutePosition; | 2402 | ParentPosition = part.AbsolutePosition; |
2400 | part.ParentGroup.AddAvatar(UUID); | 2403 | part.ParentGroup.AddAvatar(UUID); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5aa0678..41de257 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2332,7 +2332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2332 | // scene | 2332 | // scene |
2333 | PhysicsActor pa = part.PhysActor; | 2333 | PhysicsActor pa = part.PhysActor; |
2334 | 2334 | ||
2335 | if (pa != null && !pa.IsPhysical) | 2335 | if (pa != null && !pa.IsPhysical && part == part.ParentGroup.RootPart) |
2336 | { | 2336 | { |
2337 | part.ParentGroup.ResetChildPrimPhysicsPositions(); | 2337 | part.ParentGroup.ResetChildPrimPhysicsPositions(); |
2338 | } | 2338 | } |
@@ -6917,7 +6917,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6917 | { | 6917 | { |
6918 | // LSL quaternions can normalize to 0, normal Quaternions can't. | 6918 | // LSL quaternions can normalize to 0, normal Quaternions can't. |
6919 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) | 6919 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) |
6920 | rot.z = 1; // ZERO_ROTATION = 0,0,0,1 | 6920 | rot.s = 1; // ZERO_ROTATION = 0,0,0,1 |
6921 | 6921 | ||
6922 | part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); | 6922 | part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); |
6923 | part.SitTargetOrientation = Rot2Quaternion(rot); | 6923 | part.SitTargetOrientation = Rot2Quaternion(rot); |
@@ -7720,73 +7720,231 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7720 | ScriptSleep(200); | 7720 | ScriptSleep(200); |
7721 | } | 7721 | } |
7722 | 7722 | ||
7723 | // vector up using libomv (c&p from sop ) | ||
7724 | // vector up rotated by r | ||
7725 | private Vector3 Zrot(Quaternion r) | ||
7726 | { | ||
7727 | double x, y, z, m; | ||
7728 | |||
7729 | m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W; | ||
7730 | if (Math.Abs(1.0 - m) > 0.000001) | ||
7731 | { | ||
7732 | m = 1.0 / Math.Sqrt(m); | ||
7733 | r.X *= (float)m; | ||
7734 | r.Y *= (float)m; | ||
7735 | r.Z *= (float)m; | ||
7736 | r.W *= (float)m; | ||
7737 | } | ||
7738 | |||
7739 | x = 2 * (r.X * r.Z + r.Y * r.W); | ||
7740 | y = 2 * (-r.X * r.W + r.Y * r.Z); | ||
7741 | z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W; | ||
7742 | |||
7743 | return new Vector3((float)x, (float)y, (float)z); | ||
7744 | } | ||
7745 | |||
7723 | protected void SetPrimParams(ScenePresence av, LSL_List rules) | 7746 | protected void SetPrimParams(ScenePresence av, LSL_List rules) |
7724 | { | 7747 | { |
7725 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. | 7748 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. |
7726 | //We only support PRIM_POSITION and PRIM_ROTATION | ||
7727 | 7749 | ||
7728 | int idx = 0; | 7750 | int idx = 0; |
7751 | SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used | ||
7729 | 7752 | ||
7730 | while (idx < rules.Length) | 7753 | bool positionChanged = false; |
7754 | Vector3 finalPos = Vector3.Zero; | ||
7755 | |||
7756 | try | ||
7731 | { | 7757 | { |
7732 | int code = rules.GetLSLIntegerItem(idx++); | 7758 | while (idx < rules.Length) |
7759 | { | ||
7760 | int code = rules.GetLSLIntegerItem(idx++); | ||
7733 | 7761 | ||
7734 | int remain = rules.Length - idx; | 7762 | int remain = rules.Length - idx; |
7735 | 7763 | ||
7736 | switch (code) | 7764 | switch (code) |
7737 | { | 7765 | { |
7738 | case (int)ScriptBaseClass.PRIM_POSITION: | 7766 | // a avatar is a child |
7739 | { | 7767 | case (int)ScriptBaseClass.PRIM_POSITION: |
7768 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
7769 | { | ||
7770 | if (remain < 1) | ||
7771 | return; | ||
7772 | LSL_Vector v; | ||
7773 | v = rules.GetVector3Item(idx++); | ||
7774 | |||
7775 | if (sitpart == null) | ||
7776 | break; | ||
7777 | |||
7778 | Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position | ||
7779 | |||
7780 | if (sitpart != sitpart.ParentGroup.RootPart) | ||
7781 | { | ||
7782 | pos -= sitpart.OffsetPosition; // remove sit part offset | ||
7783 | Quaternion rot = sitpart.RotationOffset; | ||
7784 | pos *= Quaternion.Conjugate(rot); // removed sit part rotation | ||
7785 | } | ||
7786 | Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f); | ||
7787 | pos += sitOffset; | ||
7788 | |||
7789 | finalPos = pos; | ||
7790 | positionChanged = true; | ||
7791 | } | ||
7792 | break; | ||
7793 | |||
7794 | case (int)ScriptBaseClass.PRIM_ROTATION: | ||
7795 | { | ||
7796 | if (remain < 1) | ||
7797 | return; | ||
7798 | |||
7799 | if (sitpart == null) | ||
7800 | break; | ||
7801 | |||
7802 | LSL_Rotation r = rules.GetQuaternionItem(idx++); | ||
7803 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation | ||
7804 | |||
7805 | // need to replicate SL bug | ||
7806 | SceneObjectGroup sitgrp = sitpart.ParentGroup; | ||
7807 | if (sitgrp != null && sitgrp.RootPart != sitpart) | ||
7808 | { | ||
7809 | rot = sitgrp.RootPart.RotationOffset * rot; | ||
7810 | } | ||
7811 | |||
7812 | Quaternion srot = sitpart.RotationOffset; | ||
7813 | rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation | ||
7814 | av.Rotation = rot; | ||
7815 | av.SendAvatarDataToAllAgents(); | ||
7816 | } | ||
7817 | break; | ||
7818 | |||
7819 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
7820 | { | ||
7821 | if (remain < 1) | ||
7822 | return; | ||
7823 | |||
7824 | if (sitpart == null) | ||
7825 | break; | ||
7826 | |||
7827 | LSL_Rotation r = rules.GetQuaternionItem(idx++); | ||
7828 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation | ||
7829 | if (sitpart != sitpart.ParentGroup.RootPart) | ||
7830 | { | ||
7831 | Quaternion srot = sitpart.RotationOffset; | ||
7832 | rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation | ||
7833 | } | ||
7834 | av.Rotation = rot; | ||
7835 | av.SendAvatarDataToAllAgents(); | ||
7836 | } | ||
7837 | break; | ||
7838 | |||
7839 | // parse rest doing nothing but number of parameters error check | ||
7840 | case (int)ScriptBaseClass.PRIM_SIZE: | ||
7841 | case (int)ScriptBaseClass.PRIM_MATERIAL: | ||
7842 | case (int)ScriptBaseClass.PRIM_PHANTOM: | ||
7843 | case (int)ScriptBaseClass.PRIM_PHYSICS: | ||
7844 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | ||
7845 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | ||
7846 | case (int)ScriptBaseClass.PRIM_NAME: | ||
7847 | case (int)ScriptBaseClass.PRIM_DESC: | ||
7740 | if (remain < 1) | 7848 | if (remain < 1) |
7741 | return; | 7849 | return; |
7742 | LSL_Vector v; | 7850 | idx++; |
7743 | v = rules.GetVector3Item(idx++); | 7851 | break; |
7744 | 7852 | ||
7745 | SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); | 7853 | case (int)ScriptBaseClass.PRIM_GLOW: |
7746 | if (part == null) | 7854 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
7747 | break; | 7855 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
7856 | if (remain < 2) | ||
7857 | return; | ||
7858 | idx += 2; | ||
7859 | break; | ||
7748 | 7860 | ||
7749 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; | 7861 | case (int)ScriptBaseClass.PRIM_TYPE: |
7750 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; | 7862 | if (remain < 3) |
7751 | if (llGetLinkNumber() > 1) | 7863 | return; |
7864 | code = (int)rules.GetLSLIntegerItem(idx++); | ||
7865 | remain = rules.Length - idx; | ||
7866 | switch (code) | ||
7752 | { | 7867 | { |
7753 | localRot = llGetLocalRot(); | 7868 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: |
7754 | localPos = llGetLocalPos(); | 7869 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: |
7870 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | ||
7871 | if (remain < 6) | ||
7872 | return; | ||
7873 | idx += 6; | ||
7874 | break; | ||
7875 | |||
7876 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | ||
7877 | if (remain < 5) | ||
7878 | return; | ||
7879 | idx += 5; | ||
7880 | break; | ||
7881 | |||
7882 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | ||
7883 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | ||
7884 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | ||
7885 | if (remain < 11) | ||
7886 | return; | ||
7887 | idx += 11; | ||
7888 | break; | ||
7889 | |||
7890 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | ||
7891 | if (remain < 2) | ||
7892 | return; | ||
7893 | idx += 2; | ||
7894 | break; | ||
7755 | } | 7895 | } |
7896 | break; | ||
7756 | 7897 | ||
7757 | v -= localPos; | 7898 | case (int)ScriptBaseClass.PRIM_COLOR: |
7758 | v /= localRot; | 7899 | case (int)ScriptBaseClass.PRIM_TEXT: |
7900 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | ||
7901 | case (int)ScriptBaseClass.PRIM_OMEGA: | ||
7902 | if (remain < 3) | ||
7903 | return; | ||
7904 | idx += 3; | ||
7905 | break; | ||
7759 | 7906 | ||
7760 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); | 7907 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
7761 | 7908 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | |
7762 | v = v + 2 * sitOffset; | 7909 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: |
7910 | if (remain < 5) | ||
7911 | return; | ||
7912 | idx += 5; | ||
7913 | break; | ||
7763 | 7914 | ||
7764 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); | 7915 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
7765 | av.SendAvatarDataToAllAgents(); | 7916 | if (remain < 7) |
7917 | return; | ||
7766 | 7918 | ||
7767 | } | 7919 | idx += 7; |
7768 | break; | 7920 | break; |
7769 | 7921 | ||
7770 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7922 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
7771 | { | 7923 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
7772 | if (remain < 1) | ||
7773 | return; | 7924 | return; |
7774 | 7925 | ||
7775 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; | 7926 | if (positionChanged) |
7776 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; | ||
7777 | if (llGetLinkNumber() > 1) | ||
7778 | { | 7927 | { |
7779 | localRot = llGetLocalRot(); | 7928 | positionChanged = false; |
7780 | localPos = llGetLocalPos(); | 7929 | av.OffsetPosition = finalPos; |
7930 | av.SendAvatarDataToAllAgents(); | ||
7781 | } | 7931 | } |
7782 | 7932 | ||
7783 | LSL_Rotation r; | 7933 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); |
7784 | r = rules.GetQuaternionItem(idx++); | 7934 | LSL_List new_rules = rules.GetSublist(idx, -1); |
7785 | r = r * llGetRootRotation() / localRot; | 7935 | setLinkPrimParams((int)new_linknumber, new_rules); |
7786 | av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); | 7936 | return; |
7787 | av.SendAvatarDataToAllAgents(); | 7937 | } |
7788 | } | 7938 | } |
7789 | break; | 7939 | } |
7940 | |||
7941 | finally | ||
7942 | { | ||
7943 | if (positionChanged) | ||
7944 | { | ||
7945 | av.OffsetPosition = finalPos; | ||
7946 | av.SendAvatarDataToAllAgents(); | ||
7947 | positionChanged = false; | ||
7790 | } | 7948 | } |
7791 | } | 7949 | } |
7792 | } | 7950 | } |
@@ -7798,6 +7956,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7798 | 7956 | ||
7799 | int idx = 0; | 7957 | int idx = 0; |
7800 | 7958 | ||
7959 | SceneObjectGroup parentgrp = part.ParentGroup; | ||
7960 | |||
7801 | bool positionChanged = false; | 7961 | bool positionChanged = false; |
7802 | LSL_Vector currentPosition = GetPartLocalPos(part); | 7962 | LSL_Vector currentPosition = GetPartLocalPos(part); |
7803 | 7963 | ||
@@ -7820,8 +7980,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7820 | return; | 7980 | return; |
7821 | 7981 | ||
7822 | v=rules.GetVector3Item(idx++); | 7982 | v=rules.GetVector3Item(idx++); |
7823 | positionChanged = true; | ||
7824 | currentPosition = GetSetPosTarget(part, v, currentPosition); | 7983 | currentPosition = GetSetPosTarget(part, v, currentPosition); |
7984 | positionChanged = true; | ||
7825 | 7985 | ||
7826 | break; | 7986 | break; |
7827 | case (int)ScriptBaseClass.PRIM_SIZE: | 7987 | case (int)ScriptBaseClass.PRIM_SIZE: |
@@ -7837,8 +7997,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7837 | return; | 7997 | return; |
7838 | 7998 | ||
7839 | LSL_Rotation q = rules.GetQuaternionItem(idx++); | 7999 | LSL_Rotation q = rules.GetQuaternionItem(idx++); |
8000 | SceneObjectPart rootPart = parentgrp.RootPart; | ||
7840 | // try to let this work as in SL... | 8001 | // try to let this work as in SL... |
7841 | if (part.ParentID == 0) | 8002 | if (rootPart == part) |
7842 | { | 8003 | { |
7843 | // special case: If we are root, rotate complete SOG to new rotation | 8004 | // special case: If we are root, rotate complete SOG to new rotation |
7844 | SetRot(part, Rot2Quaternion(q)); | 8005 | SetRot(part, Rot2Quaternion(q)); |
@@ -7846,7 +8007,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7846 | else | 8007 | else |
7847 | { | 8008 | { |
7848 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | 8009 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
7849 | SceneObjectPart rootPart = part.ParentGroup.RootPart; | 8010 | // sounds like sl bug that we need to replicate |
7850 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); | 8011 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); |
7851 | } | 8012 | } |
7852 | 8013 | ||
@@ -8099,7 +8260,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8099 | return; | 8260 | return; |
8100 | 8261 | ||
8101 | string ph = rules.Data[idx++].ToString(); | 8262 | string ph = rules.Data[idx++].ToString(); |
8102 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); | 8263 | parentgrp.ScriptSetPhantomStatus(ph.Equals("1")); |
8103 | 8264 | ||
8104 | break; | 8265 | break; |
8105 | 8266 | ||
@@ -8152,7 +8313,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8152 | return; | 8313 | return; |
8153 | string temp = rules.Data[idx++].ToString(); | 8314 | string temp = rules.Data[idx++].ToString(); |
8154 | 8315 | ||
8155 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); | 8316 | parentgrp.ScriptSetTemporaryStatus(temp.Equals("1")); |
8156 | 8317 | ||
8157 | break; | 8318 | break; |
8158 | 8319 | ||
@@ -8202,13 +8363,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8202 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | 8363 | LSL_Float gain = rules.GetLSLFloatItem(idx++); |
8203 | TargetOmega(part, axis, (double)spinrate, (double)gain); | 8364 | TargetOmega(part, axis, (double)spinrate, (double)gain); |
8204 | break; | 8365 | break; |
8366 | |||
8205 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 8367 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
8206 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 8368 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
8207 | return; | 8369 | return; |
8370 | |||
8371 | // do a pending position change before jumping to other part/avatar | ||
8372 | if (positionChanged) | ||
8373 | { | ||
8374 | positionChanged = false; | ||
8375 | if (parentgrp == null) | ||
8376 | return; | ||
8377 | |||
8378 | if (parentgrp.RootPart == part) | ||
8379 | { | ||
8380 | |||
8381 | Util.FireAndForget(delegate(object x) | ||
8382 | { | ||
8383 | parentgrp.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | ||
8384 | }); | ||
8385 | } | ||
8386 | else | ||
8387 | { | ||
8388 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | ||
8389 | parentgrp.HasGroupChanged = true; | ||
8390 | parentgrp.ScheduleGroupForTerseUpdate(); | ||
8391 | } | ||
8392 | } | ||
8393 | |||
8208 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | 8394 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); |
8209 | LSL_List new_rules = rules.GetSublist(idx, -1); | 8395 | LSL_List new_rules = rules.GetSublist(idx, -1); |
8210 | setLinkPrimParams((int)new_linknumber, new_rules); | 8396 | setLinkPrimParams((int)new_linknumber, new_rules); |
8211 | |||
8212 | return; | 8397 | return; |
8213 | } | 8398 | } |
8214 | } | 8399 | } |
@@ -8233,24 +8418,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8233 | } | 8418 | } |
8234 | } | 8419 | } |
8235 | } | 8420 | } |
8236 | |||
8237 | if (positionChanged) | ||
8238 | { | ||
8239 | if (part.ParentGroup.RootPart == part) | ||
8240 | { | ||
8241 | SceneObjectGroup parent = part.ParentGroup; | ||
8242 | Util.FireAndForget(delegate(object x) { | ||
8243 | parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | ||
8244 | }); | ||
8245 | } | ||
8246 | else | ||
8247 | { | ||
8248 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | ||
8249 | SceneObjectGroup parent = part.ParentGroup; | ||
8250 | parent.HasGroupChanged = true; | ||
8251 | parent.ScheduleGroupForTerseUpdate(); | ||
8252 | } | ||
8253 | } | ||
8254 | } | 8421 | } |
8255 | 8422 | ||
8256 | public LSL_String llStringToBase64(string str) | 8423 | public LSL_String llStringToBase64(string str) |
@@ -8547,16 +8714,291 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8547 | { | 8714 | { |
8548 | m_host.AddScriptLPS(1); | 8715 | m_host.AddScriptLPS(1); |
8549 | 8716 | ||
8717 | // acording to SL wiki this must indicate a single link number or link_root or link_this. | ||
8718 | // keep other options as before | ||
8719 | |||
8550 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 8720 | List<SceneObjectPart> parts = GetLinkParts(linknumber); |
8721 | List<ScenePresence> avatars = GetLinkAvatars(linknumber); | ||
8551 | 8722 | ||
8552 | LSL_List res = new LSL_List(); | 8723 | LSL_List res = new LSL_List(); |
8553 | 8724 | ||
8554 | foreach (var part in parts) | 8725 | if (parts.Count > 0) |
8555 | { | 8726 | { |
8556 | LSL_List partRes = GetLinkPrimitiveParams(part, rules); | 8727 | foreach (var part in parts) |
8557 | res += partRes; | 8728 | { |
8729 | LSL_List partRes = GetLinkPrimitiveParams(part, rules); | ||
8730 | res += partRes; | ||
8731 | } | ||
8732 | } | ||
8733 | if (avatars.Count > 0) | ||
8734 | { | ||
8735 | foreach (ScenePresence avatar in avatars) | ||
8736 | { | ||
8737 | LSL_List avaRes = GetLinkPrimitiveParams(avatar, rules); | ||
8738 | res += avaRes; | ||
8739 | } | ||
8558 | } | 8740 | } |
8741 | return res; | ||
8742 | } | ||
8743 | |||
8744 | public LSL_List GetLinkPrimitiveParams(ScenePresence avatar, LSL_List rules) | ||
8745 | { | ||
8746 | // avatars case | ||
8747 | // replies as SL wiki | ||
8748 | |||
8749 | LSL_List res = new LSL_List(); | ||
8750 | // SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed | ||
8751 | SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone?? | ||
8752 | |||
8753 | int idx = 0; | ||
8754 | while (idx < rules.Length) | ||
8755 | { | ||
8756 | int code = (int)rules.GetLSLIntegerItem(idx++); | ||
8757 | int remain = rules.Length - idx; | ||
8758 | |||
8759 | switch (code) | ||
8760 | { | ||
8761 | case (int)ScriptBaseClass.PRIM_MATERIAL: | ||
8762 | res.Add(new LSL_Integer((int)SOPMaterialData.SopMaterial.Flesh)); | ||
8763 | break; | ||
8559 | 8764 | ||
8765 | case (int)ScriptBaseClass.PRIM_PHYSICS: | ||
8766 | res.Add(new LSL_Integer(0)); | ||
8767 | break; | ||
8768 | |||
8769 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | ||
8770 | res.Add(new LSL_Integer(0)); | ||
8771 | break; | ||
8772 | |||
8773 | case (int)ScriptBaseClass.PRIM_PHANTOM: | ||
8774 | res.Add(new LSL_Integer(0)); | ||
8775 | break; | ||
8776 | |||
8777 | case (int)ScriptBaseClass.PRIM_POSITION: | ||
8778 | |||
8779 | Vector3 pos = avatar.OffsetPosition; | ||
8780 | |||
8781 | Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f); | ||
8782 | pos -= sitOffset; | ||
8783 | |||
8784 | if( sitPart != null) | ||
8785 | pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation(); | ||
8786 | |||
8787 | res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); | ||
8788 | break; | ||
8789 | |||
8790 | case (int)ScriptBaseClass.PRIM_SIZE: | ||
8791 | // as in llGetAgentSize above | ||
8792 | res.Add(new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight)); | ||
8793 | break; | ||
8794 | |||
8795 | case (int)ScriptBaseClass.PRIM_ROTATION: | ||
8796 | Quaternion rot = avatar.Rotation; | ||
8797 | if (sitPart != null) | ||
8798 | { | ||
8799 | rot = sitPart.GetWorldRotation() * rot; // apply sit part world rotation | ||
8800 | } | ||
8801 | |||
8802 | res.Add(new LSL_Rotation (rot.X, rot.Y, rot.Z, rot.W)); | ||
8803 | break; | ||
8804 | |||
8805 | case (int)ScriptBaseClass.PRIM_TYPE: | ||
8806 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX)); | ||
8807 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT)); | ||
8808 | res.Add(new LSL_Vector(0f,1.0f,0f)); | ||
8809 | res.Add(new LSL_Float(0.0f)); | ||
8810 | res.Add(new LSL_Vector(0, 0, 0)); | ||
8811 | res.Add(new LSL_Vector(1.0f,1.0f,0f)); | ||
8812 | res.Add(new LSL_Vector(0, 0, 0)); | ||
8813 | break; | ||
8814 | |||
8815 | case (int)ScriptBaseClass.PRIM_TEXTURE: | ||
8816 | if (remain < 1) | ||
8817 | return res; | ||
8818 | |||
8819 | int face = (int)rules.GetLSLIntegerItem(idx++); | ||
8820 | if (face == ScriptBaseClass.ALL_SIDES) | ||
8821 | { | ||
8822 | for (face = 0; face < 21; face++) | ||
8823 | { | ||
8824 | res.Add(new LSL_String("")); | ||
8825 | res.Add(new LSL_Vector(0,0,0)); | ||
8826 | res.Add(new LSL_Vector(0,0,0)); | ||
8827 | res.Add(new LSL_Float(0.0)); | ||
8828 | } | ||
8829 | } | ||
8830 | else | ||
8831 | { | ||
8832 | if (face >= 0 && face < 21) | ||
8833 | { | ||
8834 | res.Add(new LSL_String("")); | ||
8835 | res.Add(new LSL_Vector(0,0,0)); | ||
8836 | res.Add(new LSL_Vector(0,0,0)); | ||
8837 | res.Add(new LSL_Float(0.0)); | ||
8838 | } | ||
8839 | } | ||
8840 | break; | ||
8841 | |||
8842 | case (int)ScriptBaseClass.PRIM_COLOR: | ||
8843 | if (remain < 1) | ||
8844 | return res; | ||
8845 | |||
8846 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8847 | |||
8848 | if (face == ScriptBaseClass.ALL_SIDES) | ||
8849 | { | ||
8850 | for (face = 0; face < 21; face++) | ||
8851 | { | ||
8852 | res.Add(new LSL_Vector(0,0,0)); | ||
8853 | res.Add(new LSL_Float(0)); | ||
8854 | } | ||
8855 | } | ||
8856 | else | ||
8857 | { | ||
8858 | res.Add(new LSL_Vector(0,0,0)); | ||
8859 | res.Add(new LSL_Float(0)); | ||
8860 | } | ||
8861 | break; | ||
8862 | |||
8863 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | ||
8864 | if (remain < 1) | ||
8865 | return res; | ||
8866 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8867 | |||
8868 | if (face == ScriptBaseClass.ALL_SIDES) | ||
8869 | { | ||
8870 | for (face = 0; face < 21; face++) | ||
8871 | { | ||
8872 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); | ||
8873 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); | ||
8874 | } | ||
8875 | } | ||
8876 | else | ||
8877 | { | ||
8878 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); | ||
8879 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); | ||
8880 | } | ||
8881 | break; | ||
8882 | |||
8883 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | ||
8884 | if (remain < 1) | ||
8885 | return res; | ||
8886 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8887 | |||
8888 | if (face == ScriptBaseClass.ALL_SIDES) | ||
8889 | { | ||
8890 | for (face = 0; face < 21; face++) | ||
8891 | { | ||
8892 | res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); | ||
8893 | } | ||
8894 | } | ||
8895 | else | ||
8896 | { | ||
8897 | res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); | ||
8898 | } | ||
8899 | break; | ||
8900 | |||
8901 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | ||
8902 | res.Add(new LSL_Integer(0)); | ||
8903 | res.Add(new LSL_Integer(0));// softness | ||
8904 | res.Add(new LSL_Float(0.0f)); // gravity | ||
8905 | res.Add(new LSL_Float(0.0f)); // friction | ||
8906 | res.Add(new LSL_Float(0.0f)); // wind | ||
8907 | res.Add(new LSL_Float(0.0f)); // tension | ||
8908 | res.Add(new LSL_Vector(0f,0f,0f)); | ||
8909 | break; | ||
8910 | |||
8911 | case (int)ScriptBaseClass.PRIM_TEXGEN: | ||
8912 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) | ||
8913 | if (remain < 1) | ||
8914 | return res; | ||
8915 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8916 | |||
8917 | if (face == ScriptBaseClass.ALL_SIDES) | ||
8918 | { | ||
8919 | for (face = 0; face < 21; face++) | ||
8920 | { | ||
8921 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); | ||
8922 | } | ||
8923 | } | ||
8924 | else | ||
8925 | { | ||
8926 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); | ||
8927 | } | ||
8928 | break; | ||
8929 | |||
8930 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | ||
8931 | res.Add(new LSL_Integer(0)); | ||
8932 | res.Add(new LSL_Vector(0f,0f,0f)); | ||
8933 | res.Add(new LSL_Float(0f)); // intensity | ||
8934 | res.Add(new LSL_Float(0f)); // radius | ||
8935 | res.Add(new LSL_Float(0f)); // falloff | ||
8936 | break; | ||
8937 | |||
8938 | case (int)ScriptBaseClass.PRIM_GLOW: | ||
8939 | if (remain < 1) | ||
8940 | return res; | ||
8941 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8942 | |||
8943 | if (face == ScriptBaseClass.ALL_SIDES) | ||
8944 | { | ||
8945 | for (face = 0; face < 21; face++) | ||
8946 | { | ||
8947 | res.Add(new LSL_Float(0f)); | ||
8948 | } | ||
8949 | } | ||
8950 | else | ||
8951 | { | ||
8952 | res.Add(new LSL_Float(0f)); | ||
8953 | } | ||
8954 | break; | ||
8955 | |||
8956 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
8957 | res.Add(new LSL_String("")); | ||
8958 | res.Add(new LSL_Vector(0f,0f,0f)); | ||
8959 | res.Add(new LSL_Float(1.0f)); | ||
8960 | break; | ||
8961 | |||
8962 | case (int)ScriptBaseClass.PRIM_NAME: | ||
8963 | res.Add(new LSL_String(avatar.Name)); | ||
8964 | break; | ||
8965 | |||
8966 | case (int)ScriptBaseClass.PRIM_DESC: | ||
8967 | res.Add(new LSL_String("")); | ||
8968 | break; | ||
8969 | |||
8970 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
8971 | Quaternion lrot = avatar.Rotation; | ||
8972 | |||
8973 | if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) | ||
8974 | { | ||
8975 | lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset | ||
8976 | } | ||
8977 | res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W)); | ||
8978 | break; | ||
8979 | |||
8980 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
8981 | Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part | ||
8982 | Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f); | ||
8983 | lpos -= lsitOffset; | ||
8984 | |||
8985 | if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) | ||
8986 | { | ||
8987 | lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim | ||
8988 | } | ||
8989 | res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z)); | ||
8990 | break; | ||
8991 | |||
8992 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
8993 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
8994 | return res; | ||
8995 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
8996 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
8997 | |||
8998 | res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | ||
8999 | return res; | ||
9000 | } | ||
9001 | } | ||
8560 | return res; | 9002 | return res; |
8561 | } | 9003 | } |
8562 | 9004 | ||
@@ -8946,6 +9388,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8946 | res.Add(new LSL_Float(primglow)); | 9388 | res.Add(new LSL_Float(primglow)); |
8947 | } | 9389 | } |
8948 | break; | 9390 | break; |
9391 | |||
8949 | case (int)ScriptBaseClass.PRIM_TEXT: | 9392 | case (int)ScriptBaseClass.PRIM_TEXT: |
8950 | Color4 textColor = part.GetTextColor(); | 9393 | Color4 textColor = part.GetTextColor(); |
8951 | res.Add(new LSL_String(part.Text)); | 9394 | res.Add(new LSL_String(part.Text)); |
@@ -8954,18 +9397,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8954 | textColor.B)); | 9397 | textColor.B)); |
8955 | res.Add(new LSL_Float(textColor.A)); | 9398 | res.Add(new LSL_Float(textColor.A)); |
8956 | break; | 9399 | break; |
9400 | |||
8957 | case (int)ScriptBaseClass.PRIM_NAME: | 9401 | case (int)ScriptBaseClass.PRIM_NAME: |
8958 | res.Add(new LSL_String(part.Name)); | 9402 | res.Add(new LSL_String(part.Name)); |
8959 | break; | 9403 | break; |
9404 | |||
8960 | case (int)ScriptBaseClass.PRIM_DESC: | 9405 | case (int)ScriptBaseClass.PRIM_DESC: |
8961 | res.Add(new LSL_String(part.Description)); | 9406 | res.Add(new LSL_String(part.Description)); |
8962 | break; | 9407 | break; |
9408 | |||
8963 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 9409 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
8964 | res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); | 9410 | res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); |
8965 | break; | 9411 | break; |
9412 | |||
8966 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 9413 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
8967 | res.Add(new LSL_Vector(GetPartLocalPos(part))); | 9414 | res.Add(new LSL_Vector(GetPartLocalPos(part))); |
8968 | break; | 9415 | break; |
9416 | |||
9417 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
9418 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
9419 | return res; | ||
9420 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
9421 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
9422 | LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | ||
9423 | res += tres; | ||
9424 | return res; | ||
8969 | } | 9425 | } |
8970 | } | 9426 | } |
8971 | return res; | 9427 | return res; |
@@ -11134,6 +11590,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11134 | 11590 | ||
11135 | LSL_List ret = new LSL_List(); | 11591 | LSL_List ret = new LSL_List(); |
11136 | UUID key = new UUID(); | 11592 | UUID key = new UUID(); |
11593 | |||
11594 | |||
11137 | if (UUID.TryParse(id, out key)) | 11595 | if (UUID.TryParse(id, out key)) |
11138 | { | 11596 | { |
11139 | ScenePresence av = World.GetScenePresence(key); | 11597 | ScenePresence av = World.GetScenePresence(key); |
@@ -11151,13 +11609,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11151 | ret.Add(new LSL_String("")); | 11609 | ret.Add(new LSL_String("")); |
11152 | break; | 11610 | break; |
11153 | case ScriptBaseClass.OBJECT_POS: | 11611 | case ScriptBaseClass.OBJECT_POS: |
11154 | ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); | 11612 | Vector3 avpos; |
11613 | |||
11614 | if (av.ParentID != 0 && av.ParentPart != null) | ||
11615 | { | ||
11616 | avpos = av.OffsetPosition; | ||
11617 | |||
11618 | Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f); | ||
11619 | avpos -= sitOffset; | ||
11620 | |||
11621 | avpos = av.ParentPart.GetWorldPosition() + avpos * av.ParentPart.GetWorldRotation(); | ||
11622 | } | ||
11623 | else | ||
11624 | avpos = av.AbsolutePosition; | ||
11625 | |||
11626 | ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z)); | ||
11155 | break; | 11627 | break; |
11156 | case ScriptBaseClass.OBJECT_ROT: | 11628 | case ScriptBaseClass.OBJECT_ROT: |
11157 | ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); | 11629 | Quaternion avrot = av.Rotation; |
11630 | if (av.ParentID != 0 && av.ParentPart != null) | ||
11631 | { | ||
11632 | avrot = av.ParentPart.GetWorldRotation() * avrot; | ||
11633 | } | ||
11634 | ret.Add(new LSL_Rotation((double)avrot.X, (double)avrot.Y, (double)avrot.Z, (double)avrot.W)); | ||
11158 | break; | 11635 | break; |
11159 | case ScriptBaseClass.OBJECT_VELOCITY: | 11636 | case ScriptBaseClass.OBJECT_VELOCITY: |
11160 | ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); | 11637 | Vector3 avvel = av.Velocity; |
11638 | ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z)); | ||
11161 | break; | 11639 | break; |
11162 | case ScriptBaseClass.OBJECT_OWNER: | 11640 | case ScriptBaseClass.OBJECT_OWNER: |
11163 | ret.Add(new LSL_String(id)); | 11641 | ret.Add(new LSL_String(id)); |
@@ -11213,17 +11691,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11213 | case ScriptBaseClass.OBJECT_NAME: | 11691 | case ScriptBaseClass.OBJECT_NAME: |
11214 | ret.Add(new LSL_String(obj.Name)); | 11692 | ret.Add(new LSL_String(obj.Name)); |
11215 | break; | 11693 | break; |
11216 | case ScriptBaseClass.OBJECT_DESC: | 11694 | case ScriptBaseClass.OBJECT_DESC: |
11217 | ret.Add(new LSL_String(obj.Description)); | 11695 | ret.Add(new LSL_String(obj.Description)); |
11218 | break; | 11696 | break; |
11219 | case ScriptBaseClass.OBJECT_POS: | 11697 | case ScriptBaseClass.OBJECT_POS: |
11220 | ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); | 11698 | Vector3 opos = obj.AbsolutePosition; |
11699 | ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z)); | ||
11221 | break; | 11700 | break; |
11222 | case ScriptBaseClass.OBJECT_ROT: | 11701 | case ScriptBaseClass.OBJECT_ROT: |
11223 | ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); | 11702 | // Quaternion orot = obj.RotationOffset; |
11703 | // ret.Add(new LSL_Rotation(orot.X, orot.Y, orot.Z, orot.W)); | ||
11704 | |||
11705 | LSL_Rotation objrot = GetPartRot(obj); | ||
11706 | ret.Add(objrot); | ||
11224 | break; | 11707 | break; |
11225 | case ScriptBaseClass.OBJECT_VELOCITY: | 11708 | case ScriptBaseClass.OBJECT_VELOCITY: |
11226 | ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); | 11709 | Vector3 ovel = obj.Velocity; |
11710 | ret.Add(new LSL_Vector(ovel.X, ovel.Y, ovel.Z)); | ||
11227 | break; | 11711 | break; |
11228 | case ScriptBaseClass.OBJECT_OWNER: | 11712 | case ScriptBaseClass.OBJECT_OWNER: |
11229 | ret.Add(new LSL_String(obj.OwnerID.ToString())); | 11713 | ret.Add(new LSL_String(obj.OwnerID.ToString())); |
@@ -11257,9 +11741,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11257 | // The value returned in SL for normal prims is prim count | 11741 | // The value returned in SL for normal prims is prim count |
11258 | ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); | 11742 | ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); |
11259 | break; | 11743 | break; |
11260 | // The following 3 costs I have intentionaly coded to return zero. They are part of | 11744 | |
11261 | // "Land Impact" calculations. These calculations are probably not applicable | 11745 | // costs below may need to be diferent for root parts, need to check |
11262 | // to OpenSim and are not yet complete in SL | ||
11263 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11746 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11264 | // The linden calculation is here | 11747 | // The linden calculation is here |
11265 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight | 11748 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight |
@@ -11267,16 +11750,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11267 | ret.Add(new LSL_Float(0)); | 11750 | ret.Add(new LSL_Float(0)); |
11268 | break; | 11751 | break; |
11269 | case ScriptBaseClass.OBJECT_STREAMING_COST: | 11752 | case ScriptBaseClass.OBJECT_STREAMING_COST: |
11270 | // The linden calculation is here | 11753 | // The value returned in SL for normal prims is prim count * 0.06 |
11271 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost | 11754 | ret.Add(new LSL_Float(obj.StreamingCost)); |
11272 | // The value returned in SL for normal prims looks like the prim count * 0.06 | ||
11273 | ret.Add(new LSL_Float(0)); | ||
11274 | break; | 11755 | break; |
11275 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | 11756 | case ScriptBaseClass.OBJECT_PHYSICS_COST: |
11276 | // The linden calculation is here | 11757 | // The value returned in SL for normal prims is prim count |
11277 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics | 11758 | ret.Add(new LSL_Float(obj.PhysicsCost)); |
11278 | // The value returned in SL for normal prims looks like the prim count | ||
11279 | ret.Add(new LSL_Float(0)); | ||
11280 | break; | 11759 | break; |
11281 | default: | 11760 | default: |
11282 | // Invalid or unhandled constant. | 11761 | // Invalid or unhandled constant. |
@@ -11933,9 +12412,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11933 | results.Add(r); | 12412 | results.Add(r); |
11934 | } | 12413 | } |
11935 | 12414 | ||
11936 | // bug: will not detect phantom unless they are physical | 12415 | // TODO: Replace this with a better solution. ObjectIntersection can only |
11937 | // don't use ObjectIntersection because its also bad | 12416 | // detect nonphysical phantoms. They are detected by virtue of being |
11938 | 12417 | // nonphysical (e.g. no PhysActor) so will not conflict with detecting | |
12418 | // physicsl phantoms as done by the physics scene | ||
12419 | // We don't want anything else but phantoms here. | ||
12420 | if (detectPhantom) | ||
12421 | { | ||
12422 | ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, false, false, true); | ||
12423 | foreach (ContactResult r in objectHits) | ||
12424 | results.Add(r); | ||
12425 | } | ||
11939 | } | 12426 | } |
11940 | else | 12427 | else |
11941 | { | 12428 | { |