Fix minor race conditions in LSL_Api.GetPrimParams() for PRIM_POSITION, PRIM_SIZE and PRIM_ROT_LOCAL

This function is used by all the various ll*Params() and os*Params() functions
0.7.4-extended
Justin Clark-Casey (justincc) 2013-03-14 22:42:11 +00:00
parent b9d4266400
commit a935440513
1 changed files with 11 additions and 10 deletions

View File

@ -7957,23 +7957,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break; break;
case (int)ScriptBaseClass.PRIM_POSITION: case (int)ScriptBaseClass.PRIM_POSITION:
LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X, LSL_Vector v = new LSL_Vector(part.AbsolutePosition);
part.AbsolutePosition.Y,
part.AbsolutePosition.Z);
// For some reason, the part.AbsolutePosition.* values do not change if the // For some reason, the part.AbsolutePosition.* values do not change if the
// linkset is rotated; they always reflect the child prim's world position // linkset is rotated; they always reflect the child prim's world position
// as though the linkset is unrotated. This is incompatible behavior with SL's // as though the linkset is unrotated. This is incompatible behavior with SL's
// implementation, so will break scripts imported from there (not to mention it // implementation, so will break scripts imported from there (not to mention it
// makes it more difficult to determine a child prim's actual inworld position). // makes it more difficult to determine a child prim's actual inworld position).
if (part.ParentID != 0) if (!part.IsRoot)
v = ((v - llGetRootPosition()) * llGetRootRotation()) + llGetRootPosition(); {
LSL_Vector rootPos = new LSL_Vector(m_host.ParentGroup.AbsolutePosition);
v = ((v - rootPos) * llGetRootRotation()) + rootPos;
}
res.Add(v); res.Add(v);
break; break;
case (int)ScriptBaseClass.PRIM_SIZE: case (int)ScriptBaseClass.PRIM_SIZE:
res.Add(new LSL_Vector(part.Scale.X, res.Add(new LSL_Vector(part.Scale));
part.Scale.Y,
part.Scale.Z));
break; break;
case (int)ScriptBaseClass.PRIM_ROTATION: case (int)ScriptBaseClass.PRIM_ROTATION:
@ -8287,8 +8288,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_DESC: case (int)ScriptBaseClass.PRIM_DESC:
res.Add(new LSL_String(part.Description)); res.Add(new LSL_String(part.Description));
break; break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL: case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); res.Add(new LSL_Rotation(part.RotationOffset));
break; break;
case (int)ScriptBaseClass.PRIM_POS_LOCAL: case (int)ScriptBaseClass.PRIM_POS_LOCAL:
res.Add(new LSL_Vector(GetPartLocalPos(part))); res.Add(new LSL_Vector(GetPartLocalPos(part)));