diff options
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 384 |
1 files changed, 210 insertions, 174 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4f6803f..ec4f62f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7902,196 +7902,223 @@ 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 | 7931 | ||
7909 | int idx = 0; | 7932 | int idx = 0; |
7933 | SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used | ||
7910 | 7934 | ||
7911 | while (idx < rules.Length) | 7935 | bool positionChanged = false; |
7912 | { | 7936 | Vector3 finalPos = Vector3.Zero; |
7913 | int code = rules.GetLSLIntegerItem(idx++); | ||
7914 | |||
7915 | int remain = rules.Length - idx; | ||
7916 | 7937 | ||
7917 | switch (code) | 7938 | try |
7939 | { | ||
7940 | while (idx < rules.Length) | ||
7918 | { | 7941 | { |
7919 | case (int)ScriptBaseClass.PRIM_POSITION: | 7942 | int code = rules.GetLSLIntegerItem(idx++); |
7920 | { | ||
7921 | if (remain < 1) | ||
7922 | return; | ||
7923 | LSL_Vector v; | ||
7924 | v = rules.GetVector3Item(idx++); | ||
7925 | 7943 | ||
7926 | SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); | 7944 | int remain = rules.Length - idx; |
7927 | if (part == null) | ||
7928 | break; | ||
7929 | 7945 | ||
7930 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; | 7946 | switch (code) |
7931 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; | 7947 | { |
7932 | if (llGetLinkNumber() > 1) | 7948 | // a avatar is a child |
7949 | case (int)ScriptBaseClass.PRIM_POSITION: | ||
7950 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
7933 | { | 7951 | { |
7934 | localRot = llGetLocalRot(); | 7952 | if (remain < 1) |
7935 | localPos = llGetLocalPos(); | 7953 | return; |
7936 | } | 7954 | LSL_Vector v; |
7937 | 7955 | v = rules.GetVector3Item(idx++); | |
7938 | v -= localPos; | ||
7939 | v /= localRot; | ||
7940 | 7956 | ||
7941 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); | 7957 | if (sitpart == null) |
7958 | break; | ||
7942 | 7959 | ||
7943 | v = v + 2 * sitOffset; | 7960 | Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position |
7944 | 7961 | ||
7945 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); | 7962 | pos -= sitpart.OffsetPosition; // remove sit part offset |
7946 | av.SendAvatarDataToAllAgents(); | ||
7947 | 7963 | ||
7948 | } | 7964 | Quaternion rot = sitpart.RotationOffset; |
7949 | break; | 7965 | pos *= Quaternion.Conjugate(rot); // removed sit part rotation |
7950 | 7966 | ||
7951 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 7967 | Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f); |
7952 | { | 7968 | pos += sitOffset; |
7953 | if (remain < 1) | ||
7954 | return; | ||
7955 | LSL_Vector v; | ||
7956 | v = rules.GetVector3Item(idx++); | ||
7957 | 7969 | ||
7958 | SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); | 7970 | finalPos = pos; |
7959 | if (part == null) | 7971 | positionChanged = true; |
7960 | break; | 7972 | } |
7973 | break; | ||
7961 | 7974 | ||
7962 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); | 7975 | case (int)ScriptBaseClass.PRIM_ROTATION: |
7976 | { | ||
7977 | if (remain < 1) | ||
7978 | return; | ||
7963 | 7979 | ||
7964 | v += 2 * sitOffset; | 7980 | if (sitpart == null) |
7981 | break; | ||
7965 | 7982 | ||
7966 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); | 7983 | LSL_Rotation r = rules.GetQuaternionItem(idx++); |
7967 | av.SendAvatarDataToAllAgents(); | 7984 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation |
7968 | 7985 | ||
7969 | } | 7986 | Quaternion srot = sitpart.GetWorldRotation(); |
7970 | break; | 7987 | rot *= Quaternion.Conjugate(srot); // removed sit part world rotation |
7971 | 7988 | ||
7972 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7989 | av.Rotation = rot; |
7973 | { | 7990 | av.SendAvatarDataToAllAgents(); |
7974 | if (remain < 1) | 7991 | } |
7975 | return; | 7992 | break; |
7976 | 7993 | ||
7977 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; | 7994 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
7978 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; | ||
7979 | if (llGetLinkNumber() > 1) | ||
7980 | { | 7995 | { |
7981 | localRot = llGetLocalRot(); | 7996 | if (remain < 1) |
7982 | localPos = llGetLocalPos(); | 7997 | return; |
7983 | } | ||
7984 | 7998 | ||
7985 | LSL_Rotation r; | 7999 | if (sitpart == null) |
7986 | r = rules.GetQuaternionItem(idx++); | 8000 | break; |
7987 | r = r * llGetRootRotation() / localRot; | ||
7988 | av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); | ||
7989 | av.SendAvatarDataToAllAgents(); | ||
7990 | } | ||
7991 | break; | ||
7992 | 8001 | ||
7993 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 8002 | LSL_Rotation r = rules.GetQuaternionItem(idx++); |
7994 | { | 8003 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation |
8004 | |||
8005 | Quaternion srot = sitpart.RotationOffset; | ||
8006 | rot *= Quaternion.Conjugate(srot); // remove sit part offset rotation | ||
8007 | |||
8008 | av.Rotation = rot; | ||
8009 | av.SendAvatarDataToAllAgents(); | ||
8010 | } | ||
8011 | break; | ||
8012 | |||
8013 | // parse rest doing nothing but number of parameters error check | ||
8014 | case (int)ScriptBaseClass.PRIM_SIZE: | ||
8015 | case (int)ScriptBaseClass.PRIM_MATERIAL: | ||
8016 | case (int)ScriptBaseClass.PRIM_PHANTOM: | ||
8017 | case (int)ScriptBaseClass.PRIM_PHYSICS: | ||
8018 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | ||
8019 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | ||
8020 | case (int)ScriptBaseClass.PRIM_NAME: | ||
8021 | case (int)ScriptBaseClass.PRIM_DESC: | ||
7995 | if (remain < 1) | 8022 | if (remain < 1) |
7996 | return; | 8023 | return; |
8024 | idx++; | ||
8025 | break; | ||
7997 | 8026 | ||
7998 | LSL_Rotation r; | 8027 | case (int)ScriptBaseClass.PRIM_GLOW: |
7999 | r = rules.GetQuaternionItem(idx++); | 8028 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
8000 | av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); | 8029 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
8001 | av.SendAvatarDataToAllAgents(); | 8030 | if (remain < 2) |
8002 | } | 8031 | return; |
8003 | break; | 8032 | idx += 2; |
8033 | break; | ||
8004 | 8034 | ||
8005 | // parse rest doing nothing but number of parameters error check | 8035 | case (int)ScriptBaseClass.PRIM_TYPE: |
8006 | case (int)ScriptBaseClass.PRIM_SIZE: | 8036 | if (remain < 3) |
8007 | case (int)ScriptBaseClass.PRIM_MATERIAL: | 8037 | return; |
8008 | case (int)ScriptBaseClass.PRIM_PHANTOM: | 8038 | code = (int)rules.GetLSLIntegerItem(idx++); |
8009 | case (int)ScriptBaseClass.PRIM_PHYSICS: | 8039 | remain = rules.Length - idx; |
8010 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | 8040 | switch (code) |
8011 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | 8041 | { |
8012 | case (int)ScriptBaseClass.PRIM_NAME: | 8042 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: |
8013 | case (int)ScriptBaseClass.PRIM_DESC: | 8043 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: |
8014 | if (remain < 1) | 8044 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: |
8015 | return; | 8045 | if (remain < 6) |
8016 | idx++; | 8046 | return; |
8017 | break; | 8047 | idx += 6; |
8048 | break; | ||
8018 | 8049 | ||
8019 | case (int)ScriptBaseClass.PRIM_GLOW: | 8050 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: |
8020 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 8051 | if (remain < 5) |
8021 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 8052 | return; |
8022 | if (remain < 2) | 8053 | idx += 5; |
8023 | return; | 8054 | break; |
8024 | idx += 2; | ||
8025 | break; | ||
8026 | 8055 | ||
8027 | case (int)ScriptBaseClass.PRIM_TYPE: | 8056 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: |
8028 | if (remain < 3) | 8057 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: |
8029 | return; | 8058 | case (int)ScriptBaseClass.PRIM_TYPE_RING: |
8030 | code = (int)rules.GetLSLIntegerItem(idx++); | 8059 | if (remain < 11) |
8031 | remain = rules.Length - idx; | 8060 | return; |
8032 | switch (code) | 8061 | idx += 11; |
8033 | { | 8062 | break; |
8034 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: | ||
8035 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | ||
8036 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | ||
8037 | if (remain < 6) | ||
8038 | return; | ||
8039 | idx += 6; | ||
8040 | break; | ||
8041 | 8063 | ||
8042 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | 8064 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: |
8043 | if (remain < 5) | 8065 | if (remain < 2) |
8044 | return; | 8066 | return; |
8045 | idx += 5; | 8067 | idx += 2; |
8046 | break; | 8068 | break; |
8069 | } | ||
8070 | break; | ||
8047 | 8071 | ||
8048 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | 8072 | case (int)ScriptBaseClass.PRIM_COLOR: |
8049 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | 8073 | case (int)ScriptBaseClass.PRIM_TEXT: |
8050 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | 8074 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
8051 | if (remain < 11) | 8075 | case (int)ScriptBaseClass.PRIM_OMEGA: |
8052 | return; | 8076 | if (remain < 3) |
8053 | idx += 11; | 8077 | return; |
8054 | break; | 8078 | idx += 3; |
8079 | break; | ||
8055 | 8080 | ||
8056 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | 8081 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
8057 | if (remain < 2) | 8082 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: |
8058 | return; | 8083 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: |
8059 | idx += 2; | 8084 | if (remain < 5) |
8060 | break; | 8085 | return; |
8061 | } | 8086 | idx += 5; |
8062 | break; | 8087 | break; |
8063 | 8088 | ||
8064 | case (int)ScriptBaseClass.PRIM_COLOR: | 8089 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
8065 | case (int)ScriptBaseClass.PRIM_TEXT: | 8090 | if (remain < 7) |
8066 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 8091 | return; |
8067 | case (int)ScriptBaseClass.PRIM_OMEGA: | ||
8068 | if (remain < 3) | ||
8069 | return; | ||
8070 | idx += 3; | ||
8071 | break; | ||
8072 | 8092 | ||
8073 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 8093 | idx += 7; |
8074 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 8094 | break; |
8075 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: | ||
8076 | if (remain < 5) | ||
8077 | return; | ||
8078 | idx += 5; | ||
8079 | break; | ||
8080 | 8095 | ||
8081 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 8096 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
8082 | if (remain < 7) | 8097 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
8083 | return; | 8098 | return; |
8084 | 8099 | ||
8085 | idx += 7; | 8100 | if (positionChanged) |
8086 | break; | 8101 | { |
8102 | positionChanged = false; | ||
8103 | av.OffsetPosition = finalPos; | ||
8104 | av.SendAvatarDataToAllAgents(); | ||
8105 | } | ||
8087 | 8106 | ||
8088 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 8107 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); |
8089 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 8108 | LSL_List new_rules = rules.GetSublist(idx, -1); |
8109 | setLinkPrimParams((int)new_linknumber, new_rules); | ||
8090 | return; | 8110 | return; |
8091 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | 8111 | } |
8092 | LSL_List new_rules = rules.GetSublist(idx, -1); | 8112 | } |
8093 | setLinkPrimParams((int)new_linknumber, new_rules); | 8113 | } |
8094 | return; | 8114 | |
8115 | finally | ||
8116 | { | ||
8117 | if (positionChanged) | ||
8118 | { | ||
8119 | av.OffsetPosition = finalPos; | ||
8120 | av.SendAvatarDataToAllAgents(); | ||
8121 | positionChanged = false; | ||
8095 | } | 8122 | } |
8096 | } | 8123 | } |
8097 | } | 8124 | } |
@@ -8127,8 +8154,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8127 | return; | 8154 | return; |
8128 | 8155 | ||
8129 | v=rules.GetVector3Item(idx++); | 8156 | v=rules.GetVector3Item(idx++); |
8130 | positionChanged = true; | ||
8131 | currentPosition = GetSetPosTarget(part, v, currentPosition); | 8157 | currentPosition = GetSetPosTarget(part, v, currentPosition); |
8158 | positionChanged = true; | ||
8132 | 8159 | ||
8133 | break; | 8160 | break; |
8134 | case (int)ScriptBaseClass.PRIM_SIZE: | 8161 | case (int)ScriptBaseClass.PRIM_SIZE: |
@@ -8510,13 +8537,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8510 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | 8537 | LSL_Float gain = rules.GetLSLFloatItem(idx++); |
8511 | TargetOmega(part, axis, (double)spinrate, (double)gain); | 8538 | TargetOmega(part, axis, (double)spinrate, (double)gain); |
8512 | break; | 8539 | break; |
8540 | |||
8513 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 8541 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
8514 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 8542 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
8515 | return; | 8543 | return; |
8516 | 8544 | ||
8517 | // do a pending position change | 8545 | // do a pending position change before jumping to other part/avatar |
8518 | if (positionChanged) | 8546 | if (positionChanged) |
8519 | { | 8547 | { |
8548 | positionChanged = false; | ||
8520 | if (parentgrp == null) | 8549 | if (parentgrp == null) |
8521 | return; | 8550 | return; |
8522 | 8551 | ||
@@ -8545,7 +8574,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8545 | } | 8574 | } |
8546 | finally | 8575 | finally |
8547 | { | 8576 | { |
8548 | /* | ||
8549 | if (positionChanged) | 8577 | if (positionChanged) |
8550 | { | 8578 | { |
8551 | if (part.ParentGroup.RootPart == part) | 8579 | if (part.ParentGroup.RootPart == part) |
@@ -8563,27 +8591,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8563 | parent.ScheduleGroupForTerseUpdate(); | 8591 | parent.ScheduleGroupForTerseUpdate(); |
8564 | } | 8592 | } |
8565 | } | 8593 | } |
8566 | */ | ||
8567 | } | ||
8568 | |||
8569 | if (positionChanged) | ||
8570 | { | ||
8571 | if (parentgrp == null) | ||
8572 | return; | ||
8573 | |||
8574 | if (parentgrp.RootPart == part) | ||
8575 | { | ||
8576 | |||
8577 | Util.FireAndForget(delegate(object x) { | ||
8578 | parentgrp.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | ||
8579 | }); | ||
8580 | } | ||
8581 | else | ||
8582 | { | ||
8583 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | ||
8584 | parentgrp.HasGroupChanged = true; | ||
8585 | parentgrp.ScheduleGroupForTerseUpdate(); | ||
8586 | } | ||
8587 | } | 8594 | } |
8588 | } | 8595 | } |
8589 | 8596 | ||
@@ -8914,7 +8921,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8914 | // replies as SL wiki | 8921 | // replies as SL wiki |
8915 | 8922 | ||
8916 | LSL_List res = new LSL_List(); | 8923 | LSL_List res = new LSL_List(); |
8917 | SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed | 8924 | // SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed |
8925 | SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone?? | ||
8926 | |||
8918 | int idx = 0; | 8927 | int idx = 0; |
8919 | while (idx < rules.Length) | 8928 | while (idx < rules.Length) |
8920 | { | 8929 | { |
@@ -8941,6 +8950,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8941 | 8950 | ||
8942 | case (int)ScriptBaseClass.PRIM_POSITION: | 8951 | case (int)ScriptBaseClass.PRIM_POSITION: |
8943 | Vector3 pos = avatar.AbsolutePosition; | 8952 | Vector3 pos = avatar.AbsolutePosition; |
8953 | Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f); | ||
8954 | pos -= sitOffset; | ||
8944 | res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); | 8955 | res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); |
8945 | break; | 8956 | break; |
8946 | 8957 | ||
@@ -9139,8 +9150,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9139 | { | 9150 | { |
9140 | lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim | 9151 | lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim |
9141 | } | 9152 | } |
9153 | Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f); | ||
9154 | lpos -= lsitOffset; | ||
9142 | res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z)); | 9155 | res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z)); |
9143 | break; | 9156 | break; |
9157 | |||
9158 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
9159 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
9160 | return res; | ||
9161 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
9162 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
9163 | |||
9164 | res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | ||
9165 | return res; | ||
9144 | } | 9166 | } |
9145 | } | 9167 | } |
9146 | return res; | 9168 | return res; |
@@ -9532,6 +9554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9532 | res.Add(new LSL_Float(primglow)); | 9554 | res.Add(new LSL_Float(primglow)); |
9533 | } | 9555 | } |
9534 | break; | 9556 | break; |
9557 | |||
9535 | case (int)ScriptBaseClass.PRIM_TEXT: | 9558 | case (int)ScriptBaseClass.PRIM_TEXT: |
9536 | Color4 textColor = part.GetTextColor(); | 9559 | Color4 textColor = part.GetTextColor(); |
9537 | res.Add(new LSL_String(part.Text)); | 9560 | res.Add(new LSL_String(part.Text)); |
@@ -9540,18 +9563,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9540 | textColor.B)); | 9563 | textColor.B)); |
9541 | res.Add(new LSL_Float(textColor.A)); | 9564 | res.Add(new LSL_Float(textColor.A)); |
9542 | break; | 9565 | break; |
9566 | |||
9543 | case (int)ScriptBaseClass.PRIM_NAME: | 9567 | case (int)ScriptBaseClass.PRIM_NAME: |
9544 | res.Add(new LSL_String(part.Name)); | 9568 | res.Add(new LSL_String(part.Name)); |
9545 | break; | 9569 | break; |
9570 | |||
9546 | case (int)ScriptBaseClass.PRIM_DESC: | 9571 | case (int)ScriptBaseClass.PRIM_DESC: |
9547 | res.Add(new LSL_String(part.Description)); | 9572 | res.Add(new LSL_String(part.Description)); |
9548 | break; | 9573 | break; |
9574 | |||
9549 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 9575 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
9550 | res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); | 9576 | res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); |
9551 | break; | 9577 | break; |
9578 | |||
9552 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 9579 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
9553 | res.Add(new LSL_Vector(GetPartLocalPos(part))); | 9580 | res.Add(new LSL_Vector(GetPartLocalPos(part))); |
9554 | break; | 9581 | break; |
9582 | |||
9583 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
9584 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
9585 | return res; | ||
9586 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
9587 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
9588 | LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | ||
9589 | res += tres; | ||
9590 | return res; | ||
9555 | } | 9591 | } |
9556 | } | 9592 | } |
9557 | return res; | 9593 | return res; |