diff options
Diffstat (limited to 'OpenSim')
3 files changed, 574 insertions, 81 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8fa7880..aab6a49 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2992,10 +2992,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2992 | { | 2992 | { |
2993 | if (!m_rootPart.BlockGrab) | 2993 | if (!m_rootPart.BlockGrab) |
2994 | { | 2994 | { |
2995 | Vector3 llmoveforce = pos - AbsolutePosition; | 2995 | /* Vector3 llmoveforce = pos - AbsolutePosition; |
2996 | Vector3 grabforce = llmoveforce; | 2996 | Vector3 grabforce = llmoveforce; |
2997 | grabforce = (grabforce / 10) * pa.Mass; | 2997 | grabforce = (grabforce / 10) * pa.Mass; |
2998 | pa.AddForce(grabforce, true); | 2998 | */ |
2999 | // empirically convert distance diference to a impulse | ||
3000 | Vector3 grabforce = pos - AbsolutePosition; | ||
3001 | grabforce = grabforce * (pa.Mass/ 10.0f); | ||
3002 | pa.AddForce(grabforce, false); | ||
2999 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); | 3003 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); |
3000 | } | 3004 | } |
3001 | } | 3005 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a810de2..87b4d9f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2383,7 +2383,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2383 | 2383 | ||
2384 | Vector3 up = new Vector3((float)x, (float)y, (float)z); | 2384 | Vector3 up = new Vector3((float)x, (float)y, (float)z); |
2385 | Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; | 2385 | Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; |
2386 | |||
2386 | m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; | 2387 | m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; |
2388 | |||
2389 | // m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset; | ||
2387 | Rotation = sitTargetOrient; | 2390 | Rotation = sitTargetOrient; |
2388 | ParentPosition = part.AbsolutePosition; | 2391 | ParentPosition = part.AbsolutePosition; |
2389 | part.ParentGroup.AddAvatar(UUID); | 2392 | 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 22d62f7..959d928 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7099,7 +7099,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7099 | { | 7099 | { |
7100 | // LSL quaternions can normalize to 0, normal Quaternions can't. | 7100 | // LSL quaternions can normalize to 0, normal Quaternions can't. |
7101 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) | 7101 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) |
7102 | rot.z = 1; // ZERO_ROTATION = 0,0,0,1 | 7102 | rot.s = 1; // ZERO_ROTATION = 0,0,0,1 |
7103 | 7103 | ||
7104 | part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); | 7104 | part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); |
7105 | part.SitTargetOrientation = Rot2Quaternion(rot); | 7105 | part.SitTargetOrientation = Rot2Quaternion(rot); |
@@ -7902,73 +7902,231 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7902 | ScriptSleep(200); | 7902 | ScriptSleep(200); |
7903 | } | 7903 | } |
7904 | 7904 | ||
7905 | // vector up using libomv (c&p from sop ) | ||
7906 | // vector up rotated by r | ||
7907 | private Vector3 Zrot(Quaternion r) | ||
7908 | { | ||
7909 | double x, y, z, m; | ||
7910 | |||
7911 | m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W; | ||
7912 | if (Math.Abs(1.0 - m) > 0.000001) | ||
7913 | { | ||
7914 | m = 1.0 / Math.Sqrt(m); | ||
7915 | r.X *= (float)m; | ||
7916 | r.Y *= (float)m; | ||
7917 | r.Z *= (float)m; | ||
7918 | r.W *= (float)m; | ||
7919 | } | ||
7920 | |||
7921 | x = 2 * (r.X * r.Z + r.Y * r.W); | ||
7922 | y = 2 * (-r.X * r.W + r.Y * r.Z); | ||
7923 | z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W; | ||
7924 | |||
7925 | return new Vector3((float)x, (float)y, (float)z); | ||
7926 | } | ||
7927 | |||
7905 | protected void SetPrimParams(ScenePresence av, LSL_List rules) | 7928 | protected void SetPrimParams(ScenePresence av, LSL_List rules) |
7906 | { | 7929 | { |
7907 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. | 7930 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. |
7908 | //We only support PRIM_POSITION and PRIM_ROTATION | ||
7909 | 7931 | ||
7910 | int idx = 0; | 7932 | int idx = 0; |
7933 | SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used | ||
7911 | 7934 | ||
7912 | while (idx < rules.Length) | 7935 | bool positionChanged = false; |
7936 | Vector3 finalPos = Vector3.Zero; | ||
7937 | |||
7938 | try | ||
7913 | { | 7939 | { |
7914 | int code = rules.GetLSLIntegerItem(idx++); | 7940 | while (idx < rules.Length) |
7941 | { | ||
7942 | int code = rules.GetLSLIntegerItem(idx++); | ||
7915 | 7943 | ||
7916 | int remain = rules.Length - idx; | 7944 | int remain = rules.Length - idx; |
7917 | 7945 | ||
7918 | switch (code) | 7946 | switch (code) |
7919 | { | 7947 | { |
7920 | case (int)ScriptBaseClass.PRIM_POSITION: | 7948 | // a avatar is a child |
7921 | { | 7949 | case (int)ScriptBaseClass.PRIM_POSITION: |
7950 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
7951 | { | ||
7952 | if (remain < 1) | ||
7953 | return; | ||
7954 | LSL_Vector v; | ||
7955 | v = rules.GetVector3Item(idx++); | ||
7956 | |||
7957 | if (sitpart == null) | ||
7958 | break; | ||
7959 | |||
7960 | Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position | ||
7961 | |||
7962 | if (sitpart != sitpart.ParentGroup.RootPart) | ||
7963 | { | ||
7964 | pos -= sitpart.OffsetPosition; // remove sit part offset | ||
7965 | Quaternion rot = sitpart.RotationOffset; | ||
7966 | pos *= Quaternion.Conjugate(rot); // removed sit part rotation | ||
7967 | } | ||
7968 | Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f); | ||
7969 | pos += sitOffset; | ||
7970 | |||
7971 | finalPos = pos; | ||
7972 | positionChanged = true; | ||
7973 | } | ||
7974 | break; | ||
7975 | |||
7976 | case (int)ScriptBaseClass.PRIM_ROTATION: | ||
7977 | { | ||
7978 | if (remain < 1) | ||
7979 | return; | ||
7980 | |||
7981 | if (sitpart == null) | ||
7982 | break; | ||
7983 | |||
7984 | LSL_Rotation r = rules.GetQuaternionItem(idx++); | ||
7985 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation | ||
7986 | |||
7987 | // need to replicate SL bug | ||
7988 | SceneObjectGroup sitgrp = sitpart.ParentGroup; | ||
7989 | if (sitgrp != null && sitgrp.RootPart != sitpart) | ||
7990 | { | ||
7991 | rot = sitgrp.RootPart.RotationOffset * rot; | ||
7992 | } | ||
7993 | |||
7994 | Quaternion srot = sitpart.RotationOffset; | ||
7995 | rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation | ||
7996 | av.Rotation = rot; | ||
7997 | av.SendAvatarDataToAllAgents(); | ||
7998 | } | ||
7999 | break; | ||
8000 | |||
8001 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
8002 | { | ||
8003 | if (remain < 1) | ||
8004 | return; | ||
8005 | |||
8006 | if (sitpart == null) | ||
8007 | break; | ||
8008 | |||
8009 | LSL_Rotation r = rules.GetQuaternionItem(idx++); | ||
8010 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation | ||
8011 | if (sitpart != sitpart.ParentGroup.RootPart) | ||
8012 | { | ||
8013 | Quaternion srot = sitpart.RotationOffset; | ||
8014 | rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation | ||
8015 | } | ||
8016 | av.Rotation = rot; | ||
8017 | av.SendAvatarDataToAllAgents(); | ||
8018 | } | ||
8019 | break; | ||
8020 | |||
8021 | // parse rest doing nothing but number of parameters error check | ||
8022 | case (int)ScriptBaseClass.PRIM_SIZE: | ||
8023 | case (int)ScriptBaseClass.PRIM_MATERIAL: | ||
8024 | case (int)ScriptBaseClass.PRIM_PHANTOM: | ||
8025 | case (int)ScriptBaseClass.PRIM_PHYSICS: | ||
8026 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | ||
8027 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | ||
8028 | case (int)ScriptBaseClass.PRIM_NAME: | ||
8029 | case (int)ScriptBaseClass.PRIM_DESC: | ||
7922 | if (remain < 1) | 8030 | if (remain < 1) |
7923 | return; | 8031 | return; |
7924 | LSL_Vector v; | 8032 | idx++; |
7925 | v = rules.GetVector3Item(idx++); | 8033 | break; |
7926 | 8034 | ||
7927 | SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); | 8035 | case (int)ScriptBaseClass.PRIM_GLOW: |
7928 | if (part == null) | 8036 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
7929 | break; | 8037 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
8038 | if (remain < 2) | ||
8039 | return; | ||
8040 | idx += 2; | ||
8041 | break; | ||
7930 | 8042 | ||
7931 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; | 8043 | case (int)ScriptBaseClass.PRIM_TYPE: |
7932 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; | 8044 | if (remain < 3) |
7933 | if (llGetLinkNumber() > 1) | 8045 | return; |
8046 | code = (int)rules.GetLSLIntegerItem(idx++); | ||
8047 | remain = rules.Length - idx; | ||
8048 | switch (code) | ||
7934 | { | 8049 | { |
7935 | localRot = llGetLocalRot(); | 8050 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: |
7936 | localPos = llGetLocalPos(); | 8051 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: |
8052 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | ||
8053 | if (remain < 6) | ||
8054 | return; | ||
8055 | idx += 6; | ||
8056 | break; | ||
8057 | |||
8058 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | ||
8059 | if (remain < 5) | ||
8060 | return; | ||
8061 | idx += 5; | ||
8062 | break; | ||
8063 | |||
8064 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | ||
8065 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | ||
8066 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | ||
8067 | if (remain < 11) | ||
8068 | return; | ||
8069 | idx += 11; | ||
8070 | break; | ||
8071 | |||
8072 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | ||
8073 | if (remain < 2) | ||
8074 | return; | ||
8075 | idx += 2; | ||
8076 | break; | ||
7937 | } | 8077 | } |
8078 | break; | ||
7938 | 8079 | ||
7939 | v -= localPos; | 8080 | case (int)ScriptBaseClass.PRIM_COLOR: |
7940 | v /= localRot; | 8081 | case (int)ScriptBaseClass.PRIM_TEXT: |
8082 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | ||
8083 | case (int)ScriptBaseClass.PRIM_OMEGA: | ||
8084 | if (remain < 3) | ||
8085 | return; | ||
8086 | idx += 3; | ||
8087 | break; | ||
7941 | 8088 | ||
7942 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); | 8089 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
7943 | 8090 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | |
7944 | v = v + 2 * sitOffset; | 8091 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: |
8092 | if (remain < 5) | ||
8093 | return; | ||
8094 | idx += 5; | ||
8095 | break; | ||
7945 | 8096 | ||
7946 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); | 8097 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
7947 | av.SendAvatarDataToAllAgents(); | 8098 | if (remain < 7) |
8099 | return; | ||
7948 | 8100 | ||
7949 | } | 8101 | idx += 7; |
7950 | break; | 8102 | break; |
7951 | 8103 | ||
7952 | case (int)ScriptBaseClass.PRIM_ROTATION: | 8104 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
7953 | { | 8105 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
7954 | if (remain < 1) | ||
7955 | return; | 8106 | return; |
7956 | 8107 | ||
7957 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; | 8108 | if (positionChanged) |
7958 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; | ||
7959 | if (llGetLinkNumber() > 1) | ||
7960 | { | 8109 | { |
7961 | localRot = llGetLocalRot(); | 8110 | positionChanged = false; |
7962 | localPos = llGetLocalPos(); | 8111 | av.OffsetPosition = finalPos; |
8112 | av.SendAvatarDataToAllAgents(); | ||
7963 | } | 8113 | } |
7964 | 8114 | ||
7965 | LSL_Rotation r; | 8115 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); |
7966 | r = rules.GetQuaternionItem(idx++); | 8116 | LSL_List new_rules = rules.GetSublist(idx, -1); |
7967 | r = r * llGetRootRotation() / localRot; | 8117 | setLinkPrimParams((int)new_linknumber, new_rules); |
7968 | av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); | 8118 | return; |
7969 | av.SendAvatarDataToAllAgents(); | 8119 | } |
7970 | } | 8120 | } |
7971 | break; | 8121 | } |
8122 | |||
8123 | finally | ||
8124 | { | ||
8125 | if (positionChanged) | ||
8126 | { | ||
8127 | av.OffsetPosition = finalPos; | ||
8128 | av.SendAvatarDataToAllAgents(); | ||
8129 | positionChanged = false; | ||
7972 | } | 8130 | } |
7973 | } | 8131 | } |
7974 | } | 8132 | } |
@@ -7980,6 +8138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7980 | 8138 | ||
7981 | int idx = 0; | 8139 | int idx = 0; |
7982 | 8140 | ||
8141 | SceneObjectGroup parentgrp = part.ParentGroup; | ||
8142 | |||
7983 | bool positionChanged = false; | 8143 | bool positionChanged = false; |
7984 | LSL_Vector currentPosition = GetPartLocalPos(part); | 8144 | LSL_Vector currentPosition = GetPartLocalPos(part); |
7985 | 8145 | ||
@@ -8002,8 +8162,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8002 | return; | 8162 | return; |
8003 | 8163 | ||
8004 | v=rules.GetVector3Item(idx++); | 8164 | v=rules.GetVector3Item(idx++); |
8005 | positionChanged = true; | ||
8006 | currentPosition = GetSetPosTarget(part, v, currentPosition); | 8165 | currentPosition = GetSetPosTarget(part, v, currentPosition); |
8166 | positionChanged = true; | ||
8007 | 8167 | ||
8008 | break; | 8168 | break; |
8009 | case (int)ScriptBaseClass.PRIM_SIZE: | 8169 | case (int)ScriptBaseClass.PRIM_SIZE: |
@@ -8019,8 +8179,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8019 | return; | 8179 | return; |
8020 | 8180 | ||
8021 | LSL_Rotation q = rules.GetQuaternionItem(idx++); | 8181 | LSL_Rotation q = rules.GetQuaternionItem(idx++); |
8182 | SceneObjectPart rootPart = parentgrp.RootPart; | ||
8022 | // try to let this work as in SL... | 8183 | // try to let this work as in SL... |
8023 | if (part.ParentID == 0) | 8184 | if (rootPart == part) |
8024 | { | 8185 | { |
8025 | // special case: If we are root, rotate complete SOG to new rotation | 8186 | // special case: If we are root, rotate complete SOG to new rotation |
8026 | SetRot(part, Rot2Quaternion(q)); | 8187 | SetRot(part, Rot2Quaternion(q)); |
@@ -8028,7 +8189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8028 | else | 8189 | else |
8029 | { | 8190 | { |
8030 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | 8191 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
8031 | SceneObjectPart rootPart = part.ParentGroup.RootPart; | 8192 | // sounds like sl bug that we need to replicate |
8032 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); | 8193 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); |
8033 | } | 8194 | } |
8034 | 8195 | ||
@@ -8281,7 +8442,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8281 | return; | 8442 | return; |
8282 | 8443 | ||
8283 | string ph = rules.Data[idx++].ToString(); | 8444 | string ph = rules.Data[idx++].ToString(); |
8284 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); | 8445 | parentgrp.ScriptSetPhantomStatus(ph.Equals("1")); |
8285 | 8446 | ||
8286 | break; | 8447 | break; |
8287 | 8448 | ||
@@ -8334,7 +8495,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8334 | return; | 8495 | return; |
8335 | string temp = rules.Data[idx++].ToString(); | 8496 | string temp = rules.Data[idx++].ToString(); |
8336 | 8497 | ||
8337 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); | 8498 | parentgrp.ScriptSetTemporaryStatus(temp.Equals("1")); |
8338 | 8499 | ||
8339 | break; | 8500 | break; |
8340 | 8501 | ||
@@ -8384,13 +8545,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8384 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | 8545 | LSL_Float gain = rules.GetLSLFloatItem(idx++); |
8385 | TargetOmega(part, axis, (double)spinrate, (double)gain); | 8546 | TargetOmega(part, axis, (double)spinrate, (double)gain); |
8386 | break; | 8547 | break; |
8548 | |||
8387 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 8549 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
8388 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 8550 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
8389 | return; | 8551 | return; |
8552 | |||
8553 | // do a pending position change before jumping to other part/avatar | ||
8554 | if (positionChanged) | ||
8555 | { | ||
8556 | positionChanged = false; | ||
8557 | if (parentgrp == null) | ||
8558 | return; | ||
8559 | |||
8560 | if (parentgrp.RootPart == part) | ||
8561 | { | ||
8562 | |||
8563 | Util.FireAndForget(delegate(object x) | ||
8564 | { | ||
8565 | parentgrp.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | ||
8566 | }); | ||
8567 | } | ||
8568 | else | ||
8569 | { | ||
8570 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | ||
8571 | parentgrp.HasGroupChanged = true; | ||
8572 | parentgrp.ScheduleGroupForTerseUpdate(); | ||
8573 | } | ||
8574 | } | ||
8575 | |||
8390 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | 8576 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); |
8391 | LSL_List new_rules = rules.GetSublist(idx, -1); | 8577 | LSL_List new_rules = rules.GetSublist(idx, -1); |
8392 | setLinkPrimParams((int)new_linknumber, new_rules); | 8578 | setLinkPrimParams((int)new_linknumber, new_rules); |
8393 | |||
8394 | return; | 8579 | return; |
8395 | } | 8580 | } |
8396 | } | 8581 | } |
@@ -8415,24 +8600,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8415 | } | 8600 | } |
8416 | } | 8601 | } |
8417 | } | 8602 | } |
8418 | |||
8419 | if (positionChanged) | ||
8420 | { | ||
8421 | if (part.ParentGroup.RootPart == part) | ||
8422 | { | ||
8423 | SceneObjectGroup parent = part.ParentGroup; | ||
8424 | Util.FireAndForget(delegate(object x) { | ||
8425 | parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | ||
8426 | }); | ||
8427 | } | ||
8428 | else | ||
8429 | { | ||
8430 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | ||
8431 | SceneObjectGroup parent = part.ParentGroup; | ||
8432 | parent.HasGroupChanged = true; | ||
8433 | parent.ScheduleGroupForTerseUpdate(); | ||
8434 | } | ||
8435 | } | ||
8436 | } | 8603 | } |
8437 | 8604 | ||
8438 | public LSL_String llStringToBase64(string str) | 8605 | public LSL_String llStringToBase64(string str) |
@@ -8729,16 +8896,291 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8729 | { | 8896 | { |
8730 | m_host.AddScriptLPS(1); | 8897 | m_host.AddScriptLPS(1); |
8731 | 8898 | ||
8899 | // acording to SL wiki this must indicate a single link number or link_root or link_this. | ||
8900 | // keep other options as before | ||
8901 | |||
8732 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 8902 | List<SceneObjectPart> parts = GetLinkParts(linknumber); |
8903 | List<ScenePresence> avatars = GetLinkAvatars(linknumber); | ||
8733 | 8904 | ||
8734 | LSL_List res = new LSL_List(); | 8905 | LSL_List res = new LSL_List(); |
8735 | 8906 | ||
8736 | foreach (var part in parts) | 8907 | if (parts.Count > 0) |
8908 | { | ||
8909 | foreach (var part in parts) | ||
8910 | { | ||
8911 | LSL_List partRes = GetLinkPrimitiveParams(part, rules); | ||
8912 | res += partRes; | ||
8913 | } | ||
8914 | } | ||
8915 | if (avatars.Count > 0) | ||
8737 | { | 8916 | { |
8738 | LSL_List partRes = GetLinkPrimitiveParams(part, rules); | 8917 | foreach (ScenePresence avatar in avatars) |
8739 | res += partRes; | 8918 | { |
8919 | LSL_List avaRes = GetLinkPrimitiveParams(avatar, rules); | ||
8920 | res += avaRes; | ||
8921 | } | ||
8740 | } | 8922 | } |
8923 | return res; | ||
8924 | } | ||
8925 | |||
8926 | public LSL_List GetLinkPrimitiveParams(ScenePresence avatar, LSL_List rules) | ||
8927 | { | ||
8928 | // avatars case | ||
8929 | // replies as SL wiki | ||
8930 | |||
8931 | LSL_List res = new LSL_List(); | ||
8932 | // SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed | ||
8933 | SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone?? | ||
8934 | |||
8935 | int idx = 0; | ||
8936 | while (idx < rules.Length) | ||
8937 | { | ||
8938 | int code = (int)rules.GetLSLIntegerItem(idx++); | ||
8939 | int remain = rules.Length - idx; | ||
8741 | 8940 | ||
8941 | switch (code) | ||
8942 | { | ||
8943 | case (int)ScriptBaseClass.PRIM_MATERIAL: | ||
8944 | res.Add(new LSL_Integer((int)SOPMaterialData.SopMaterial.Flesh)); | ||
8945 | break; | ||
8946 | |||
8947 | case (int)ScriptBaseClass.PRIM_PHYSICS: | ||
8948 | res.Add(new LSL_Integer(0)); | ||
8949 | break; | ||
8950 | |||
8951 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | ||
8952 | res.Add(new LSL_Integer(0)); | ||
8953 | break; | ||
8954 | |||
8955 | case (int)ScriptBaseClass.PRIM_PHANTOM: | ||
8956 | res.Add(new LSL_Integer(0)); | ||
8957 | break; | ||
8958 | |||
8959 | case (int)ScriptBaseClass.PRIM_POSITION: | ||
8960 | |||
8961 | Vector3 pos = avatar.OffsetPosition; | ||
8962 | |||
8963 | Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f); | ||
8964 | pos -= sitOffset; | ||
8965 | |||
8966 | if( sitPart != null) | ||
8967 | pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation(); | ||
8968 | |||
8969 | res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); | ||
8970 | break; | ||
8971 | |||
8972 | case (int)ScriptBaseClass.PRIM_SIZE: | ||
8973 | // as in llGetAgentSize above | ||
8974 | res.Add(new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight)); | ||
8975 | break; | ||
8976 | |||
8977 | case (int)ScriptBaseClass.PRIM_ROTATION: | ||
8978 | Quaternion rot = avatar.Rotation; | ||
8979 | if (sitPart != null) | ||
8980 | { | ||
8981 | rot = sitPart.GetWorldRotation() * rot; // apply sit part world rotation | ||
8982 | } | ||
8983 | |||
8984 | res.Add(new LSL_Rotation (rot.X, rot.Y, rot.Z, rot.W)); | ||
8985 | break; | ||
8986 | |||
8987 | case (int)ScriptBaseClass.PRIM_TYPE: | ||
8988 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX)); | ||
8989 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT)); | ||
8990 | res.Add(new LSL_Vector(0f,1.0f,0f)); | ||
8991 | res.Add(new LSL_Float(0.0f)); | ||
8992 | res.Add(new LSL_Vector(0, 0, 0)); | ||
8993 | res.Add(new LSL_Vector(1.0f,1.0f,0f)); | ||
8994 | res.Add(new LSL_Vector(0, 0, 0)); | ||
8995 | break; | ||
8996 | |||
8997 | case (int)ScriptBaseClass.PRIM_TEXTURE: | ||
8998 | if (remain < 1) | ||
8999 | return res; | ||
9000 | |||
9001 | int face = (int)rules.GetLSLIntegerItem(idx++); | ||
9002 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9003 | { | ||
9004 | for (face = 0; face < 21; face++) | ||
9005 | { | ||
9006 | res.Add(new LSL_String("")); | ||
9007 | res.Add(new LSL_Vector(0,0,0)); | ||
9008 | res.Add(new LSL_Vector(0,0,0)); | ||
9009 | res.Add(new LSL_Float(0.0)); | ||
9010 | } | ||
9011 | } | ||
9012 | else | ||
9013 | { | ||
9014 | if (face >= 0 && face < 21) | ||
9015 | { | ||
9016 | res.Add(new LSL_String("")); | ||
9017 | res.Add(new LSL_Vector(0,0,0)); | ||
9018 | res.Add(new LSL_Vector(0,0,0)); | ||
9019 | res.Add(new LSL_Float(0.0)); | ||
9020 | } | ||
9021 | } | ||
9022 | break; | ||
9023 | |||
9024 | case (int)ScriptBaseClass.PRIM_COLOR: | ||
9025 | if (remain < 1) | ||
9026 | return res; | ||
9027 | |||
9028 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
9029 | |||
9030 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9031 | { | ||
9032 | for (face = 0; face < 21; face++) | ||
9033 | { | ||
9034 | res.Add(new LSL_Vector(0,0,0)); | ||
9035 | res.Add(new LSL_Float(0)); | ||
9036 | } | ||
9037 | } | ||
9038 | else | ||
9039 | { | ||
9040 | res.Add(new LSL_Vector(0,0,0)); | ||
9041 | res.Add(new LSL_Float(0)); | ||
9042 | } | ||
9043 | break; | ||
9044 | |||
9045 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | ||
9046 | if (remain < 1) | ||
9047 | return res; | ||
9048 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
9049 | |||
9050 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9051 | { | ||
9052 | for (face = 0; face < 21; face++) | ||
9053 | { | ||
9054 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); | ||
9055 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); | ||
9056 | } | ||
9057 | } | ||
9058 | else | ||
9059 | { | ||
9060 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); | ||
9061 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); | ||
9062 | } | ||
9063 | break; | ||
9064 | |||
9065 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | ||
9066 | if (remain < 1) | ||
9067 | return res; | ||
9068 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
9069 | |||
9070 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9071 | { | ||
9072 | for (face = 0; face < 21; face++) | ||
9073 | { | ||
9074 | res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); | ||
9075 | } | ||
9076 | } | ||
9077 | else | ||
9078 | { | ||
9079 | res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); | ||
9080 | } | ||
9081 | break; | ||
9082 | |||
9083 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | ||
9084 | res.Add(new LSL_Integer(0)); | ||
9085 | res.Add(new LSL_Integer(0));// softness | ||
9086 | res.Add(new LSL_Float(0.0f)); // gravity | ||
9087 | res.Add(new LSL_Float(0.0f)); // friction | ||
9088 | res.Add(new LSL_Float(0.0f)); // wind | ||
9089 | res.Add(new LSL_Float(0.0f)); // tension | ||
9090 | res.Add(new LSL_Vector(0f,0f,0f)); | ||
9091 | break; | ||
9092 | |||
9093 | case (int)ScriptBaseClass.PRIM_TEXGEN: | ||
9094 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) | ||
9095 | if (remain < 1) | ||
9096 | return res; | ||
9097 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
9098 | |||
9099 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9100 | { | ||
9101 | for (face = 0; face < 21; face++) | ||
9102 | { | ||
9103 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); | ||
9104 | } | ||
9105 | } | ||
9106 | else | ||
9107 | { | ||
9108 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); | ||
9109 | } | ||
9110 | break; | ||
9111 | |||
9112 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | ||
9113 | res.Add(new LSL_Integer(0)); | ||
9114 | res.Add(new LSL_Vector(0f,0f,0f)); | ||
9115 | res.Add(new LSL_Float(0f)); // intensity | ||
9116 | res.Add(new LSL_Float(0f)); // radius | ||
9117 | res.Add(new LSL_Float(0f)); // falloff | ||
9118 | break; | ||
9119 | |||
9120 | case (int)ScriptBaseClass.PRIM_GLOW: | ||
9121 | if (remain < 1) | ||
9122 | return res; | ||
9123 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
9124 | |||
9125 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9126 | { | ||
9127 | for (face = 0; face < 21; face++) | ||
9128 | { | ||
9129 | res.Add(new LSL_Float(0f)); | ||
9130 | } | ||
9131 | } | ||
9132 | else | ||
9133 | { | ||
9134 | res.Add(new LSL_Float(0f)); | ||
9135 | } | ||
9136 | break; | ||
9137 | |||
9138 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
9139 | res.Add(new LSL_String("")); | ||
9140 | res.Add(new LSL_Vector(0f,0f,0f)); | ||
9141 | res.Add(new LSL_Float(1.0f)); | ||
9142 | break; | ||
9143 | |||
9144 | case (int)ScriptBaseClass.PRIM_NAME: | ||
9145 | res.Add(new LSL_String(avatar.Name)); | ||
9146 | break; | ||
9147 | |||
9148 | case (int)ScriptBaseClass.PRIM_DESC: | ||
9149 | res.Add(new LSL_String("")); | ||
9150 | break; | ||
9151 | |||
9152 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
9153 | Quaternion lrot = avatar.Rotation; | ||
9154 | |||
9155 | if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) | ||
9156 | { | ||
9157 | lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset | ||
9158 | } | ||
9159 | res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W)); | ||
9160 | break; | ||
9161 | |||
9162 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
9163 | Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part | ||
9164 | Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f); | ||
9165 | lpos -= lsitOffset; | ||
9166 | |||
9167 | if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) | ||
9168 | { | ||
9169 | lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim | ||
9170 | } | ||
9171 | res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z)); | ||
9172 | break; | ||
9173 | |||
9174 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
9175 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
9176 | return res; | ||
9177 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
9178 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
9179 | |||
9180 | res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | ||
9181 | return res; | ||
9182 | } | ||
9183 | } | ||
8742 | return res; | 9184 | return res; |
8743 | } | 9185 | } |
8744 | 9186 | ||
@@ -9128,6 +9570,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9128 | res.Add(new LSL_Float(primglow)); | 9570 | res.Add(new LSL_Float(primglow)); |
9129 | } | 9571 | } |
9130 | break; | 9572 | break; |
9573 | |||
9131 | case (int)ScriptBaseClass.PRIM_TEXT: | 9574 | case (int)ScriptBaseClass.PRIM_TEXT: |
9132 | Color4 textColor = part.GetTextColor(); | 9575 | Color4 textColor = part.GetTextColor(); |
9133 | res.Add(new LSL_String(part.Text)); | 9576 | res.Add(new LSL_String(part.Text)); |
@@ -9136,18 +9579,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9136 | textColor.B)); | 9579 | textColor.B)); |
9137 | res.Add(new LSL_Float(textColor.A)); | 9580 | res.Add(new LSL_Float(textColor.A)); |
9138 | break; | 9581 | break; |
9582 | |||
9139 | case (int)ScriptBaseClass.PRIM_NAME: | 9583 | case (int)ScriptBaseClass.PRIM_NAME: |
9140 | res.Add(new LSL_String(part.Name)); | 9584 | res.Add(new LSL_String(part.Name)); |
9141 | break; | 9585 | break; |
9586 | |||
9142 | case (int)ScriptBaseClass.PRIM_DESC: | 9587 | case (int)ScriptBaseClass.PRIM_DESC: |
9143 | res.Add(new LSL_String(part.Description)); | 9588 | res.Add(new LSL_String(part.Description)); |
9144 | break; | 9589 | break; |
9590 | |||
9145 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 9591 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
9146 | res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); | 9592 | res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); |
9147 | break; | 9593 | break; |
9594 | |||
9148 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 9595 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
9149 | res.Add(new LSL_Vector(GetPartLocalPos(part))); | 9596 | res.Add(new LSL_Vector(GetPartLocalPos(part))); |
9150 | break; | 9597 | break; |
9598 | |||
9599 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
9600 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
9601 | return res; | ||
9602 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
9603 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
9604 | LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | ||
9605 | res += tres; | ||
9606 | return res; | ||
9151 | } | 9607 | } |
9152 | } | 9608 | } |
9153 | return res; | 9609 | return res; |
@@ -11345,6 +11801,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11345 | 11801 | ||
11346 | LSL_List ret = new LSL_List(); | 11802 | LSL_List ret = new LSL_List(); |
11347 | UUID key = new UUID(); | 11803 | UUID key = new UUID(); |
11804 | |||
11805 | |||
11348 | if (UUID.TryParse(id, out key)) | 11806 | if (UUID.TryParse(id, out key)) |
11349 | { | 11807 | { |
11350 | ScenePresence av = World.GetScenePresence(key); | 11808 | ScenePresence av = World.GetScenePresence(key); |
@@ -11362,13 +11820,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11362 | ret.Add(new LSL_String("")); | 11820 | ret.Add(new LSL_String("")); |
11363 | break; | 11821 | break; |
11364 | case ScriptBaseClass.OBJECT_POS: | 11822 | case ScriptBaseClass.OBJECT_POS: |
11365 | ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); | 11823 | Vector3 avpos; |
11824 | |||
11825 | if (av.ParentID != 0 && av.ParentPart != null) | ||
11826 | { | ||
11827 | avpos = av.OffsetPosition; | ||
11828 | |||
11829 | Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f); | ||
11830 | avpos -= sitOffset; | ||
11831 | |||
11832 | avpos = av.ParentPart.GetWorldPosition() + avpos * av.ParentPart.GetWorldRotation(); | ||
11833 | } | ||
11834 | else | ||
11835 | avpos = av.AbsolutePosition; | ||
11836 | |||
11837 | ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z)); | ||
11366 | break; | 11838 | break; |
11367 | case ScriptBaseClass.OBJECT_ROT: | 11839 | case ScriptBaseClass.OBJECT_ROT: |
11368 | ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); | 11840 | Quaternion avrot = av.Rotation; |
11841 | if (av.ParentID != 0 && av.ParentPart != null) | ||
11842 | { | ||
11843 | avrot = av.ParentPart.GetWorldRotation() * avrot; | ||
11844 | } | ||
11845 | ret.Add(new LSL_Rotation((double)avrot.X, (double)avrot.Y, (double)avrot.Z, (double)avrot.W)); | ||
11369 | break; | 11846 | break; |
11370 | case ScriptBaseClass.OBJECT_VELOCITY: | 11847 | case ScriptBaseClass.OBJECT_VELOCITY: |
11371 | ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); | 11848 | Vector3 avvel = av.Velocity; |
11849 | ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z)); | ||
11372 | break; | 11850 | break; |
11373 | case ScriptBaseClass.OBJECT_OWNER: | 11851 | case ScriptBaseClass.OBJECT_OWNER: |
11374 | ret.Add(new LSL_String(id)); | 11852 | ret.Add(new LSL_String(id)); |
@@ -11424,17 +11902,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11424 | case ScriptBaseClass.OBJECT_NAME: | 11902 | case ScriptBaseClass.OBJECT_NAME: |
11425 | ret.Add(new LSL_String(obj.Name)); | 11903 | ret.Add(new LSL_String(obj.Name)); |
11426 | break; | 11904 | break; |
11427 | case ScriptBaseClass.OBJECT_DESC: | 11905 | case ScriptBaseClass.OBJECT_DESC: |
11428 | ret.Add(new LSL_String(obj.Description)); | 11906 | ret.Add(new LSL_String(obj.Description)); |
11429 | break; | 11907 | break; |
11430 | case ScriptBaseClass.OBJECT_POS: | 11908 | case ScriptBaseClass.OBJECT_POS: |
11431 | ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); | 11909 | Vector3 opos = obj.AbsolutePosition; |
11910 | ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z)); | ||
11432 | break; | 11911 | break; |
11433 | case ScriptBaseClass.OBJECT_ROT: | 11912 | case ScriptBaseClass.OBJECT_ROT: |
11434 | ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); | 11913 | // Quaternion orot = obj.RotationOffset; |
11914 | // ret.Add(new LSL_Rotation(orot.X, orot.Y, orot.Z, orot.W)); | ||
11915 | |||
11916 | LSL_Rotation objrot = GetPartRot(obj); | ||
11917 | ret.Add(objrot); | ||
11435 | break; | 11918 | break; |
11436 | case ScriptBaseClass.OBJECT_VELOCITY: | 11919 | case ScriptBaseClass.OBJECT_VELOCITY: |
11437 | ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); | 11920 | Vector3 ovel = obj.Velocity; |
11921 | ret.Add(new LSL_Vector(ovel.X, ovel.Y, ovel.Z)); | ||
11438 | break; | 11922 | break; |
11439 | case ScriptBaseClass.OBJECT_OWNER: | 11923 | case ScriptBaseClass.OBJECT_OWNER: |
11440 | ret.Add(new LSL_String(obj.OwnerID.ToString())); | 11924 | ret.Add(new LSL_String(obj.OwnerID.ToString())); |
@@ -11472,17 +11956,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11472 | // The value returned in SL for normal prims is prim count | 11956 | // The value returned in SL for normal prims is prim count |
11473 | ret.Add(new LSL_Integer(0)); | 11957 | ret.Add(new LSL_Integer(0)); |
11474 | break; | 11958 | break; |
11959 | |||
11960 | // costs below may need to be diferent for root parts, need to check | ||
11475 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11961 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11476 | // The value returned in SL for normal prims is prim count | 11962 | // The value returned in SL for normal prims is prim count |
11477 | ret.Add(new LSL_Float(0)); | 11963 | ret.Add(new LSL_Float(0)); |
11478 | break; | 11964 | break; |
11479 | case ScriptBaseClass.OBJECT_STREAMING_COST: | 11965 | case ScriptBaseClass.OBJECT_STREAMING_COST: |
11480 | // The value returned in SL for normal prims is prim count * 0.06 | 11966 | // The value returned in SL for normal prims is prim count * 0.06 |
11481 | ret.Add(new LSL_Float(0)); | 11967 | ret.Add(new LSL_Float(obj.StreamingCost)); |
11482 | break; | 11968 | break; |
11483 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | 11969 | case ScriptBaseClass.OBJECT_PHYSICS_COST: |
11484 | // The value returned in SL for normal prims is prim count | 11970 | // The value returned in SL for normal prims is prim count |
11485 | ret.Add(new LSL_Float(0)); | 11971 | ret.Add(new LSL_Float(obj.PhysicsCost)); |
11486 | break; | 11972 | break; |
11487 | default: | 11973 | default: |
11488 | // Invalid or unhandled constant. | 11974 | // Invalid or unhandled constant. |