diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5f9b09b..b855a1a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -217,7 +217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | protected List<SceneObjectPart> GetLinkParts(int linkType) | 220 | public List<SceneObjectPart> GetLinkParts(int linkType) |
221 | { | 221 | { |
222 | List<SceneObjectPart> ret = new List<SceneObjectPart>(); | 222 | List<SceneObjectPart> ret = new List<SceneObjectPart>(); |
223 | ret.Add(m_host); | 223 | ret.Add(m_host); |
@@ -4172,7 +4172,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4172 | // this function to understand which shape it is (taken from meshmerizer) | 4172 | // this function to understand which shape it is (taken from meshmerizer) |
4173 | // quite useful can be used by meshmerizer to have a centralized point of understanding the shape | 4173 | // quite useful can be used by meshmerizer to have a centralized point of understanding the shape |
4174 | // except that it refers to scripting constants | 4174 | // except that it refers to scripting constants |
4175 | protected int getScriptPrimType(PrimitiveBaseShape primShape) | 4175 | public int getScriptPrimType(PrimitiveBaseShape primShape) |
4176 | { | 4176 | { |
4177 | if (primShape.SculptEntry) | 4177 | if (primShape.SculptEntry) |
4178 | return ScriptBaseClass.PRIM_TYPE_SCULPT; | 4178 | return ScriptBaseClass.PRIM_TYPE_SCULPT; |
@@ -7246,6 +7246,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7246 | public LSL_List llGetPrimitiveParams(LSL_List rules) | 7246 | public LSL_List llGetPrimitiveParams(LSL_List rules) |
7247 | { | 7247 | { |
7248 | m_host.AddScriptLPS(1); | 7248 | m_host.AddScriptLPS(1); |
7249 | return GetLinkPrimitiveParams( m_host, rules ); | ||
7250 | } | ||
7251 | |||
7252 | public LSL_List GetLinkPrimitiveParams( SceneObjectPart part, LSL_List rules ) | ||
7253 | { | ||
7249 | 7254 | ||
7250 | LSL_List res = new LSL_List(); | 7255 | LSL_List res = new LSL_List(); |
7251 | int idx=0; | 7256 | int idx=0; |
@@ -7257,40 +7262,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7257 | switch (code) | 7262 | switch (code) |
7258 | { | 7263 | { |
7259 | case (int)ScriptBaseClass.PRIM_MATERIAL: | 7264 | case (int)ScriptBaseClass.PRIM_MATERIAL: |
7260 | res.Add(new LSL_Integer(m_host.Material)); | 7265 | res.Add(new LSL_Integer(part.Material)); |
7261 | break; | 7266 | break; |
7262 | 7267 | ||
7263 | case (int)ScriptBaseClass.PRIM_PHYSICS: | 7268 | case (int)ScriptBaseClass.PRIM_PHYSICS: |
7264 | if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0) | 7269 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0) |
7265 | res.Add(new LSL_Integer(1)); | 7270 | res.Add(new LSL_Integer(1)); |
7266 | else | 7271 | else |
7267 | res.Add(new LSL_Integer(0)); | 7272 | res.Add(new LSL_Integer(0)); |
7268 | break; | 7273 | break; |
7269 | 7274 | ||
7270 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | 7275 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: |
7271 | if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0) | 7276 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0) |
7272 | res.Add(new LSL_Integer(1)); | 7277 | res.Add(new LSL_Integer(1)); |
7273 | else | 7278 | else |
7274 | res.Add(new LSL_Integer(0)); | 7279 | res.Add(new LSL_Integer(0)); |
7275 | break; | 7280 | break; |
7276 | 7281 | ||
7277 | case (int)ScriptBaseClass.PRIM_PHANTOM: | 7282 | case (int)ScriptBaseClass.PRIM_PHANTOM: |
7278 | if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) | 7283 | if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) |
7279 | res.Add(new LSL_Integer(1)); | 7284 | res.Add(new LSL_Integer(1)); |
7280 | else | 7285 | else |
7281 | res.Add(new LSL_Integer(0)); | 7286 | res.Add(new LSL_Integer(0)); |
7282 | break; | 7287 | break; |
7283 | 7288 | ||
7284 | case (int)ScriptBaseClass.PRIM_POSITION: | 7289 | case (int)ScriptBaseClass.PRIM_POSITION: |
7285 | res.Add(new LSL_Vector(m_host.AbsolutePosition.X, | 7290 | res.Add(new LSL_Vector(part.AbsolutePosition.X, |
7286 | m_host.AbsolutePosition.Y, | 7291 | part.AbsolutePosition.Y, |
7287 | m_host.AbsolutePosition.Z)); | 7292 | part.AbsolutePosition.Z)); |
7288 | break; | 7293 | break; |
7289 | 7294 | ||
7290 | case (int)ScriptBaseClass.PRIM_SIZE: | 7295 | case (int)ScriptBaseClass.PRIM_SIZE: |
7291 | res.Add(new LSL_Vector(m_host.Scale.X, | 7296 | res.Add(new LSL_Vector(part.Scale.X, |
7292 | m_host.Scale.Y, | 7297 | part.Scale.Y, |
7293 | m_host.Scale.Z)); | 7298 | part.Scale.Z)); |
7294 | break; | 7299 | break; |
7295 | 7300 | ||
7296 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7301 | case (int)ScriptBaseClass.PRIM_ROTATION: |
@@ -7299,8 +7304,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7299 | 7304 | ||
7300 | case (int)ScriptBaseClass.PRIM_TYPE: | 7305 | case (int)ScriptBaseClass.PRIM_TYPE: |
7301 | // implementing box | 7306 | // implementing box |
7302 | PrimitiveBaseShape Shape = m_host.Shape; | 7307 | PrimitiveBaseShape Shape = part.Shape; |
7303 | int primType = getScriptPrimType(m_host.Shape); | 7308 | int primType = getScriptPrimType(part.Shape); |
7304 | res.Add(new LSL_Integer(primType)); | 7309 | res.Add(new LSL_Integer(primType)); |
7305 | switch (primType) | 7310 | switch (primType) |
7306 | { | 7311 | { |
@@ -7372,10 +7377,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7372 | return res; | 7377 | return res; |
7373 | 7378 | ||
7374 | int face = (int)rules.GetLSLIntegerItem(idx++); | 7379 | int face = (int)rules.GetLSLIntegerItem(idx++); |
7375 | Primitive.TextureEntry tex = m_host.Shape.Textures; | 7380 | Primitive.TextureEntry tex = part.Shape.Textures; |
7376 | if (face == ScriptBaseClass.ALL_SIDES) | 7381 | if (face == ScriptBaseClass.ALL_SIDES) |
7377 | { | 7382 | { |
7378 | for (face = 0 ; face < GetNumberOfSides(m_host) ; face++) | 7383 | for (face = 0 ; face < GetNumberOfSides(part) ; face++) |
7379 | { | 7384 | { |
7380 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 7385 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
7381 | 7386 | ||
@@ -7391,7 +7396,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7391 | } | 7396 | } |
7392 | else | 7397 | else |
7393 | { | 7398 | { |
7394 | if (face >= 0 && face < GetNumberOfSides(m_host)) | 7399 | if (face >= 0 && face < GetNumberOfSides(part)) |
7395 | { | 7400 | { |
7396 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 7401 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
7397 | 7402 | ||
@@ -7413,11 +7418,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7413 | 7418 | ||
7414 | face=(int)rules.GetLSLIntegerItem(idx++); | 7419 | face=(int)rules.GetLSLIntegerItem(idx++); |
7415 | 7420 | ||
7416 | tex = m_host.Shape.Textures; | 7421 | tex = part.Shape.Textures; |
7417 | Color4 texcolor; | 7422 | Color4 texcolor; |
7418 | if (face == ScriptBaseClass.ALL_SIDES) | 7423 | if (face == ScriptBaseClass.ALL_SIDES) |
7419 | { | 7424 | { |
7420 | for (face = 0 ; face < GetNumberOfSides(m_host) ; face++) | 7425 | for (face = 0 ; face < GetNumberOfSides(part) ; face++) |
7421 | { | 7426 | { |
7422 | texcolor = tex.GetFace((uint)face).RGBA; | 7427 | texcolor = tex.GetFace((uint)face).RGBA; |
7423 | res.Add(new LSL_Vector(texcolor.R, | 7428 | res.Add(new LSL_Vector(texcolor.R, |
@@ -7458,7 +7463,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7458 | break; | 7463 | break; |
7459 | 7464 | ||
7460 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 7465 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
7461 | PrimitiveBaseShape shape = m_host.Shape; | 7466 | PrimitiveBaseShape shape = part.Shape; |
7462 | 7467 | ||
7463 | if (shape.FlexiEntry) | 7468 | if (shape.FlexiEntry) |
7464 | res.Add(new LSL_Integer(1)); // active | 7469 | res.Add(new LSL_Integer(1)); // active |
@@ -7486,7 +7491,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7486 | break; | 7491 | break; |
7487 | 7492 | ||
7488 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 7493 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: |
7489 | shape = m_host.Shape; | 7494 | shape = part.Shape; |
7490 | 7495 | ||
7491 | if (shape.LightEntry) | 7496 | if (shape.LightEntry) |
7492 | res.Add(new LSL_Integer(1)); // active | 7497 | res.Add(new LSL_Integer(1)); // active |