revert change on script execution release points. That will need a full recompile with script states reset, not justifiable by now; plus cosmetics

This commit is contained in:
UbitUmarov
2023-02-16 05:04:11 +00:00
parent f41ff1419c
commit be2192fd53
9 changed files with 275 additions and 305 deletions

View File

@@ -1037,7 +1037,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s;
// m is always greater than zero
// if m is not equal to 1 then Rotation needs to be normalized
if (Math.Abs(1.0 - m) > 0.000001) // allow a little slop here for calculation precision
if (Math.Abs(1.0 - m) > 0.000001)
{
m = 1.0 / Math.Sqrt(m);
r.x *= m;
@@ -5455,8 +5455,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (item is LSL_Integer LSL_Integeritem)
return LSL_Integeritem;
else if (item is LSL_Float LSL_Floatitem)
return Convert.ToInt32(LSL_Floatitem.value);
if (item is LSL_Float LSL_Floatitem)
return new LSL_Integer(LSL_Floatitem.value);
return new LSL_Integer(item.ToString());
}
catch (FormatException)
@@ -5492,11 +5492,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
try
{
if (item is LSL_Integer intitem)
return Convert.ToDouble(intitem.value);
else if (item is LSL_Float floatitem)
return Convert.ToDouble(floatitem.value);
else if (item is LSL_String lstringitem)
if (item is LSL_Integer intitem)
return new LSL_Float(intitem.value);
if (item is LSL_Float floatitem)
return floatitem;
if (item is LSL_String lstringitem)
{
Match m = Regex.Match(lstringitem.m_string, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)");
if (m != Match.Empty)
@@ -5558,26 +5558,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
index = src.Length + index;
if (index >= src.Length || index < 0)
return new LSL_Vector();
return LSL_Vector.Zero;
object item = src.Data[index];
if (item.GetType() == typeof(LSL_Vector))
return (LSL_Vector)item;
//if (item.GetType() == typeof(LSL_Vector))
// return (LSL_Vector)item;
// SL spits always out ZERO_VECTOR for anything other than
// strings or vectors. Although keys always return ZERO_VECTOR,
// it is currently difficult to make the distinction between
// 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 vec)
if(item is LSL_Vector vec)
return vec;
if (item is LSL_String || item is string) // xengine sees string
return new LSL_Vector(item.ToString());
if (item is LSL_String lsv)
return new LSL_Vector(lsv.m_string);
if (item is string sv) // xengine sees string
return new LSL_Vector(sv);
return new LSL_Vector(0, 0, 0);
return LSL_Vector.Zero;
}
public LSL_Rotation llList2Rot(LSL_List src, int index)