diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c98f6d8f41..7c0e4fd36b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2276,7 +2276,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!pbs.SculptEntry && (pbs.PathCurve == (byte)Extrusion.Straight || pbs.PathCurve == (byte)Extrusion.Flexible)) { if(flexi) - { + { pbs.PathCurve = (byte)Extrusion.Flexible; if(!sog.IsPhantom) { @@ -2477,7 +2477,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } Primitive.TextureEntry tex = part.Shape.Textures; - int nsides = GetNumberOfSides(part); + int nsides = GetNumberOfSides(part); if (face >= 0 && face < nsides) { @@ -2773,7 +2773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectGroup grp = part.ParentGroup; if (grp == null || grp.IsDeleted || grp.inTransit) return; - + LSL_Vector currentPos = GetPartLocalPos(part); LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos, adjust); @@ -3152,7 +3152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if(soundID.IsZero()) return; - // send the sound, once, to all clients in range + // send the sound, once, to all clients in range m_SoundModule.SendSound(m_host.UUID, soundID, volume, false, 0, false, false); } @@ -3165,12 +3165,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectPart sop; if (linknumber == ScriptBaseClass.LINK_THIS) - sop = m_host; + sop = m_host; else if (linknumber < 0) return; else if (linknumber < 2) sop = m_host.ParentGroup.RootPart; - else + else sop = m_host.ParentGroup.GetLinkNumPart(linknumber); if(sop == null) @@ -3180,7 +3180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (soundID.IsZero()) return; - // send the sound, once, to all clients in range + // send the sound, once, to all clients in range m_SoundModule.SendSound(sop.UUID, soundID, volume, false, 0, false, false); } @@ -3978,7 +3978,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api message = (message.Length > 1024) ? message.Substring(0, 1024) : message, binaryBucket = Util.StringToBytes256("{0}/{1}/{2}/{3}", m_regionName, (int)pos.X, (int)pos.Y, (int)pos.Z) }; - + m_TransferModule?.SendInstantMessage(msg, delegate(bool success) {}); ScriptSleep(m_sleepMsOnInstantMessage); } @@ -5770,7 +5770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if(key.IsZero()) return id; - + SceneObjectPart obj = World.GetSceneObjectPart(key); return (obj == null) ? id : obj.OwnerID.ToString(); } @@ -5933,7 +5933,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // a string, a key as string and a string that by coincidence // is a string, so we're going to leave that up to the // LSL_Vector constructor. - if(item is LSL_Vector) + if(item is LSL_Vector) return (LSL_Vector) item; if (item is LSL_String || item is string) // xengine sees string @@ -5958,7 +5958,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // a string, a key as string and a string that by coincidence // is a string, so we're going to leave that up to the // LSL_Rotation constructor. - + if (item.GetType() == typeof(LSL_Rotation)) return (LSL_Rotation)item; @@ -6521,7 +6521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// Remove as they are done /// static readonly UUID busyAnimation = new UUID("efcf670c-2d18-8128-973a-034ebc806b67"); - + public LSL_Integer llGetAgentInfo(LSL_Key id) { @@ -8311,7 +8311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llSHA256String(LSL_String input) { - // Create a SHA256 + // Create a SHA256 using (SHA256 sha256Hash = SHA256.Create()) { // ComputeHash - returns byte array @@ -10155,14 +10155,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector primTextColor; LSL_Float primTextAlpha; - try - { + object o = rules.Data[idx]; + if (o is LSL_Types.LSLString || o is LSL_Types.key) primText = rules.GetLSLStringItem(idx++); - } - catch(InvalidCastException) + else { - Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1)); - return new LSL_List(); + //throw new InvalidCastException(string.Format("Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1)); + Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1)); + return new LSL_List(); } try { @@ -10378,7 +10378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ALPHA_MODE: arg #{1} - must be 0 to 255", rulesParsed, idx - idxStart - 1)); return new LSL_List(); } - + materialChanged |= SetMaterialAlphaMode(part, face, materialAlphaMode, materialMaskCutoff); break; @@ -10442,7 +10442,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Error(originFunc, string.Format("Error running rule #{0} -> PRIM_NORMAL: arg #{1} - must be float", rulesParsed, idx - idxStart - 1)); return new LSL_List(); } - + float repeatX = (float)Util.Clamp(mnrepeat.x,-100.0, 100.0); float repeatY = (float)Util.Clamp(mnrepeat.y,-100.0, 100.0); float offsetX = (float)Util.Clamp(mnoffset.x, 0, 1.0); @@ -10544,7 +10544,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SPECULAR: arg #{1} - must be integer", rulesParsed, idx - idxStart - 1)); return new LSL_List(); } - + float srepeatX = (float)Util.Clamp(msrepeat.x, -100.0, 100.0); float srepeatY = (float)Util.Clamp(msrepeat.y, -100.0, 100.0); float soffsetX = (float)Util.Clamp(msoffset.x, -1.0, 1.0); @@ -10686,8 +10686,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if(m_materialsModule == null) return false; - - int nsides = part.GetNumberOfSides(); + + int nsides = part.GetNumberOfSides(); if(face == ScriptBaseClass.ALL_SIDES) { @@ -10741,8 +10741,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if(m_materialsModule == null) return false; - - int nsides = part.GetNumberOfSides(); + + int nsides = part.GetNumberOfSides(); if(face == ScriptBaseClass.ALL_SIDES) { @@ -10806,8 +10806,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if(m_materialsModule == null) return false; - - int nsides = part.GetNumberOfSides(); + + int nsides = part.GetNumberOfSides(); if(face == ScriptBaseClass.ALL_SIDES) { @@ -12896,7 +12896,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { try { - + if (m_regionName.Equals(simulator)) { string lreply = String.Empty; @@ -17886,7 +17886,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_List(); char first = ((string)json)[0]; - if(first != '[' && first !='{') + if(first != '[' && first !='{') { // we already have a single element LSL_List l = new LSL_List(); @@ -17920,7 +17920,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_List retl = new LSL_List(); if(elem == null) retl.Add((LSL_String)ScriptBaseClass.JSON_NULL); - + LitJson.JsonType elemType = elem.GetJsonType(); switch (elemType) { @@ -18041,7 +18041,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return "\"Inf\""; if(double.IsNaN(float_val)) return "\"NaN\""; - + return ((LSL_Float)float_val).ToString(); } if (o is LSL_Integer || o is int) @@ -18269,7 +18269,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api newData.SetJsonType(LitJson.JsonType.Array); newData.Add(JsonBuildRestOfSpec(specifiers, level + 1, val)); return newData; - } + } } else {