diff options
author | Melanie | 2009-08-07 21:51:03 +0100 |
---|---|---|
committer | Melanie | 2009-08-07 21:51:03 +0100 |
commit | 6c6527caae77715f32c3cffe0adb7bc774fb8e97 (patch) | |
tree | 5198c097e16524aa4483917aea6c0aac5651ea4b /OpenSim/Region | |
parent | Experimental! Implement ISponsor in ScriptInstance (diff) | |
download | opensim-SC-6c6527caae77715f32c3cffe0adb7bc774fb8e97.zip opensim-SC-6c6527caae77715f32c3cffe0adb7bc774fb8e97.tar.gz opensim-SC-6c6527caae77715f32c3cffe0adb7bc774fb8e97.tar.bz2 opensim-SC-6c6527caae77715f32c3cffe0adb7bc774fb8e97.tar.xz |
Thank you, Godfrey, for a patch that implements osGetLinkPrimitiveParams
Fixes Mantis #3979
Applied with changes. Changed ThreatLevel to High since all discovery
functions are a high threat. Overriding that is the responsibility
of the grid owner.
Diffstat (limited to 'OpenSim/Region')
4 files changed, 53 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 |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index bf86eeb..fd4ba71 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1740,6 +1740,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1740 | 1740 | ||
1741 | return World.RegionInfo.RegionSettings.LoadedCreationID; | 1741 | return World.RegionInfo.RegionSettings.LoadedCreationID; |
1742 | } | 1742 | } |
1743 | |||
1744 | // Threat level is 'Low' because certain users could possibly be tricked into | ||
1745 | // dropping an unverified script into one of their own objects, which could | ||
1746 | // then gather the physical construction details of the object and transmit it | ||
1747 | // to an unscrupulous third party, thus permitting unauthorized duplication of | ||
1748 | // the object's form. | ||
1749 | // | ||
1750 | public LSL_List osGetLinkPrimitiveParams( int linknumber, LSL_List rules ) | ||
1751 | { | ||
1752 | CheckThreatLevel( ThreatLevel.High, "osGetLinkPrimitiveParams" ); | ||
1753 | m_host.AddScriptLPS( 1 ); | ||
1754 | InitLSL(); | ||
1755 | LSL_List retVal = new LSL_List(); | ||
1756 | List<SceneObjectPart> parts = ((LSL_Api)m_LSL_Api).GetLinkParts( linknumber ); | ||
1757 | foreach (SceneObjectPart part in parts) | ||
1758 | { | ||
1759 | retVal += ((LSL_Api)m_LSL_Api).GetLinkPrimitiveParams( part, rules ); | ||
1760 | } | ||
1761 | return retVal; | ||
1762 | } | ||
1743 | 1763 | ||
1744 | } | 1764 | } |
1745 | } | 1765 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index debbad6..23e03e2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -146,6 +146,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
146 | string osLoadedCreationDate(); | 146 | string osLoadedCreationDate(); |
147 | string osLoadedCreationTime(); | 147 | string osLoadedCreationTime(); |
148 | string osLoadedCreationID(); | 148 | string osLoadedCreationID(); |
149 | |||
150 | LSL_List osGetLinkPrimitiveParams( int linknumber, LSL_List rules ); | ||
149 | 151 | ||
150 | } | 152 | } |
151 | } | 153 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 193e2e0..2408129 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -386,6 +386,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
386 | { | 386 | { |
387 | return m_OSSL_Functions.osLoadedCreationID(); | 387 | return m_OSSL_Functions.osLoadedCreationID(); |
388 | } | 388 | } |
389 | |||
390 | public LSL_List osGetLinkPrimitiveParams( int linknumber, LSL_List rules ) | ||
391 | { | ||
392 | return m_OSSL_Functions.osGetLinkPrimitiveParams( linknumber, rules ); | ||
393 | } | ||
389 | 394 | ||
390 | 395 | ||
391 | public OSSLPrim Prim; | 396 | public OSSLPrim Prim; |