aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-26 20:25:58 +0000
committerJustin Clark-Casey (justincc)2013-03-26 20:25:58 +0000
commit3f0f313a764213e928aeb57968efbdd0e4c851cd (patch)
treec3d62ea4fa60d8b3b928279b0be812e5b34265a1 /OpenSim/Region
parentBulletSim: new algorithm for vertical attraction which uses quaternion (diff)
downloadopensim-SC_OLD-3f0f313a764213e928aeb57968efbdd0e4c851cd.zip
opensim-SC_OLD-3f0f313a764213e928aeb57968efbdd0e4c851cd.tar.gz
opensim-SC_OLD-3f0f313a764213e928aeb57968efbdd0e4c851cd.tar.bz2
opensim-SC_OLD-3f0f313a764213e928aeb57968efbdd0e4c851cd.tar.xz
Make llGetLinkPrimitiveParams() and llGetPrimitiveParams() work for avatars in a linkset.
llGetPrimitiveParams() works through PRIM_LINK_TARGET Setting via llSetLinkPrimitiveParams(), etc. not yet implemented
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs224
1 files changed, 194 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e1f0071..bf3d8ab 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5923,8 +5923,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5923 } 5923 }
5924 else 5924 else
5925 { 5925 {
5926 agentSize = new LSL_Vector(0.45, 0.6, avatar.Appearance.AvatarHeight); 5926 agentSize = GetAgentSize(avatar);
5927 } 5927 }
5928
5928 return agentSize; 5929 return agentSize;
5929 } 5930 }
5930 5931
@@ -7948,61 +7949,224 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7948 return new LSL_Vector(m_host.GetGeometricCenter()); 7949 return new LSL_Vector(m_host.GetGeometricCenter());
7949 } 7950 }
7950 7951
7951 public LSL_List llGetPrimitiveParams(LSL_List rules) 7952 public LSL_List GetEntityParams(ISceneEntity entity, LSL_List rules)
7952 { 7953 {
7953 m_host.AddScriptLPS(1);
7954
7955 LSL_List result = new LSL_List(); 7954 LSL_List result = new LSL_List();
7955 LSL_List remaining = null;
7956 7956
7957 LSL_List remaining = GetPrimParams(m_host, rules, ref result); 7957 while (true)
7958 {
7959 if (entity is SceneObjectPart)
7960 remaining = GetPrimParams((SceneObjectPart)entity, rules, ref result);
7961 else
7962 remaining = GetAgentParams((ScenePresence)entity, rules, ref result);
7963
7964 if (remaining == null || remaining.Length <= 2)
7965 return result;
7958 7966
7959 while (remaining != null && remaining.Length > 2)
7960 {
7961 int linknumber = remaining.GetLSLIntegerItem(0); 7967 int linknumber = remaining.GetLSLIntegerItem(0);
7962 rules = remaining.GetSublist(1, -1); 7968 rules = remaining.GetSublist(1, -1);
7963 List<SceneObjectPart> parts = GetLinkParts(linknumber); 7969 entity = GetLinkEntity(linknumber);
7964
7965 foreach (SceneObjectPart part in parts)
7966 remaining = GetPrimParams(part, rules, ref result);
7967 } 7970 }
7971 }
7968 7972
7969 return result; 7973 public LSL_List llGetPrimitiveParams(LSL_List rules)
7974 {
7975 m_host.AddScriptLPS(1);
7976
7977 return GetEntityParams(m_host, rules);
7970 } 7978 }
7971 7979
7972 public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) 7980 public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules)
7973 { 7981 {
7974 m_host.AddScriptLPS(1); 7982 m_host.AddScriptLPS(1);
7975 7983
7976 List<SceneObjectPart> parts = GetLinkParts(linknumber); 7984 return GetEntityParams(GetLinkEntity(linknumber), rules);
7985 }
7977 7986
7978 LSL_List res = new LSL_List(); 7987 public LSL_Vector GetAgentSize(ScenePresence sp)
7979 LSL_List remaining = null; 7988 {
7989 return new LSL_Vector(0.45, 0.6, sp.Appearance.AvatarHeight);
7990 }
7980 7991
7981 foreach (SceneObjectPart part in parts) 7992 /// <summary>
7993 /// Gets params for a seated avatar in a linkset.
7994 /// </summary>
7995 /// <returns></returns>
7996 /// <param name='sp'></param>
7997 /// <param name='rules'></param>
7998 /// <param name='res'></param>
7999 public LSL_List GetAgentParams(ScenePresence sp, LSL_List rules, ref LSL_List res)
8000 {
8001 int idx = 0;
8002 while (idx < rules.Length)
7982 { 8003 {
7983 remaining = GetPrimParams(part, rules, ref res); 8004 int code = (int)rules.GetLSLIntegerItem(idx++);
7984 } 8005 int remain = rules.Length-idx;
7985 8006
7986 while (remaining != null && remaining.Length > 2) 8007 switch (code)
7987 { 8008 {
7988 linknumber = remaining.GetLSLIntegerItem(0); 8009 case (int)ScriptBaseClass.PRIM_MATERIAL:
7989 rules = remaining.GetSublist(1, -1); 8010 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MATERIAL_FLESH));
7990 parts = GetLinkParts(linknumber); 8011 break;
7991 8012
7992 foreach (SceneObjectPart part in parts) 8013 case (int)ScriptBaseClass.PRIM_PHYSICS:
7993 remaining = GetPrimParams(part, rules, ref res); 8014 res.Add(ScriptBaseClass.FALSE);
8015 break;
8016
8017 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
8018 res.Add(ScriptBaseClass.FALSE);
8019 break;
8020
8021 case (int)ScriptBaseClass.PRIM_PHANTOM:
8022 res.Add(ScriptBaseClass.FALSE);
8023 break;
8024
8025 case (int)ScriptBaseClass.PRIM_POSITION:
8026 res.Add(new LSL_Vector(sp.AbsolutePosition));
8027 break;
8028
8029 case (int)ScriptBaseClass.PRIM_SIZE:
8030 res.Add(GetAgentSize(sp));
8031 break;
8032
8033 case (int)ScriptBaseClass.PRIM_ROTATION:
8034 res.Add(sp.GetWorldRotation());
8035 break;
8036
8037 case (int)ScriptBaseClass.PRIM_TYPE:
8038 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX));
8039 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT));
8040 res.Add(new LSL_Vector(0, 1, 0));
8041 res.Add(new LSL_Float(0));
8042 res.Add(new LSL_Vector(0, 0, 0));
8043 res.Add(new LSL_Vector(1, 1, 0));
8044 res.Add(new LSL_Vector(0, 0, 0));
8045 break;
8046
8047 case (int)ScriptBaseClass.PRIM_TEXTURE:
8048 if (remain < 1)
8049 return null;
8050
8051 int face = (int)rules.GetLSLIntegerItem(idx++);
8052 if (face > 21)
8053 break;
8054
8055 res.Add(new LSL_String(""));
8056 res.Add(ScriptBaseClass.ZERO_VECTOR);
8057 res.Add(ScriptBaseClass.ZERO_VECTOR);
8058 res.Add(new LSL_Float(0));
8059 break;
8060
8061 case (int)ScriptBaseClass.PRIM_COLOR:
8062 if (remain < 1)
8063 return null;
8064
8065 face = (int)rules.GetLSLIntegerItem(idx++);
8066 if (face > 21)
8067 break;
8068
8069 res.Add(ScriptBaseClass.ZERO_VECTOR);
8070 res.Add(new LSL_Float(0));
8071 break;
8072
8073 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
8074 if (remain < 1)
8075 return null;
8076
8077 face = (int)rules.GetLSLIntegerItem(idx++);
8078 if (face > 21)
8079 break;
8080
8081 res.Add(ScriptBaseClass.PRIM_SHINY_NONE);
8082 res.Add(ScriptBaseClass.PRIM_BUMP_NONE);
8083 break;
8084
8085 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
8086 if (remain < 1)
8087 return null;
8088
8089 face = (int)rules.GetLSLIntegerItem(idx++);
8090 if (face > 21)
8091 break;
8092
8093 res.Add(ScriptBaseClass.FALSE);
8094 break;
8095
8096 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
8097 res.Add(ScriptBaseClass.FALSE);
8098 res.Add(new LSL_Integer(0));
8099 res.Add(new LSL_Float(0));
8100 res.Add(new LSL_Float(0));
8101 res.Add(new LSL_Float(0));
8102 res.Add(new LSL_Float(0));
8103 res.Add(ScriptBaseClass.ZERO_VECTOR);
8104 break;
8105
8106 case (int)ScriptBaseClass.PRIM_TEXGEN:
8107 if (remain < 1)
8108 return null;
8109
8110 face = (int)rules.GetLSLIntegerItem(idx++);
8111 if (face > 21)
8112 break;
8113
8114 res.Add(ScriptBaseClass.PRIM_TEXGEN_DEFAULT);
8115 break;
8116
8117 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
8118 res.Add(ScriptBaseClass.FALSE);
8119 res.Add(ScriptBaseClass.ZERO_VECTOR);
8120 res.Add(ScriptBaseClass.ZERO_VECTOR);
8121 break;
8122
8123 case (int)ScriptBaseClass.PRIM_GLOW:
8124 if (remain < 1)
8125 return null;
8126
8127 face = (int)rules.GetLSLIntegerItem(idx++);
8128 if (face > 21)
8129 break;
8130
8131 res.Add(new LSL_Float(0));
8132 break;
8133
8134 case (int)ScriptBaseClass.PRIM_TEXT:
8135 res.Add(new LSL_String(""));
8136 res.Add(ScriptBaseClass.ZERO_VECTOR);
8137 res.Add(new LSL_Float(1));
8138 break;
8139
8140 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8141 res.Add(new LSL_Rotation(sp.Rotation));
8142 break;
8143
8144 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8145 res.Add(new LSL_Vector(sp.OffsetPosition));
8146 break;
8147
8148 case (int)ScriptBaseClass.PRIM_SLICE:
8149 res.Add(new LSL_Vector(0, 1, 0));
8150 break;
8151
8152 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
8153 if(remain < 3)
8154 return null;
8155
8156 return rules.GetSublist(idx, -1);
8157 }
7994 } 8158 }
7995 8159
7996 return res; 8160 return null;
7997 } 8161 }
7998 8162
7999 public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) 8163 public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res)
8000 { 8164 {
8001 int idx=0; 8165 int idx = 0;
8002 while (idx < rules.Length) 8166 while (idx < rules.Length)
8003 { 8167 {
8004 int code=(int)rules.GetLSLIntegerItem(idx++); 8168 int code = (int)rules.GetLSLIntegerItem(idx++);
8005 int remain=rules.Length-idx; 8169 int remain = rules.Length-idx;
8006 8170
8007 switch (code) 8171 switch (code)
8008 { 8172 {
@@ -8245,7 +8409,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8245 if (remain < 1) 8409 if (remain < 1)
8246 return null; 8410 return null;
8247 8411
8248 face=(int)rules.GetLSLIntegerItem(idx++); 8412 face = (int)rules.GetLSLIntegerItem(idx++);
8249 8413
8250 tex = part.Shape.Textures; 8414 tex = part.Shape.Textures;
8251 if (face == ScriptBaseClass.ALL_SIDES) 8415 if (face == ScriptBaseClass.ALL_SIDES)