diff options
author | UbitUmarov | 2016-11-05 18:28:30 +0000 |
---|---|---|
committer | UbitUmarov | 2016-11-05 18:28:30 +0000 |
commit | 1c7b688db4e78c24058a2f7e24afca2eb751bec4 (patch) | |
tree | 55fe1e6d078c3a3eeb6a5b3c243b28bbd6ed1cdd /OpenSim/Region/ScriptEngine/Shared | |
parent | add suport for PRIM_SIT_TARGET on get(link)PrimitveParameters and fix typos (diff) | |
download | opensim-SC-1c7b688db4e78c24058a2f7e24afca2eb751bec4.zip opensim-SC-1c7b688db4e78c24058a2f7e24afca2eb751bec4.tar.gz opensim-SC-1c7b688db4e78c24058a2f7e24afca2eb751bec4.tar.bz2 opensim-SC-1c7b688db4e78c24058a2f7e24afca2eb751bec4.tar.xz |
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
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 48 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 8 |
2 files changed, 54 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 91b49cd..ba22201 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10084,6 +10084,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10084 | part.UpdateSlice((float)slice.x, (float)slice.y); | 10084 | part.UpdateSlice((float)slice.x, (float)slice.y); |
10085 | break; | 10085 | break; |
10086 | 10086 | ||
10087 | case ScriptBaseClass.PRIM_SIT_TARGET: | ||
10088 | if (remain < 3) | ||
10089 | return new LSL_List(); | ||
10090 | |||
10091 | int active; | ||
10092 | try | ||
10093 | { | ||
10094 | active = rules.GetLSLIntegerItem(idx++); | ||
10095 | } | ||
10096 | catch(InvalidCastException) | ||
10097 | { | ||
10098 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1)); | ||
10099 | return new LSL_List(); | ||
10100 | } | ||
10101 | LSL_Vector offset; | ||
10102 | try | ||
10103 | { | ||
10104 | offset = rules.GetVector3Item(idx++); | ||
10105 | } | ||
10106 | catch(InvalidCastException) | ||
10107 | { | ||
10108 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1)); | ||
10109 | return new LSL_List(); | ||
10110 | } | ||
10111 | LSL_Rotation sitrot; | ||
10112 | try | ||
10113 | { | ||
10114 | sitrot = rules.GetQuaternionItem(idx++); | ||
10115 | } | ||
10116 | catch(InvalidCastException) | ||
10117 | { | ||
10118 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 3 must be rotation", rulesParsed, idx - idxStart - 1)); | ||
10119 | return new LSL_List(); | ||
10120 | } | ||
10121 | |||
10122 | // not SL compatible since we don't have a independent flag to control active target but use the values of offset and rotation | ||
10123 | if(active == 1) | ||
10124 | { | ||
10125 | if(offset.x == 0 && offset.y == 0 && offset.z == 0 && sitrot.s == 1.0) | ||
10126 | offset.z = 1e-5f; // hack | ||
10127 | SitTarget(part,offset,sitrot); | ||
10128 | } | ||
10129 | else if(active == 0) | ||
10130 | SitTarget(part, Vector3.Zero , Quaternion.Identity); | ||
10131 | |||
10132 | break; | ||
10133 | |||
10087 | case ScriptBaseClass.PRIM_LINK_TARGET: | 10134 | case ScriptBaseClass.PRIM_LINK_TARGET: |
10088 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 10135 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
10089 | return new LSL_List(); | 10136 | return new LSL_List(); |
@@ -15932,6 +15979,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
15932 | case (int)ScriptBaseClass.PRIM_TEXT: | 15979 | case (int)ScriptBaseClass.PRIM_TEXT: |
15933 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 15980 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
15934 | case (int)ScriptBaseClass.PRIM_OMEGA: | 15981 | case (int)ScriptBaseClass.PRIM_OMEGA: |
15982 | case (int)ScriptBaseClass.PRIM_SIT_TARGET: | ||
15935 | if (remain < 3) | 15983 | if (remain < 3) |
15936 | return new LSL_List(); | 15984 | return new LSL_List(); |
15937 | idx += 3; | 15985 | idx += 3; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 9fb1e2c..c36e7c6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -704,12 +704,16 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
704 | { | 704 | { |
705 | if (Data[itemIndex] is LSL_Types.Quaternion) | 705 | if (Data[itemIndex] is LSL_Types.Quaternion) |
706 | { | 706 | { |
707 | return (LSL_Types.Quaternion)Data[itemIndex]; | 707 | LSL_Types.Quaternion q = (LSL_Types.Quaternion)Data[itemIndex]; |
708 | q.Normalize(); | ||
709 | return q; | ||
708 | } | 710 | } |
709 | else if(Data[itemIndex] is OpenMetaverse.Quaternion) | 711 | else if(Data[itemIndex] is OpenMetaverse.Quaternion) |
710 | { | 712 | { |
711 | return new LSL_Types.Quaternion( | 713 | LSL_Types.Quaternion q = new LSL_Types.Quaternion( |
712 | (OpenMetaverse.Quaternion)Data[itemIndex]); | 714 | (OpenMetaverse.Quaternion)Data[itemIndex]); |
715 | q.Normalize(); | ||
716 | return q; | ||
713 | } | 717 | } |
714 | else | 718 | else |
715 | { | 719 | { |