aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs119
1 files changed, 62 insertions, 57 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 11dbae1..bbc2fd6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8743,45 +8743,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8743 } 8743 }
8744 } 8744 }
8745 8745
8746 protected void SetEntityParams(List<ISceneEntity> entities, LSL_List rules, string originFunc)
8747 {
8748 LSL_List remaining = new LSL_List();
8749 uint rulesParsed = 0;
8750
8751 foreach (ISceneEntity entity in entities)
8752 {
8753 if (entity is SceneObjectPart)
8754 remaining = SetPrimParams((SceneObjectPart)entity, rules, originFunc, ref rulesParsed);
8755 else
8756 remaining = SetAgentParams((ScenePresence)entity, rules, originFunc, ref rulesParsed);
8757 }
8758
8759 while (remaining.Length > 2)
8760 {
8761 int linknumber;
8762 try
8763 {
8764 linknumber = remaining.GetLSLIntegerItem(0);
8765 }
8766 catch(InvalidCastException)
8767 {
8768 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_LINK_TARGET: parameter 2 must be integer", rulesParsed));
8769 return;
8770 }
8771
8772 rules = remaining.GetSublist(1, -1);
8773 entities = GetLinkEntities(linknumber);
8774
8775 foreach (ISceneEntity entity in entities)
8776 {
8777 if (entity is SceneObjectPart)
8778 remaining = SetPrimParams((SceneObjectPart)entity, rules, originFunc, ref rulesParsed);
8779 else
8780 remaining = SetAgentParams((ScenePresence)entity, rules, originFunc, ref rulesParsed);
8781 }
8782 }
8783 }
8784
8785 public void llSetKeyframedMotion(LSL_List frames, LSL_List options) 8746 public void llSetKeyframedMotion(LSL_List frames, LSL_List options)
8786 { 8747 {
8787 SceneObjectGroup group = m_host.ParentGroup; 8748 SceneObjectGroup group = m_host.ParentGroup;
@@ -11301,7 +11262,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11301 int linknumber = remaining.GetLSLIntegerItem(0); 11262 int linknumber = remaining.GetLSLIntegerItem(0);
11302 rules = remaining.GetSublist(1, -1); 11263 rules = remaining.GetSublist(1, -1);
11303 List<SceneObjectPart> parts = GetLinkParts(linknumber); 11264 List<SceneObjectPart> parts = GetLinkParts(linknumber);
11304 11265 if(parts.Count == 0)
11266 break;
11305 foreach (SceneObjectPart part in parts) 11267 foreach (SceneObjectPart part in parts)
11306 remaining = GetPrimParams(part, rules, ref result); 11268 remaining = GetPrimParams(part, rules, ref result);
11307 } 11269 }
@@ -14852,35 +14814,78 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14852 14814
14853 public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc) 14815 public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc)
14854 { 14816 {
14855 SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); 14817 UUID id;
14856 if (obj == null) 14818 if (!UUID.TryParse(prim, out id))
14857 return; 14819 return;
14858 14820 SceneObjectPart obj = World.GetSceneObjectPart(id);
14859 if (obj.OwnerID != m_host.OwnerID) 14821 if (obj == null || obj.OwnerID != m_host.OwnerID)
14860 return; 14822 return;
14861 14823
14862 SetEntityParams(new List<ISceneEntity>() { obj }, rules, originFunc); 14824 uint rulesParsed = 0;
14825 LSL_List remaining = SetPrimParams(obj, rules, originFunc, ref rulesParsed);
14826
14827 while (remaining.Length > 2)
14828 {
14829 int linknumber;
14830 try
14831 {
14832 linknumber = remaining.GetLSLIntegerItem(0);
14833 }
14834 catch (InvalidCastException)
14835 {
14836 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_LINK_TARGET parameter must be integer", rulesParsed));
14837 return;
14838 }
14839
14840 List<ISceneEntity> entities = GetLinkEntities(obj, linknumber);
14841 if (entities.Count == 0)
14842 break;
14843
14844 rules = remaining.GetSublist(1, -1);
14845 foreach (ISceneEntity entity in entities)
14846 {
14847 if (entity is SceneObjectPart)
14848 remaining = SetPrimParams((SceneObjectPart)entity, rules, originFunc, ref rulesParsed);
14849 else
14850 remaining = SetAgentParams((ScenePresence)entity, rules, originFunc, ref rulesParsed);
14851 }
14852 }
14863 } 14853 }
14864 14854
14865 public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) 14855 public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules)
14866 { 14856 {
14867 SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim));
14868
14869 LSL_List result = new LSL_List(); 14857 LSL_List result = new LSL_List();
14870 14858
14871 if (obj != null && obj.OwnerID == m_host.OwnerID) 14859 UUID id;
14872 { 14860 if (!UUID.TryParse(prim, out id))
14873 LSL_List remaining = GetPrimParams(obj, rules, ref result); 14861 return result;
14874 14862
14875 while (remaining.Length > 2) 14863 SceneObjectPart obj = World.GetSceneObjectPart(id);
14876 { 14864 if (obj == null || obj.OwnerID != m_host.OwnerID)
14877 int linknumber = remaining.GetLSLIntegerItem(0); 14865 return result;
14878 rules = remaining.GetSublist(1, -1);
14879 List<SceneObjectPart> parts = GetLinkParts(linknumber);
14880 14866
14881 foreach (SceneObjectPart part in parts) 14867 LSL_List remaining = GetPrimParams(obj, rules, ref result);
14882 remaining = GetPrimParams(part, rules, ref result); 14868
14869 while (remaining.Length > 2)
14870 {
14871 int linknumber;
14872 try
14873 {
14874 linknumber = remaining.GetLSLIntegerItem(0);
14883 } 14875 }
14876 catch (InvalidCastException)
14877 {
14878 Error("", string.Format("Error PRIM_LINK_TARGET: parameter must be integer"));
14879 return result;
14880 }
14881
14882 List<SceneObjectPart> parts = GetLinkParts(obj, linknumber);
14883 if(parts.Count == 0)
14884 break;
14885
14886 rules = remaining.GetSublist(1, -1);
14887 foreach (SceneObjectPart part in parts)
14888 remaining = GetPrimParams(part, rules, ref result);
14884 } 14889 }
14885 14890
14886 return result; 14891 return result;