diff options
author | UbitUmarov | 2012-06-12 01:26:03 +0100 |
---|---|---|
committer | UbitUmarov | 2012-06-12 01:26:03 +0100 |
commit | 24e8e5d8188dd2e8656feb5e43193e7475fa2acc (patch) | |
tree | cb2b76a9aee8f0bce68c3e4f386eb1cdbe1e5cc2 | |
parent | change object drag so it applies a impulse and not a push force so it works a... (diff) | |
download | opensim-SC-24e8e5d8188dd2e8656feb5e43193e7475fa2acc.zip opensim-SC-24e8e5d8188dd2e8656feb5e43193e7475fa2acc.tar.gz opensim-SC-24e8e5d8188dd2e8656feb5e43193e7475fa2acc.tar.bz2 opensim-SC-24e8e5d8188dd2e8656feb5e43193e7475fa2acc.tar.xz |
*UNTESTED* extended llGet*PrimitiveParam() to support avatars. Some auxiliar code in SOP.cs
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 241 |
2 files changed, 272 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a810de2..21e2878 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -519,6 +519,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
519 | } | 519 | } |
520 | } | 520 | } |
521 | 521 | ||
522 | // returns offset position relative to root prim of object when siting | ||
523 | public Vector3 OffsetPositionToSOGRoot | ||
524 | { | ||
525 | get | ||
526 | { | ||
527 | if (ParentPart != null) | ||
528 | return ParentPart.OffsetPosition + (m_pos * ParentPart.RotationOffset); | ||
529 | else | ||
530 | return m_pos; | ||
531 | } | ||
532 | } | ||
533 | |||
534 | public Quaternion OffsetRotationToSOGRoot | ||
535 | { | ||
536 | get | ||
537 | { | ||
538 | if (ParentPart != null) | ||
539 | return ParentPart.RotationOffset * Rotation; | ||
540 | else | ||
541 | return Rotation; | ||
542 | } | ||
543 | } | ||
544 | |||
545 | public Quaternion WorldRotation | ||
546 | { | ||
547 | get | ||
548 | { | ||
549 | if (ParentPart != null) | ||
550 | return ParentPart.GetWorldRotation() * Rotation; | ||
551 | else | ||
552 | return Rotation; | ||
553 | } | ||
554 | } | ||
555 | |||
522 | /// <summary> | 556 | /// <summary> |
523 | /// Current velocity of the avatar. | 557 | /// Current velocity of the avatar. |
524 | /// </summary> | 558 | /// </summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c3d4306..b2c21cd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -8881,16 +8881,251 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8881 | { | 8881 | { |
8882 | m_host.AddScriptLPS(1); | 8882 | m_host.AddScriptLPS(1); |
8883 | 8883 | ||
8884 | // acording to SL wiki this must indicate a single link number or link_root or link_this. | ||
8885 | // keep other options as before | ||
8886 | |||
8884 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 8887 | List<SceneObjectPart> parts = GetLinkParts(linknumber); |
8888 | List<ScenePresence> avatars = GetLinkAvatars(linknumber); | ||
8885 | 8889 | ||
8886 | LSL_List res = new LSL_List(); | 8890 | LSL_List res = new LSL_List(); |
8887 | 8891 | ||
8888 | foreach (var part in parts) | 8892 | if (parts.Count > 0) |
8889 | { | 8893 | { |
8890 | LSL_List partRes = GetLinkPrimitiveParams(part, rules); | 8894 | foreach (var part in parts) |
8891 | res += partRes; | 8895 | { |
8896 | LSL_List partRes = GetLinkPrimitiveParams(part, rules); | ||
8897 | res += partRes; | ||
8898 | } | ||
8892 | } | 8899 | } |
8900 | if (avatars.Count > 0) | ||
8901 | { | ||
8902 | foreach (ScenePresence avatar in avatars) | ||
8903 | { | ||
8904 | LSL_List avaRes = GetLinkPrimitiveParams(avatar, rules); | ||
8905 | res += avaRes; | ||
8906 | } | ||
8907 | } | ||
8908 | return res; | ||
8909 | } | ||
8910 | |||
8911 | public LSL_List GetLinkPrimitiveParams(ScenePresence avatar, LSL_List rules) | ||
8912 | { | ||
8913 | // avatars case | ||
8914 | // replies as SL wiki | ||
8915 | |||
8916 | LSL_List res = new LSL_List(); | ||
8917 | int idx = 0; | ||
8918 | while (idx < rules.Length) | ||
8919 | { | ||
8920 | int code = (int)rules.GetLSLIntegerItem(idx++); | ||
8921 | int remain = rules.Length - idx; | ||
8922 | |||
8923 | switch (code) | ||
8924 | { | ||
8925 | case (int)ScriptBaseClass.PRIM_MATERIAL: | ||
8926 | res.Add(new LSL_Integer((int)SOPMaterialData.SopMaterial.Flesh)); | ||
8927 | break; | ||
8928 | |||
8929 | case (int)ScriptBaseClass.PRIM_PHYSICS: | ||
8930 | res.Add(new LSL_Integer(0)); | ||
8931 | break; | ||
8932 | |||
8933 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | ||
8934 | res.Add(new LSL_Integer(0)); | ||
8935 | break; | ||
8936 | |||
8937 | case (int)ScriptBaseClass.PRIM_PHANTOM: | ||
8938 | res.Add(new LSL_Integer(0)); | ||
8939 | break; | ||
8940 | |||
8941 | case (int)ScriptBaseClass.PRIM_POSITION: | ||
8942 | Vector3 pos = avatar.AbsolutePosition; | ||
8943 | res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); | ||
8944 | break; | ||
8945 | |||
8946 | case (int)ScriptBaseClass.PRIM_SIZE: | ||
8947 | // as in llGetAgentSize above | ||
8948 | res.Add(new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight)); | ||
8949 | break; | ||
8950 | |||
8951 | case (int)ScriptBaseClass.PRIM_ROTATION: | ||
8952 | Quaternion rot = avatar.WorldRotation; | ||
8953 | res.Add(new LSL_Rotation (rot.X, rot.Y, rot.Z, rot.W)); | ||
8954 | break; | ||
8955 | |||
8956 | case (int)ScriptBaseClass.PRIM_TYPE: | ||
8957 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX)); | ||
8958 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT)); | ||
8959 | res.Add(new LSL_Vector(0f,1.0f,0f)); | ||
8960 | res.Add(new LSL_Float(0.0f)); | ||
8961 | res.Add(new LSL_Vector(0, 0, 0)); | ||
8962 | res.Add(new LSL_Vector(1.0f,1.0f,0f)); | ||
8963 | res.Add(new LSL_Vector(0, 0, 0)); | ||
8964 | break; | ||
8965 | |||
8966 | case (int)ScriptBaseClass.PRIM_TEXTURE: | ||
8967 | if (remain < 1) | ||
8968 | return res; | ||
8969 | |||
8970 | int face = (int)rules.GetLSLIntegerItem(idx++); | ||
8971 | if (face == ScriptBaseClass.ALL_SIDES) | ||
8972 | { | ||
8973 | for (face = 0; face < 21; face++) | ||
8974 | { | ||
8975 | res.Add(new LSL_String("")); | ||
8976 | res.Add(new LSL_Vector(0,0,0)); | ||
8977 | res.Add(new LSL_Vector(0,0,0)); | ||
8978 | res.Add(new LSL_Float(0.0)); | ||
8979 | } | ||
8980 | } | ||
8981 | else | ||
8982 | { | ||
8983 | if (face >= 0 && face < 21) | ||
8984 | { | ||
8985 | res.Add(new LSL_String("")); | ||
8986 | res.Add(new LSL_Vector(0,0,0)); | ||
8987 | res.Add(new LSL_Vector(0,0,0)); | ||
8988 | res.Add(new LSL_Float(0.0)); | ||
8989 | } | ||
8990 | } | ||
8991 | break; | ||
8992 | |||
8993 | case (int)ScriptBaseClass.PRIM_COLOR: | ||
8994 | if (remain < 1) | ||
8995 | return res; | ||
8996 | |||
8997 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8998 | |||
8999 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9000 | { | ||
9001 | for (face = 0; face < 21; face++) | ||
9002 | { | ||
9003 | res.Add(new LSL_Vector(0,0,0)); | ||
9004 | res.Add(new LSL_Float(0)); | ||
9005 | } | ||
9006 | } | ||
9007 | else | ||
9008 | { | ||
9009 | res.Add(new LSL_Vector(0,0,0)); | ||
9010 | res.Add(new LSL_Float(0)); | ||
9011 | } | ||
9012 | break; | ||
8893 | 9013 | ||
9014 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | ||
9015 | if (remain < 1) | ||
9016 | return res; | ||
9017 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
9018 | |||
9019 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9020 | { | ||
9021 | for (face = 0; face < 21; face++) | ||
9022 | { | ||
9023 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); | ||
9024 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); | ||
9025 | } | ||
9026 | } | ||
9027 | else | ||
9028 | { | ||
9029 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); | ||
9030 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); | ||
9031 | } | ||
9032 | break; | ||
9033 | |||
9034 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | ||
9035 | if (remain < 1) | ||
9036 | return res; | ||
9037 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
9038 | |||
9039 | int fullbright; | ||
9040 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9041 | { | ||
9042 | for (face = 0; face < 21; face++) | ||
9043 | { | ||
9044 | res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); | ||
9045 | } | ||
9046 | } | ||
9047 | else | ||
9048 | { | ||
9049 | res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); | ||
9050 | } | ||
9051 | break; | ||
9052 | |||
9053 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | ||
9054 | res.Add(new LSL_Integer(0)); | ||
9055 | res.Add(new LSL_Integer(0));// softness | ||
9056 | res.Add(new LSL_Float(0.0f)); // gravity | ||
9057 | res.Add(new LSL_Float(0.0f)); // friction | ||
9058 | res.Add(new LSL_Float(0.0f)); // wind | ||
9059 | res.Add(new LSL_Float(0.0f)); // tension | ||
9060 | res.Add(new LSL_Vector(0f,0f,0f)); | ||
9061 | break; | ||
9062 | |||
9063 | case (int)ScriptBaseClass.PRIM_TEXGEN: | ||
9064 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) | ||
9065 | if (remain < 1) | ||
9066 | return res; | ||
9067 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
9068 | |||
9069 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9070 | { | ||
9071 | for (face = 0; face < 21; face++) | ||
9072 | { | ||
9073 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); | ||
9074 | } | ||
9075 | } | ||
9076 | else | ||
9077 | { | ||
9078 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); | ||
9079 | } | ||
9080 | break; | ||
9081 | |||
9082 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | ||
9083 | res.Add(new LSL_Integer(0)); | ||
9084 | res.Add(new LSL_Vector(0f,0f,0f)); | ||
9085 | res.Add(new LSL_Float(0f)); // intensity | ||
9086 | res.Add(new LSL_Float(0f)); // radius | ||
9087 | res.Add(new LSL_Float(0f)); // falloff | ||
9088 | break; | ||
9089 | |||
9090 | case (int)ScriptBaseClass.PRIM_GLOW: | ||
9091 | if (remain < 1) | ||
9092 | return res; | ||
9093 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
9094 | |||
9095 | if (face == ScriptBaseClass.ALL_SIDES) | ||
9096 | { | ||
9097 | for (face = 0; face < 21; face++) | ||
9098 | { | ||
9099 | res.Add(new LSL_Float(0f)); | ||
9100 | } | ||
9101 | } | ||
9102 | else | ||
9103 | { | ||
9104 | res.Add(new LSL_Float(0f)); | ||
9105 | } | ||
9106 | break; | ||
9107 | |||
9108 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
9109 | res.Add(new LSL_String("")); | ||
9110 | res.Add(new LSL_Vector(0f,0f,0f)); | ||
9111 | res.Add(new LSL_Float(1.0f)); | ||
9112 | break; | ||
9113 | case (int)ScriptBaseClass.PRIM_NAME: | ||
9114 | res.Add(new LSL_String(avatar.Name)); | ||
9115 | break; | ||
9116 | case (int)ScriptBaseClass.PRIM_DESC: | ||
9117 | res.Add(new LSL_String("")); | ||
9118 | break; | ||
9119 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
9120 | Quaternion lrot = avatar.OffsetRotationToSOGRoot; | ||
9121 | res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W)); | ||
9122 | break; | ||
9123 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
9124 | Vector3 lpos = avatar.OffsetPositionToSOGRoot; | ||
9125 | res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z)); | ||
9126 | break; | ||
9127 | } | ||
9128 | } | ||
8894 | return res; | 9129 | return res; |
8895 | } | 9130 | } |
8896 | 9131 | ||