diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 28932b6b0f..cc903e0591 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 public List GetLinkParts(int linkType) { - List ret = new List(); + List ret = new List(); + if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted) + return ret; ret.Add(m_host); switch (linkType) @@ -1136,7 +1138,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } public void llSetStatus(int status, int value) - { + { + if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted) + return; m_host.AddScriptLPS(1); int statusrotationaxis = 0; @@ -1290,7 +1294,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetScale(SceneObjectPart part, LSL_Vector scale) - { + { // TODO: this needs to trigger a persistance save as well if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) return; @@ -1349,7 +1353,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetColor(SceneObjectPart part, LSL_Vector color, int face) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + Primitive.TextureEntry tex = part.Shape.Textures; Color4 texcolor; if (face >= 0 && face < GetNumberOfSides(part)) @@ -1386,7 +1393,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } public void SetTexGen(SceneObjectPart part, int face,int style) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + Primitive.TextureEntry tex = part.Shape.Textures; MappingType textype; textype = MappingType.Default; @@ -1416,7 +1426,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } public void SetGlow(SceneObjectPart part, int face, float glow) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + Primitive.TextureEntry tex = part.Shape.Textures; if (face >= 0 && face < GetNumberOfSides(part)) { @@ -1441,7 +1454,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; Shininess sval = new Shininess(); @@ -1491,7 +1506,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } public void SetFullBright(SceneObjectPart part, int face, bool bright) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + Primitive.TextureEntry tex = part.Shape.Textures; if (face >= 0 && face < GetNumberOfSides(part)) { @@ -1558,7 +1576,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetAlpha(SceneObjectPart part, double alpha, int face) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + Primitive.TextureEntry tex = part.Shape.Textures; Color4 texcolor; if (face >= 0 && face < GetNumberOfSides(part)) @@ -1603,8 +1624,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// protected void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, float wind, float tension, LSL_Vector Force) - { - if (part == null) + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) return; if (flexi) @@ -1638,8 +1659,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// protected void SetPointLight(SceneObjectPart part, bool light, LSL_Vector color, float intensity, float radius, float falloff) - { - if (part == null) + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) return; if (light) @@ -1724,7 +1745,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetTexture(SceneObjectPart part, string texture, int face) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + UUID textureID=new UUID(); if (!UUID.TryParse(texture, out textureID)) @@ -1769,7 +1793,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void ScaleTexture(SceneObjectPart part, double u, double v, int face) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + Primitive.TextureEntry tex = part.Shape.Textures; if (face >= 0 && face < GetNumberOfSides(part)) { @@ -1805,7 +1832,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void OffsetTexture(SceneObjectPart part, double u, double v, int face) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + Primitive.TextureEntry tex = part.Shape.Textures; if (face >= 0 && face < GetNumberOfSides(part)) { @@ -1841,7 +1871,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void RotateTexture(SceneObjectPart part, double rotation, int face) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + Primitive.TextureEntry tex = part.Shape.Textures; if (face >= 0 && face < GetNumberOfSides(part)) { @@ -1911,7 +1944,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) LSL_Vector currentPos = llGetLocalPos(); @@ -2005,7 +2041,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetRot(SceneObjectPart part, Quaternion rot) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + part.UpdateRotation(rot); // Update rotation does not move the object in the physics scene if it's a linkset. @@ -6499,8 +6538,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) - { - ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); + { + ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return shapeBlock; if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT && holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE && @@ -6569,7 +6610,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + ObjectShapePacket.ObjectDataBlock shapeBlock; shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); @@ -6617,7 +6661,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + ObjectShapePacket.ObjectDataBlock shapeBlock; shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); @@ -6658,7 +6705,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } 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) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + ObjectShapePacket.ObjectDataBlock shapeBlock; shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); @@ -6778,7 +6828,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); UUID sculptId; @@ -6812,14 +6865,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } public void llSetPrimitiveParams(LSL_List rules) - { + { m_host.AddScriptLPS(1); SetPrimParams(m_host, rules); } public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) - { - m_host.AddScriptLPS(1); + { + m_host.AddScriptLPS(1); List parts = GetLinkParts(linknumber); @@ -6828,7 +6881,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } protected void SetPrimParams(SceneObjectPart part, LSL_List rules) - { + { + if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + int idx = 0; while (idx < rules.Length)