aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs114
1 files changed, 85 insertions, 29 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 28932b6..cc903e0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -221,7 +221,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
221 221
222 public List<SceneObjectPart> GetLinkParts(int linkType) 222 public List<SceneObjectPart> GetLinkParts(int linkType)
223 { 223 {
224 List<SceneObjectPart> ret = new List<SceneObjectPart>(); 224 List<SceneObjectPart> ret = new List<SceneObjectPart>();
225 if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
226 return ret;
225 ret.Add(m_host); 227 ret.Add(m_host);
226 228
227 switch (linkType) 229 switch (linkType)
@@ -1136,7 +1138,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1136 } 1138 }
1137 1139
1138 public void llSetStatus(int status, int value) 1140 public void llSetStatus(int status, int value)
1139 { 1141 {
1142 if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
1143 return;
1140 m_host.AddScriptLPS(1); 1144 m_host.AddScriptLPS(1);
1141 1145
1142 int statusrotationaxis = 0; 1146 int statusrotationaxis = 0;
@@ -1290,7 +1294,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1290 } 1294 }
1291 1295
1292 protected void SetScale(SceneObjectPart part, LSL_Vector scale) 1296 protected void SetScale(SceneObjectPart part, LSL_Vector scale)
1293 { 1297 {
1294 // TODO: this needs to trigger a persistance save as well 1298 // TODO: this needs to trigger a persistance save as well
1295 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 1299 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1296 return; 1300 return;
@@ -1349,7 +1353,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1349 } 1353 }
1350 1354
1351 protected void SetColor(SceneObjectPart part, LSL_Vector color, int face) 1355 protected void SetColor(SceneObjectPart part, LSL_Vector color, int face)
1352 { 1356 {
1357 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1358 return;
1359
1353 Primitive.TextureEntry tex = part.Shape.Textures; 1360 Primitive.TextureEntry tex = part.Shape.Textures;
1354 Color4 texcolor; 1361 Color4 texcolor;
1355 if (face >= 0 && face < GetNumberOfSides(part)) 1362 if (face >= 0 && face < GetNumberOfSides(part))
@@ -1386,7 +1393,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1386 } 1393 }
1387 1394
1388 public void SetTexGen(SceneObjectPart part, int face,int style) 1395 public void SetTexGen(SceneObjectPart part, int face,int style)
1389 { 1396 {
1397 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1398 return;
1399
1390 Primitive.TextureEntry tex = part.Shape.Textures; 1400 Primitive.TextureEntry tex = part.Shape.Textures;
1391 MappingType textype; 1401 MappingType textype;
1392 textype = MappingType.Default; 1402 textype = MappingType.Default;
@@ -1416,7 +1426,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1416 } 1426 }
1417 1427
1418 public void SetGlow(SceneObjectPart part, int face, float glow) 1428 public void SetGlow(SceneObjectPart part, int face, float glow)
1419 { 1429 {
1430 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1431 return;
1432
1420 Primitive.TextureEntry tex = part.Shape.Textures; 1433 Primitive.TextureEntry tex = part.Shape.Textures;
1421 if (face >= 0 && face < GetNumberOfSides(part)) 1434 if (face >= 0 && face < GetNumberOfSides(part))
1422 { 1435 {
@@ -1441,7 +1454,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1441 } 1454 }
1442 1455
1443 public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump) 1456 public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump)
1444 { 1457 {
1458 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1459 return;
1445 1460
1446 Shininess sval = new Shininess(); 1461 Shininess sval = new Shininess();
1447 1462
@@ -1491,7 +1506,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1491 } 1506 }
1492 1507
1493 public void SetFullBright(SceneObjectPart part, int face, bool bright) 1508 public void SetFullBright(SceneObjectPart part, int face, bool bright)
1494 { 1509 {
1510 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1511 return;
1512
1495 Primitive.TextureEntry tex = part.Shape.Textures; 1513 Primitive.TextureEntry tex = part.Shape.Textures;
1496 if (face >= 0 && face < GetNumberOfSides(part)) 1514 if (face >= 0 && face < GetNumberOfSides(part))
1497 { 1515 {
@@ -1558,7 +1576,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1558 } 1576 }
1559 1577
1560 protected void SetAlpha(SceneObjectPart part, double alpha, int face) 1578 protected void SetAlpha(SceneObjectPart part, double alpha, int face)
1561 { 1579 {
1580 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1581 return;
1582
1562 Primitive.TextureEntry tex = part.Shape.Textures; 1583 Primitive.TextureEntry tex = part.Shape.Textures;
1563 Color4 texcolor; 1584 Color4 texcolor;
1564 if (face >= 0 && face < GetNumberOfSides(part)) 1585 if (face >= 0 && face < GetNumberOfSides(part))
@@ -1603,8 +1624,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1603 /// <param name="Force"></param> 1624 /// <param name="Force"></param>
1604 protected void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, 1625 protected void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction,
1605 float wind, float tension, LSL_Vector Force) 1626 float wind, float tension, LSL_Vector Force)
1606 { 1627 {
1607 if (part == null) 1628 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1608 return; 1629 return;
1609 1630
1610 if (flexi) 1631 if (flexi)
@@ -1638,8 +1659,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1638 /// <param name="radius"></param> 1659 /// <param name="radius"></param>
1639 /// <param name="falloff"></param> 1660 /// <param name="falloff"></param>
1640 protected void SetPointLight(SceneObjectPart part, bool light, LSL_Vector color, float intensity, float radius, float falloff) 1661 protected void SetPointLight(SceneObjectPart part, bool light, LSL_Vector color, float intensity, float radius, float falloff)
1641 { 1662 {
1642 if (part == null) 1663 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1643 return; 1664 return;
1644 1665
1645 if (light) 1666 if (light)
@@ -1724,7 +1745,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1724 } 1745 }
1725 1746
1726 protected void SetTexture(SceneObjectPart part, string texture, int face) 1747 protected void SetTexture(SceneObjectPart part, string texture, int face)
1727 { 1748 {
1749 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1750 return;
1751
1728 UUID textureID=new UUID(); 1752 UUID textureID=new UUID();
1729 1753
1730 if (!UUID.TryParse(texture, out textureID)) 1754 if (!UUID.TryParse(texture, out textureID))
@@ -1769,7 +1793,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1769 } 1793 }
1770 1794
1771 protected void ScaleTexture(SceneObjectPart part, double u, double v, int face) 1795 protected void ScaleTexture(SceneObjectPart part, double u, double v, int face)
1772 { 1796 {
1797 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1798 return;
1799
1773 Primitive.TextureEntry tex = part.Shape.Textures; 1800 Primitive.TextureEntry tex = part.Shape.Textures;
1774 if (face >= 0 && face < GetNumberOfSides(part)) 1801 if (face >= 0 && face < GetNumberOfSides(part))
1775 { 1802 {
@@ -1805,7 +1832,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1805 } 1832 }
1806 1833
1807 protected void OffsetTexture(SceneObjectPart part, double u, double v, int face) 1834 protected void OffsetTexture(SceneObjectPart part, double u, double v, int face)
1808 { 1835 {
1836 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1837 return;
1838
1809 Primitive.TextureEntry tex = part.Shape.Textures; 1839 Primitive.TextureEntry tex = part.Shape.Textures;
1810 if (face >= 0 && face < GetNumberOfSides(part)) 1840 if (face >= 0 && face < GetNumberOfSides(part))
1811 { 1841 {
@@ -1841,7 +1871,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1841 } 1871 }
1842 1872
1843 protected void RotateTexture(SceneObjectPart part, double rotation, int face) 1873 protected void RotateTexture(SceneObjectPart part, double rotation, int face)
1844 { 1874 {
1875 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1876 return;
1877
1845 Primitive.TextureEntry tex = part.Shape.Textures; 1878 Primitive.TextureEntry tex = part.Shape.Textures;
1846 if (face >= 0 && face < GetNumberOfSides(part)) 1879 if (face >= 0 && face < GetNumberOfSides(part))
1847 { 1880 {
@@ -1911,7 +1944,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1911 } 1944 }
1912 1945
1913 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) 1946 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
1914 { 1947 {
1948 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1949 return;
1950
1915 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) 1951 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
1916 LSL_Vector currentPos = llGetLocalPos(); 1952 LSL_Vector currentPos = llGetLocalPos();
1917 1953
@@ -2005,7 +2041,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2005 } 2041 }
2006 2042
2007 protected void SetRot(SceneObjectPart part, Quaternion rot) 2043 protected void SetRot(SceneObjectPart part, Quaternion rot)
2008 { 2044 {
2045 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
2046 return;
2047
2009 part.UpdateRotation(rot); 2048 part.UpdateRotation(rot);
2010 // Update rotation does not move the object in the physics scene if it's a linkset. 2049 // Update rotation does not move the object in the physics scene if it's a linkset.
2011 2050
@@ -6499,8 +6538,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6499 } 6538 }
6500 6539
6501 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) 6540 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist)
6502 { 6541 {
6503 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 6542 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
6543 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
6544 return shapeBlock;
6504 6545
6505 if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT && 6546 if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT &&
6506 holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE && 6547 holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE &&
@@ -6569,7 +6610,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6569 } 6610 }
6570 6611
6571 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) 6612 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge)
6572 { 6613 {
6614 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
6615 return;
6616
6573 ObjectShapePacket.ObjectDataBlock shapeBlock; 6617 ObjectShapePacket.ObjectDataBlock shapeBlock;
6574 6618
6575 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 6619 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
@@ -6617,7 +6661,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6617 } 6661 }
6618 6662
6619 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) 6663 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge)
6620 { 6664 {
6665 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
6666 return;
6667
6621 ObjectShapePacket.ObjectDataBlock shapeBlock; 6668 ObjectShapePacket.ObjectDataBlock shapeBlock;
6622 6669
6623 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 6670 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
@@ -6658,7 +6705,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6658 } 6705 }
6659 6706
6660 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge) 6707 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge)
6661 { 6708 {
6709 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
6710 return;
6711
6662 ObjectShapePacket.ObjectDataBlock shapeBlock; 6712 ObjectShapePacket.ObjectDataBlock shapeBlock;
6663 6713
6664 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 6714 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
@@ -6778,7 +6828,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6778 } 6828 }
6779 6829
6780 protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) 6830 protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type)
6781 { 6831 {
6832 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
6833 return;
6834
6782 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 6835 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
6783 UUID sculptId; 6836 UUID sculptId;
6784 6837
@@ -6812,14 +6865,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6812 } 6865 }
6813 6866
6814 public void llSetPrimitiveParams(LSL_List rules) 6867 public void llSetPrimitiveParams(LSL_List rules)
6815 { 6868 {
6816 m_host.AddScriptLPS(1); 6869 m_host.AddScriptLPS(1);
6817 SetPrimParams(m_host, rules); 6870 SetPrimParams(m_host, rules);
6818 } 6871 }
6819 6872
6820 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) 6873 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
6821 { 6874 {
6822 m_host.AddScriptLPS(1); 6875 m_host.AddScriptLPS(1);
6823 6876
6824 List<SceneObjectPart> parts = GetLinkParts(linknumber); 6877 List<SceneObjectPart> parts = GetLinkParts(linknumber);
6825 6878
@@ -6828,7 +6881,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6828 } 6881 }
6829 6882
6830 protected void SetPrimParams(SceneObjectPart part, LSL_List rules) 6883 protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
6831 { 6884 {
6885 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
6886 return;
6887
6832 int idx = 0; 6888 int idx = 0;
6833 6889
6834 while (idx < rules.Length) 6890 while (idx < rules.Length)