add suport for PRIM_SIT_TARGET on Set(link)PrimitveParameters. This may not be SL compatible. hack: to let active work with zero offset and rotation add a little Z value to offset

melanie
UbitUmarov 2016-11-05 18:28:30 +00:00
parent 060350832a
commit 1c7b688db4
2 changed files with 54 additions and 2 deletions

View File

@ -10084,6 +10084,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.UpdateSlice((float)slice.x, (float)slice.y);
break;
case ScriptBaseClass.PRIM_SIT_TARGET:
if (remain < 3)
return new LSL_List();
int active;
try
{
active = rules.GetLSLIntegerItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
LSL_Vector offset;
try
{
offset = rules.GetVector3Item(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
LSL_Rotation sitrot;
try
{
sitrot = rules.GetQuaternionItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 3 must be rotation", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
// not SL compatible since we don't have a independent flag to control active target but use the values of offset and rotation
if(active == 1)
{
if(offset.x == 0 && offset.y == 0 && offset.z == 0 && sitrot.s == 1.0)
offset.z = 1e-5f; // hack
SitTarget(part,offset,sitrot);
}
else if(active == 0)
SitTarget(part, Vector3.Zero , Quaternion.Identity);
break;
case ScriptBaseClass.PRIM_LINK_TARGET:
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
return new LSL_List();
@ -15932,6 +15979,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_TEXT:
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
case (int)ScriptBaseClass.PRIM_OMEGA:
case (int)ScriptBaseClass.PRIM_SIT_TARGET:
if (remain < 3)
return new LSL_List();
idx += 3;

View File

@ -704,12 +704,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
{
if (Data[itemIndex] is LSL_Types.Quaternion)
{
return (LSL_Types.Quaternion)Data[itemIndex];
LSL_Types.Quaternion q = (LSL_Types.Quaternion)Data[itemIndex];
q.Normalize();
return q;
}
else if(Data[itemIndex] is OpenMetaverse.Quaternion)
{
return new LSL_Types.Quaternion(
LSL_Types.Quaternion q = new LSL_Types.Quaternion(
(OpenMetaverse.Quaternion)Data[itemIndex]);
q.Normalize();
return q;
}
else
{