diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 375 |
1 files changed, 212 insertions, 163 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ce1c364..d6aafaf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -226,6 +226,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
226 | public void llResetScript() | 226 | public void llResetScript() |
227 | { | 227 | { |
228 | m_host.AddScriptLPS(1); | 228 | m_host.AddScriptLPS(1); |
229 | |||
230 | // We need to tell the URL module, if we hav one, to release | ||
231 | // the allocated URLs | ||
232 | if (m_UrlModule != null) | ||
233 | m_UrlModule.ScriptRemoved(m_item.ItemID); | ||
234 | |||
229 | m_ScriptEngine.ApiResetScript(m_item.ItemID); | 235 | m_ScriptEngine.ApiResetScript(m_item.ItemID); |
230 | } | 236 | } |
231 | 237 | ||
@@ -332,34 +338,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
332 | 338 | ||
333 | public List<SceneObjectPart> GetLinkParts(int linkType) | 339 | public List<SceneObjectPart> GetLinkParts(int linkType) |
334 | { | 340 | { |
341 | return GetLinkParts(m_host, linkType); | ||
342 | } | ||
343 | |||
344 | private List<SceneObjectPart> GetLinkParts(SceneObjectPart part, int linkType) | ||
345 | { | ||
335 | List<SceneObjectPart> ret = new List<SceneObjectPart>(); | 346 | List<SceneObjectPart> ret = new List<SceneObjectPart>(); |
336 | if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted) | 347 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
337 | return ret; | 348 | return ret; |
338 | ret.Add(m_host); | 349 | ret.Add(part); |
339 | 350 | ||
340 | switch (linkType) | 351 | switch (linkType) |
341 | { | 352 | { |
342 | case ScriptBaseClass.LINK_SET: | 353 | case ScriptBaseClass.LINK_SET: |
343 | return new List<SceneObjectPart>(m_host.ParentGroup.Parts); | 354 | return new List<SceneObjectPart>(part.ParentGroup.Parts); |
344 | 355 | ||
345 | case ScriptBaseClass.LINK_ROOT: | 356 | case ScriptBaseClass.LINK_ROOT: |
346 | ret = new List<SceneObjectPart>(); | 357 | ret = new List<SceneObjectPart>(); |
347 | ret.Add(m_host.ParentGroup.RootPart); | 358 | ret.Add(part.ParentGroup.RootPart); |
348 | return ret; | 359 | return ret; |
349 | 360 | ||
350 | case ScriptBaseClass.LINK_ALL_OTHERS: | 361 | case ScriptBaseClass.LINK_ALL_OTHERS: |
351 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); | 362 | ret = new List<SceneObjectPart>(part.ParentGroup.Parts); |
352 | 363 | ||
353 | if (ret.Contains(m_host)) | 364 | if (ret.Contains(part)) |
354 | ret.Remove(m_host); | 365 | ret.Remove(part); |
355 | 366 | ||
356 | return ret; | 367 | return ret; |
357 | 368 | ||
358 | case ScriptBaseClass.LINK_ALL_CHILDREN: | 369 | case ScriptBaseClass.LINK_ALL_CHILDREN: |
359 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); | 370 | ret = new List<SceneObjectPart>(part.ParentGroup.Parts); |
360 | 371 | ||
361 | if (ret.Contains(m_host.ParentGroup.RootPart)) | 372 | if (ret.Contains(part.ParentGroup.RootPart)) |
362 | ret.Remove(m_host.ParentGroup.RootPart); | 373 | ret.Remove(part.ParentGroup.RootPart); |
363 | return ret; | 374 | return ret; |
364 | 375 | ||
365 | case ScriptBaseClass.LINK_THIS: | 376 | case ScriptBaseClass.LINK_THIS: |
@@ -369,7 +380,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
369 | if (linkType < 0) | 380 | if (linkType < 0) |
370 | return new List<SceneObjectPart>(); | 381 | return new List<SceneObjectPart>(); |
371 | 382 | ||
372 | SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType); | 383 | SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType); |
373 | if (target == null) | 384 | if (target == null) |
374 | return new List<SceneObjectPart>(); | 385 | return new List<SceneObjectPart>(); |
375 | ret = new List<SceneObjectPart>(); | 386 | ret = new List<SceneObjectPart>(); |
@@ -1764,13 +1775,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1764 | { | 1775 | { |
1765 | try | 1776 | try |
1766 | { | 1777 | { |
1767 | parts[0].ParentGroup.areUpdatesSuspended = true; | ||
1768 | foreach (SceneObjectPart part in parts) | 1778 | foreach (SceneObjectPart part in parts) |
1769 | SetAlpha(part, alpha, face); | 1779 | SetAlpha(part, alpha, face); |
1770 | } | 1780 | } |
1771 | finally | 1781 | finally |
1772 | { | 1782 | { |
1773 | parts[0].ParentGroup.areUpdatesSuspended = false; | ||
1774 | } | 1783 | } |
1775 | } | 1784 | } |
1776 | } | 1785 | } |
@@ -1951,13 +1960,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1951 | { | 1960 | { |
1952 | try | 1961 | try |
1953 | { | 1962 | { |
1954 | parts[0].ParentGroup.areUpdatesSuspended = true; | ||
1955 | foreach (SceneObjectPart part in parts) | 1963 | foreach (SceneObjectPart part in parts) |
1956 | SetTexture(part, texture, face); | 1964 | SetTexture(part, texture, face); |
1957 | } | 1965 | } |
1958 | finally | 1966 | finally |
1959 | { | 1967 | { |
1960 | parts[0].ParentGroup.areUpdatesSuspended = false; | ||
1961 | } | 1968 | } |
1962 | } | 1969 | } |
1963 | ScriptSleep(200); | 1970 | ScriptSleep(200); |
@@ -3340,7 +3347,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3340 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3347 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3341 | 3348 | ||
3342 | if (attachmentsModule != null) | 3349 | if (attachmentsModule != null) |
3343 | return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false, true); | 3350 | return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false, true, false); |
3344 | else | 3351 | else |
3345 | return false; | 3352 | return false; |
3346 | } | 3353 | } |
@@ -3747,29 +3754,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3747 | 3754 | ||
3748 | m_host.AddScriptLPS(1); | 3755 | m_host.AddScriptLPS(1); |
3749 | 3756 | ||
3757 | int implicitPerms = 0; | ||
3758 | |||
3750 | if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar) | 3759 | if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar) |
3751 | { | 3760 | { |
3752 | // When attached, certain permissions are implicit if requested from owner | 3761 | // When attached, certain permissions are implicit if requested from owner |
3753 | int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | | 3762 | implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | |
3754 | ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | | 3763 | ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | |
3755 | ScriptBaseClass.PERMISSION_CONTROL_CAMERA | | 3764 | ScriptBaseClass.PERMISSION_CONTROL_CAMERA | |
3756 | ScriptBaseClass.PERMISSION_TRACK_CAMERA | | 3765 | ScriptBaseClass.PERMISSION_TRACK_CAMERA | |
3757 | ScriptBaseClass.PERMISSION_ATTACH; | 3766 | ScriptBaseClass.PERMISSION_ATTACH; |
3758 | 3767 | ||
3759 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | ||
3760 | { | ||
3761 | m_host.TaskInventory.LockItemsForWrite(true); | ||
3762 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; | ||
3763 | m_host.TaskInventory[m_item.ItemID].PermsMask = perm; | ||
3764 | m_host.TaskInventory.LockItemsForWrite(false); | ||
3765 | |||
3766 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( | ||
3767 | "run_time_permissions", new Object[] { | ||
3768 | new LSL_Integer(perm) }, | ||
3769 | new DetectParams[0])); | ||
3770 | |||
3771 | return; | ||
3772 | } | ||
3773 | } | 3768 | } |
3774 | else | 3769 | else |
3775 | { | 3770 | { |
@@ -3790,26 +3785,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3790 | if (sitting) | 3785 | if (sitting) |
3791 | { | 3786 | { |
3792 | // When agent is sitting, certain permissions are implicit if requested from sitting agent | 3787 | // When agent is sitting, certain permissions are implicit if requested from sitting agent |
3793 | int implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | | 3788 | implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | |
3794 | ScriptBaseClass.PERMISSION_CONTROL_CAMERA | | 3789 | ScriptBaseClass.PERMISSION_CONTROL_CAMERA | |
3795 | ScriptBaseClass.PERMISSION_TRACK_CAMERA | | 3790 | ScriptBaseClass.PERMISSION_TRACK_CAMERA | |
3796 | ScriptBaseClass.PERMISSION_TAKE_CONTROLS; | 3791 | ScriptBaseClass.PERMISSION_TAKE_CONTROLS; |
3792 | } | ||
3793 | else | ||
3794 | { | ||
3795 | if (World.GetExtraSetting("auto_grant_attach_perms") == "true") | ||
3796 | implicitPerms = ScriptBaseClass.PERMISSION_ATTACH; | ||
3797 | } | ||
3798 | } | ||
3797 | 3799 | ||
3798 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | 3800 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms |
3799 | { | 3801 | { |
3800 | m_host.TaskInventory.LockItemsForWrite(true); | 3802 | m_host.TaskInventory.LockItemsForWrite(true); |
3801 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; | 3803 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; |
3802 | m_host.TaskInventory[m_item.ItemID].PermsMask = perm; | 3804 | m_host.TaskInventory[m_item.ItemID].PermsMask = perm; |
3803 | m_host.TaskInventory.LockItemsForWrite(false); | 3805 | m_host.TaskInventory.LockItemsForWrite(false); |
3804 | 3806 | ||
3805 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( | 3807 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
3806 | "run_time_permissions", new Object[] { | 3808 | "run_time_permissions", new Object[] { |
3807 | new LSL_Integer(perm) }, | 3809 | new LSL_Integer(perm) }, |
3808 | new DetectParams[0])); | 3810 | new DetectParams[0])); |
3809 | 3811 | ||
3810 | return; | 3812 | return; |
3811 | } | ||
3812 | } | ||
3813 | } | 3813 | } |
3814 | 3814 | ||
3815 | ScenePresence presence = World.GetScenePresence(agentID); | 3815 | ScenePresence presence = World.GetScenePresence(agentID); |
@@ -3927,13 +3927,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3927 | { | 3927 | { |
3928 | try | 3928 | try |
3929 | { | 3929 | { |
3930 | parts[0].ParentGroup.areUpdatesSuspended = true; | ||
3931 | foreach (SceneObjectPart part in parts) | 3930 | foreach (SceneObjectPart part in parts) |
3932 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); | 3931 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); |
3933 | } | 3932 | } |
3934 | finally | 3933 | finally |
3935 | { | 3934 | { |
3936 | parts[0].ParentGroup.areUpdatesSuspended = false; | ||
3937 | } | 3935 | } |
3938 | } | 3936 | } |
3939 | } | 3937 | } |
@@ -4051,7 +4049,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4051 | { | 4049 | { |
4052 | try | 4050 | try |
4053 | { | 4051 | { |
4054 | parts[0].ParentGroup.areUpdatesSuspended = true; | ||
4055 | foreach (SceneObjectPart part in parts) | 4052 | foreach (SceneObjectPart part in parts) |
4056 | { | 4053 | { |
4057 | parentPrim.DelinkFromGroup(part.LocalId, true); | 4054 | parentPrim.DelinkFromGroup(part.LocalId, true); |
@@ -4059,7 +4056,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4059 | } | 4056 | } |
4060 | finally | 4057 | finally |
4061 | { | 4058 | { |
4062 | parts[0].ParentGroup.areUpdatesSuspended = false; | ||
4063 | } | 4059 | } |
4064 | } | 4060 | } |
4065 | 4061 | ||
@@ -4074,7 +4070,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4074 | 4070 | ||
4075 | try | 4071 | try |
4076 | { | 4072 | { |
4077 | parts[0].ParentGroup.areUpdatesSuspended = true; | ||
4078 | foreach (SceneObjectPart part in parts) | 4073 | foreach (SceneObjectPart part in parts) |
4079 | { | 4074 | { |
4080 | part.ClearUpdateSchedule(); | 4075 | part.ClearUpdateSchedule(); |
@@ -4083,7 +4078,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4083 | } | 4078 | } |
4084 | finally | 4079 | finally |
4085 | { | 4080 | { |
4086 | parts[0].ParentGroup.areUpdatesSuspended = false; | ||
4087 | } | 4081 | } |
4088 | 4082 | ||
4089 | 4083 | ||
@@ -5369,12 +5363,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5369 | { | 5363 | { |
5370 | return 0; | 5364 | return 0; |
5371 | } | 5365 | } |
5366 | |||
5367 | // Vectors & Rotations always return zero in SL, but | ||
5368 | // keys don't always return zero, it seems to be a bit complex. | ||
5369 | else if (src.Data[index] is LSL_Vector || | ||
5370 | src.Data[index] is LSL_Rotation) | ||
5371 | { | ||
5372 | return 0; | ||
5373 | } | ||
5372 | try | 5374 | try |
5373 | { | 5375 | { |
5376 | |||
5374 | if (src.Data[index] is LSL_Integer) | 5377 | if (src.Data[index] is LSL_Integer) |
5375 | return (LSL_Integer) src.Data[index]; | 5378 | return (LSL_Integer)src.Data[index]; |
5376 | else if (src.Data[index] is LSL_Float) | 5379 | else if (src.Data[index] is LSL_Float) |
5377 | return Convert.ToInt32(((LSL_Float) src.Data[index]).value); | 5380 | return Convert.ToInt32(((LSL_Float)src.Data[index]).value); |
5378 | return new LSL_Integer(src.Data[index].ToString()); | 5381 | return new LSL_Integer(src.Data[index].ToString()); |
5379 | } | 5382 | } |
5380 | catch (FormatException) | 5383 | catch (FormatException) |
@@ -5394,12 +5397,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5394 | { | 5397 | { |
5395 | return 0.0; | 5398 | return 0.0; |
5396 | } | 5399 | } |
5400 | |||
5401 | // Vectors & Rotations always return zero in SL | ||
5402 | else if (src.Data[index] is LSL_Vector || | ||
5403 | src.Data[index] is LSL_Rotation) | ||
5404 | { | ||
5405 | return 0; | ||
5406 | } | ||
5407 | // valid keys seem to get parsed as integers then converted to floats | ||
5408 | else | ||
5409 | { | ||
5410 | UUID uuidt; | ||
5411 | if (src.Data[index] is LSL_Key && UUID.TryParse(src.Data[index].ToString(), out uuidt)) | ||
5412 | { | ||
5413 | return Convert.ToDouble(new LSL_Integer(src.Data[index].ToString()).value); | ||
5414 | } | ||
5415 | } | ||
5397 | try | 5416 | try |
5398 | { | 5417 | { |
5399 | if (src.Data[index] is LSL_Integer) | 5418 | if (src.Data[index] is LSL_Integer) |
5400 | return Convert.ToDouble(((LSL_Integer) src.Data[index]).value); | 5419 | return Convert.ToDouble(((LSL_Integer)src.Data[index]).value); |
5401 | else if (src.Data[index] is LSL_Float) | 5420 | else if (src.Data[index] is LSL_Float) |
5402 | return Convert.ToDouble(((LSL_Float) src.Data[index]).value); | 5421 | return Convert.ToDouble(((LSL_Float)src.Data[index]).value); |
5403 | else if (src.Data[index] is LSL_String) | 5422 | else if (src.Data[index] is LSL_String) |
5404 | { | 5423 | { |
5405 | string str = ((LSL_String) src.Data[index]).m_string; | 5424 | string str = ((LSL_String) src.Data[index]).m_string; |
@@ -5437,17 +5456,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5437 | return src.Data[index].ToString(); | 5456 | return src.Data[index].ToString(); |
5438 | } | 5457 | } |
5439 | 5458 | ||
5440 | public LSL_String llList2Key(LSL_List src, int index) | 5459 | public LSL_Key llList2Key(LSL_List src, int index) |
5441 | { | 5460 | { |
5442 | m_host.AddScriptLPS(1); | 5461 | m_host.AddScriptLPS(1); |
5443 | if (index < 0) | 5462 | if (index < 0) |
5444 | { | 5463 | { |
5445 | index = src.Length + index; | 5464 | index = src.Length + index; |
5446 | } | 5465 | } |
5466 | |||
5447 | if (index >= src.Length || index < 0) | 5467 | if (index >= src.Length || index < 0) |
5448 | { | 5468 | { |
5449 | return ""; | 5469 | return ""; |
5450 | } | 5470 | } |
5471 | |||
5472 | // SL spits out an empty string for types other than key & string | ||
5473 | // At the time of patching, LSL_Key is currently LSL_String, | ||
5474 | // so the OR check may be a little redundant, but it's being done | ||
5475 | // for completion and should LSL_Key ever be implemented | ||
5476 | // as it's own struct | ||
5477 | else if (!(src.Data[index] is LSL_String || | ||
5478 | src.Data[index] is LSL_Key)) | ||
5479 | { | ||
5480 | return ""; | ||
5481 | } | ||
5482 | |||
5451 | return src.Data[index].ToString(); | 5483 | return src.Data[index].ToString(); |
5452 | } | 5484 | } |
5453 | 5485 | ||
@@ -5466,6 +5498,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5466 | { | 5498 | { |
5467 | return (LSL_Vector)src.Data[index]; | 5499 | return (LSL_Vector)src.Data[index]; |
5468 | } | 5500 | } |
5501 | |||
5502 | // SL spits always out ZERO_VECTOR for anything other than | ||
5503 | // strings or vectors. Although keys always return ZERO_VECTOR, | ||
5504 | // it is currently difficult to make the distinction between | ||
5505 | // a string, a key as string and a string that by coincidence | ||
5506 | // is a string, so we're going to leave that up to the | ||
5507 | // LSL_Vector constructor. | ||
5508 | else if (!(src.Data[index] is LSL_String || | ||
5509 | src.Data[index] is LSL_Vector)) | ||
5510 | { | ||
5511 | return new LSL_Vector(0, 0, 0); | ||
5512 | } | ||
5469 | else | 5513 | else |
5470 | { | 5514 | { |
5471 | return new LSL_Vector(src.Data[index].ToString()); | 5515 | return new LSL_Vector(src.Data[index].ToString()); |
@@ -5483,7 +5527,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5483 | { | 5527 | { |
5484 | return new LSL_Rotation(0, 0, 0, 1); | 5528 | return new LSL_Rotation(0, 0, 0, 1); |
5485 | } | 5529 | } |
5486 | if (src.Data[index].GetType() == typeof(LSL_Rotation)) | 5530 | |
5531 | // SL spits always out ZERO_ROTATION for anything other than | ||
5532 | // strings or vectors. Although keys always return ZERO_ROTATION, | ||
5533 | // it is currently difficult to make the distinction between | ||
5534 | // a string, a key as string and a string that by coincidence | ||
5535 | // is a string, so we're going to leave that up to the | ||
5536 | // LSL_Rotation constructor. | ||
5537 | else if (!(src.Data[index] is LSL_String || | ||
5538 | src.Data[index] is LSL_Rotation)) | ||
5539 | { | ||
5540 | return new LSL_Rotation(0, 0, 0, 1); | ||
5541 | } | ||
5542 | else if (src.Data[index].GetType() == typeof(LSL_Rotation)) | ||
5487 | { | 5543 | { |
5488 | return (LSL_Rotation)src.Data[index]; | 5544 | return (LSL_Rotation)src.Data[index]; |
5489 | } | 5545 | } |
@@ -6236,7 +6292,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6236 | { | 6292 | { |
6237 | try | 6293 | try |
6238 | { | 6294 | { |
6239 | parts[0].ParentGroup.areUpdatesSuspended = true; | ||
6240 | foreach (var part in parts) | 6295 | foreach (var part in parts) |
6241 | { | 6296 | { |
6242 | SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); | 6297 | SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); |
@@ -6244,7 +6299,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6244 | } | 6299 | } |
6245 | finally | 6300 | finally |
6246 | { | 6301 | { |
6247 | parts[0].ParentGroup.areUpdatesSuspended = false; | ||
6248 | } | 6302 | } |
6249 | } | 6303 | } |
6250 | } | 6304 | } |
@@ -7689,7 +7743,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7689 | public void llSetPrimitiveParams(LSL_List rules) | 7743 | public void llSetPrimitiveParams(LSL_List rules) |
7690 | { | 7744 | { |
7691 | m_host.AddScriptLPS(1); | 7745 | m_host.AddScriptLPS(1); |
7692 | SetPrimParams(m_host, rules); | 7746 | |
7747 | setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules); | ||
7693 | 7748 | ||
7694 | ScriptSleep(200); | 7749 | ScriptSleep(200); |
7695 | } | 7750 | } |
@@ -7703,26 +7758,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7703 | 7758 | ||
7704 | private void setLinkPrimParams(int linknumber, LSL_List rules) | 7759 | private void setLinkPrimParams(int linknumber, LSL_List rules) |
7705 | { | 7760 | { |
7706 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 7761 | List<object> parts = new List<object>(); |
7762 | List<SceneObjectPart> prims = GetLinkParts(linknumber); | ||
7707 | List<ScenePresence> avatars = GetLinkAvatars(linknumber); | 7763 | List<ScenePresence> avatars = GetLinkAvatars(linknumber); |
7708 | if (parts.Count>0) | 7764 | foreach (SceneObjectPart p in prims) |
7765 | parts.Add(p); | ||
7766 | foreach (ScenePresence p in avatars) | ||
7767 | parts.Add(p); | ||
7768 | |||
7769 | LSL_List remaining = null; | ||
7770 | |||
7771 | if (parts.Count > 0) | ||
7709 | { | 7772 | { |
7710 | try | 7773 | foreach (object part in parts) |
7711 | { | 7774 | { |
7712 | parts[0].ParentGroup.areUpdatesSuspended = true; | 7775 | if (part is SceneObjectPart) |
7713 | foreach (SceneObjectPart part in parts) | 7776 | remaining = SetPrimParams((SceneObjectPart)part, rules); |
7714 | SetPrimParams(part, rules); | 7777 | else |
7778 | remaining = SetPrimParams((ScenePresence)part, rules); | ||
7715 | } | 7779 | } |
7716 | finally | 7780 | |
7781 | while((object)remaining != null && remaining.Length > 2) | ||
7717 | { | 7782 | { |
7718 | parts[0].ParentGroup.areUpdatesSuspended = false; | 7783 | linknumber = remaining.GetLSLIntegerItem(0); |
7784 | rules = remaining.GetSublist(1,-1); | ||
7785 | parts.Clear(); | ||
7786 | prims = GetLinkParts(linknumber); | ||
7787 | avatars = GetLinkAvatars(linknumber); | ||
7788 | foreach (SceneObjectPart p in prims) | ||
7789 | parts.Add(p); | ||
7790 | foreach (ScenePresence p in avatars) | ||
7791 | parts.Add(p); | ||
7792 | |||
7793 | foreach (object part in parts) | ||
7794 | { | ||
7795 | if (part is SceneObjectPart) | ||
7796 | remaining = SetPrimParams((SceneObjectPart)part, rules); | ||
7797 | else | ||
7798 | remaining = SetPrimParams((ScenePresence)part, rules); | ||
7799 | } | ||
7719 | } | 7800 | } |
7720 | } | 7801 | } |
7721 | if (avatars.Count > 0) | ||
7722 | { | ||
7723 | foreach (ScenePresence avatar in avatars) | ||
7724 | SetPrimParams(avatar, rules); | ||
7725 | } | ||
7726 | } | 7802 | } |
7727 | 7803 | ||
7728 | private void SetPhysicsMaterial(SceneObjectPart part, int material_bits, | 7804 | private void SetPhysicsMaterial(SceneObjectPart part, int material_bits, |
@@ -7784,7 +7860,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7784 | return new Vector3((float)x, (float)y, (float)z); | 7860 | return new Vector3((float)x, (float)y, (float)z); |
7785 | } | 7861 | } |
7786 | 7862 | ||
7787 | protected void SetPrimParams(ScenePresence av, LSL_List rules) | 7863 | protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules) |
7788 | { | 7864 | { |
7789 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. | 7865 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. |
7790 | 7866 | ||
@@ -7807,7 +7883,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7807 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 7883 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
7808 | { | 7884 | { |
7809 | if (remain < 1) | 7885 | if (remain < 1) |
7810 | return; | 7886 | return null; |
7811 | 7887 | ||
7812 | LSL_Vector v; | 7888 | LSL_Vector v; |
7813 | v = rules.GetVector3Item(idx++); | 7889 | v = rules.GetVector3Item(idx++); |
@@ -7841,7 +7917,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7841 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7917 | case (int)ScriptBaseClass.PRIM_ROTATION: |
7842 | { | 7918 | { |
7843 | if (remain < 1) | 7919 | if (remain < 1) |
7844 | return; | 7920 | return null; |
7845 | 7921 | ||
7846 | LSL_Rotation r; | 7922 | LSL_Rotation r; |
7847 | r = rules.GetQuaternionItem(idx++); | 7923 | r = rules.GetQuaternionItem(idx++); |
@@ -7872,7 +7948,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7872 | case (int)ScriptBaseClass.PRIM_NAME: | 7948 | case (int)ScriptBaseClass.PRIM_NAME: |
7873 | case (int)ScriptBaseClass.PRIM_DESC: | 7949 | case (int)ScriptBaseClass.PRIM_DESC: |
7874 | if (remain < 1) | 7950 | if (remain < 1) |
7875 | return; | 7951 | return null; |
7876 | idx++; | 7952 | idx++; |
7877 | break; | 7953 | break; |
7878 | 7954 | ||
@@ -7880,13 +7956,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7880 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 7956 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
7881 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 7957 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
7882 | if (remain < 2) | 7958 | if (remain < 2) |
7883 | return; | 7959 | return null; |
7884 | idx += 2; | 7960 | idx += 2; |
7885 | break; | 7961 | break; |
7886 | 7962 | ||
7887 | case (int)ScriptBaseClass.PRIM_TYPE: | 7963 | case (int)ScriptBaseClass.PRIM_TYPE: |
7888 | if (remain < 3) | 7964 | if (remain < 3) |
7889 | return; | 7965 | return null; |
7890 | code = (int)rules.GetLSLIntegerItem(idx++); | 7966 | code = (int)rules.GetLSLIntegerItem(idx++); |
7891 | remain = rules.Length - idx; | 7967 | remain = rules.Length - idx; |
7892 | switch (code) | 7968 | switch (code) |
@@ -7895,13 +7971,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7895 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | 7971 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: |
7896 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | 7972 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: |
7897 | if (remain < 6) | 7973 | if (remain < 6) |
7898 | return; | 7974 | return null; |
7899 | idx += 6; | 7975 | idx += 6; |
7900 | break; | 7976 | break; |
7901 | 7977 | ||
7902 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | 7978 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: |
7903 | if (remain < 5) | 7979 | if (remain < 5) |
7904 | return; | 7980 | return null; |
7905 | idx += 5; | 7981 | idx += 5; |
7906 | break; | 7982 | break; |
7907 | 7983 | ||
@@ -7909,13 +7985,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7909 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | 7985 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: |
7910 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | 7986 | case (int)ScriptBaseClass.PRIM_TYPE_RING: |
7911 | if (remain < 11) | 7987 | if (remain < 11) |
7912 | return; | 7988 | return null; |
7913 | idx += 11; | 7989 | idx += 11; |
7914 | break; | 7990 | break; |
7915 | 7991 | ||
7916 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | 7992 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: |
7917 | if (remain < 2) | 7993 | if (remain < 2) |
7918 | return; | 7994 | return null; |
7919 | idx += 2; | 7995 | idx += 2; |
7920 | break; | 7996 | break; |
7921 | } | 7997 | } |
@@ -7926,7 +8002,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7926 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 8002 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
7927 | case (int)ScriptBaseClass.PRIM_OMEGA: | 8003 | case (int)ScriptBaseClass.PRIM_OMEGA: |
7928 | if (remain < 3) | 8004 | if (remain < 3) |
7929 | return; | 8005 | return null; |
7930 | idx += 3; | 8006 | idx += 3; |
7931 | break; | 8007 | break; |
7932 | 8008 | ||
@@ -7934,33 +8010,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7934 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 8010 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: |
7935 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: | 8011 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: |
7936 | if (remain < 5) | 8012 | if (remain < 5) |
7937 | return; | 8013 | return null; |
7938 | idx += 5; | 8014 | idx += 5; |
7939 | break; | 8015 | break; |
7940 | 8016 | ||
7941 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 8017 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
7942 | if (remain < 7) | 8018 | if (remain < 7) |
7943 | return; | 8019 | return null; |
7944 | 8020 | ||
7945 | idx += 7; | 8021 | idx += 7; |
7946 | break; | 8022 | break; |
7947 | 8023 | ||
7948 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 8024 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
7949 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 8025 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
7950 | return; | 8026 | return null; |
7951 | 8027 | ||
7952 | if (positionChanged) | 8028 | return rules.GetSublist(idx, -1); |
7953 | { | ||
7954 | positionChanged = false; | ||
7955 | av.OffsetPosition = finalPos; | ||
7956 | // av.SendAvatarDataToAllAgents(); | ||
7957 | av.SendTerseUpdateToAllClients(); | ||
7958 | } | ||
7959 | |||
7960 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
7961 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
7962 | setLinkPrimParams((int)new_linknumber, new_rules); | ||
7963 | return; | ||
7964 | } | 8029 | } |
7965 | } | 8030 | } |
7966 | } | 8031 | } |
@@ -7975,12 +8040,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7975 | positionChanged = false; | 8040 | positionChanged = false; |
7976 | } | 8041 | } |
7977 | } | 8042 | } |
8043 | return null; | ||
7978 | } | 8044 | } |
7979 | 8045 | ||
7980 | protected void SetPrimParams(SceneObjectPart part, LSL_List rules) | 8046 | protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules) |
7981 | { | 8047 | { |
7982 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 8048 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
7983 | return; | 8049 | return null; |
7984 | 8050 | ||
7985 | int idx = 0; | 8051 | int idx = 0; |
7986 | 8052 | ||
@@ -8005,7 +8071,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8005 | case (int)ScriptBaseClass.PRIM_POSITION: | 8071 | case (int)ScriptBaseClass.PRIM_POSITION: |
8006 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 8072 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
8007 | if (remain < 1) | 8073 | if (remain < 1) |
8008 | return; | 8074 | return null; |
8009 | 8075 | ||
8010 | v=rules.GetVector3Item(idx++); | 8076 | v=rules.GetVector3Item(idx++); |
8011 | currentPosition = GetSetPosTarget(part, v, currentPosition); | 8077 | currentPosition = GetSetPosTarget(part, v, currentPosition); |
@@ -8014,7 +8080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8014 | break; | 8080 | break; |
8015 | case (int)ScriptBaseClass.PRIM_SIZE: | 8081 | case (int)ScriptBaseClass.PRIM_SIZE: |
8016 | if (remain < 1) | 8082 | if (remain < 1) |
8017 | return; | 8083 | return null; |
8018 | 8084 | ||
8019 | v=rules.GetVector3Item(idx++); | 8085 | v=rules.GetVector3Item(idx++); |
8020 | SetScale(part, v); | 8086 | SetScale(part, v); |
@@ -8022,7 +8088,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8022 | break; | 8088 | break; |
8023 | case (int)ScriptBaseClass.PRIM_ROTATION: | 8089 | case (int)ScriptBaseClass.PRIM_ROTATION: |
8024 | if (remain < 1) | 8090 | if (remain < 1) |
8025 | return; | 8091 | return null; |
8026 | 8092 | ||
8027 | LSL_Rotation q = rules.GetQuaternionItem(idx++); | 8093 | LSL_Rotation q = rules.GetQuaternionItem(idx++); |
8028 | SceneObjectPart rootPart = parentgrp.RootPart; | 8094 | SceneObjectPart rootPart = parentgrp.RootPart; |
@@ -8043,7 +8109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8043 | 8109 | ||
8044 | case (int)ScriptBaseClass.PRIM_TYPE: | 8110 | case (int)ScriptBaseClass.PRIM_TYPE: |
8045 | if (remain < 3) | 8111 | if (remain < 3) |
8046 | return; | 8112 | return null; |
8047 | 8113 | ||
8048 | code = (int)rules.GetLSLIntegerItem(idx++); | 8114 | code = (int)rules.GetLSLIntegerItem(idx++); |
8049 | 8115 | ||
@@ -8062,7 +8128,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8062 | { | 8128 | { |
8063 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: | 8129 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: |
8064 | if (remain < 6) | 8130 | if (remain < 6) |
8065 | return; | 8131 | return null; |
8066 | 8132 | ||
8067 | face = (int)rules.GetLSLIntegerItem(idx++); | 8133 | face = (int)rules.GetLSLIntegerItem(idx++); |
8068 | v = rules.GetVector3Item(idx++); // cut | 8134 | v = rules.GetVector3Item(idx++); // cut |
@@ -8077,7 +8143,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8077 | 8143 | ||
8078 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | 8144 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: |
8079 | if (remain < 6) | 8145 | if (remain < 6) |
8080 | return; | 8146 | return null; |
8081 | 8147 | ||
8082 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8148 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
8083 | v = rules.GetVector3Item(idx++); // cut | 8149 | v = rules.GetVector3Item(idx++); // cut |
@@ -8091,7 +8157,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8091 | 8157 | ||
8092 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | 8158 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: |
8093 | if (remain < 6) | 8159 | if (remain < 6) |
8094 | return; | 8160 | return null; |
8095 | 8161 | ||
8096 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8162 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
8097 | v = rules.GetVector3Item(idx++); //cut | 8163 | v = rules.GetVector3Item(idx++); //cut |
@@ -8105,7 +8171,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8105 | 8171 | ||
8106 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | 8172 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: |
8107 | if (remain < 5) | 8173 | if (remain < 5) |
8108 | return; | 8174 | return null; |
8109 | 8175 | ||
8110 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8176 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
8111 | v = rules.GetVector3Item(idx++); // cut | 8177 | v = rules.GetVector3Item(idx++); // cut |
@@ -8118,7 +8184,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8118 | 8184 | ||
8119 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | 8185 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: |
8120 | if (remain < 11) | 8186 | if (remain < 11) |
8121 | return; | 8187 | return null; |
8122 | 8188 | ||
8123 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8189 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
8124 | v = rules.GetVector3Item(idx++); //cut | 8190 | v = rules.GetVector3Item(idx++); //cut |
@@ -8137,7 +8203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8137 | 8203 | ||
8138 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | 8204 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: |
8139 | if (remain < 11) | 8205 | if (remain < 11) |
8140 | return; | 8206 | return null; |
8141 | 8207 | ||
8142 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8208 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
8143 | v = rules.GetVector3Item(idx++); //cut | 8209 | v = rules.GetVector3Item(idx++); //cut |
@@ -8156,7 +8222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8156 | 8222 | ||
8157 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | 8223 | case (int)ScriptBaseClass.PRIM_TYPE_RING: |
8158 | if (remain < 11) | 8224 | if (remain < 11) |
8159 | return; | 8225 | return null; |
8160 | 8226 | ||
8161 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8227 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
8162 | v = rules.GetVector3Item(idx++); //cut | 8228 | v = rules.GetVector3Item(idx++); //cut |
@@ -8175,7 +8241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8175 | 8241 | ||
8176 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | 8242 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: |
8177 | if (remain < 2) | 8243 | if (remain < 2) |
8178 | return; | 8244 | return null; |
8179 | 8245 | ||
8180 | string map = rules.Data[idx++].ToString(); | 8246 | string map = rules.Data[idx++].ToString(); |
8181 | face = (int)rules.GetLSLIntegerItem(idx++); // type | 8247 | face = (int)rules.GetLSLIntegerItem(idx++); // type |
@@ -8187,7 +8253,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8187 | 8253 | ||
8188 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 8254 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
8189 | if (remain < 5) | 8255 | if (remain < 5) |
8190 | return; | 8256 | return null; |
8191 | 8257 | ||
8192 | face=(int)rules.GetLSLIntegerItem(idx++); | 8258 | face=(int)rules.GetLSLIntegerItem(idx++); |
8193 | string tex=rules.Data[idx++].ToString(); | 8259 | string tex=rules.Data[idx++].ToString(); |
@@ -8204,7 +8270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8204 | 8270 | ||
8205 | case (int)ScriptBaseClass.PRIM_COLOR: | 8271 | case (int)ScriptBaseClass.PRIM_COLOR: |
8206 | if (remain < 3) | 8272 | if (remain < 3) |
8207 | return; | 8273 | return null; |
8208 | 8274 | ||
8209 | face=(int)rules.GetLSLIntegerItem(idx++); | 8275 | face=(int)rules.GetLSLIntegerItem(idx++); |
8210 | LSL_Vector color=rules.GetVector3Item(idx++); | 8276 | LSL_Vector color=rules.GetVector3Item(idx++); |
@@ -8217,7 +8283,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8217 | 8283 | ||
8218 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 8284 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
8219 | if (remain < 7) | 8285 | if (remain < 7) |
8220 | return; | 8286 | return null; |
8221 | 8287 | ||
8222 | bool flexi = rules.GetLSLIntegerItem(idx++); | 8288 | bool flexi = rules.GetLSLIntegerItem(idx++); |
8223 | int softness = rules.GetLSLIntegerItem(idx++); | 8289 | int softness = rules.GetLSLIntegerItem(idx++); |
@@ -8233,7 +8299,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8233 | 8299 | ||
8234 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 8300 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: |
8235 | if (remain < 5) | 8301 | if (remain < 5) |
8236 | return; | 8302 | return null; |
8237 | bool light = rules.GetLSLIntegerItem(idx++); | 8303 | bool light = rules.GetLSLIntegerItem(idx++); |
8238 | LSL_Vector lightcolor = rules.GetVector3Item(idx++); | 8304 | LSL_Vector lightcolor = rules.GetVector3Item(idx++); |
8239 | float intensity = (float)rules.GetLSLFloatItem(idx++); | 8305 | float intensity = (float)rules.GetLSLFloatItem(idx++); |
@@ -8246,7 +8312,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8246 | 8312 | ||
8247 | case (int)ScriptBaseClass.PRIM_GLOW: | 8313 | case (int)ScriptBaseClass.PRIM_GLOW: |
8248 | if (remain < 2) | 8314 | if (remain < 2) |
8249 | return; | 8315 | return null; |
8250 | face = rules.GetLSLIntegerItem(idx++); | 8316 | face = rules.GetLSLIntegerItem(idx++); |
8251 | float glow = (float)rules.GetLSLFloatItem(idx++); | 8317 | float glow = (float)rules.GetLSLFloatItem(idx++); |
8252 | 8318 | ||
@@ -8256,7 +8322,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8256 | 8322 | ||
8257 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 8323 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
8258 | if (remain < 3) | 8324 | if (remain < 3) |
8259 | return; | 8325 | return null; |
8260 | face = (int)rules.GetLSLIntegerItem(idx++); | 8326 | face = (int)rules.GetLSLIntegerItem(idx++); |
8261 | int shiny = (int)rules.GetLSLIntegerItem(idx++); | 8327 | int shiny = (int)rules.GetLSLIntegerItem(idx++); |
8262 | Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); | 8328 | Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); |
@@ -8267,7 +8333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8267 | 8333 | ||
8268 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 8334 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
8269 | if (remain < 2) | 8335 | if (remain < 2) |
8270 | return; | 8336 | return null; |
8271 | face = rules.GetLSLIntegerItem(idx++); | 8337 | face = rules.GetLSLIntegerItem(idx++); |
8272 | bool st = rules.GetLSLIntegerItem(idx++); | 8338 | bool st = rules.GetLSLIntegerItem(idx++); |
8273 | SetFullBright(part, face , st); | 8339 | SetFullBright(part, face , st); |
@@ -8275,17 +8341,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8275 | 8341 | ||
8276 | case (int)ScriptBaseClass.PRIM_MATERIAL: | 8342 | case (int)ScriptBaseClass.PRIM_MATERIAL: |
8277 | if (remain < 1) | 8343 | if (remain < 1) |
8278 | return; | 8344 | return null; |
8279 | int mat = rules.GetLSLIntegerItem(idx++); | 8345 | int mat = rules.GetLSLIntegerItem(idx++); |
8280 | if (mat < 0 || mat > 7) | 8346 | if (mat < 0 || mat > 7) |
8281 | return; | 8347 | return null; |
8282 | 8348 | ||
8283 | part.Material = Convert.ToByte(mat); | 8349 | part.Material = Convert.ToByte(mat); |
8284 | break; | 8350 | break; |
8285 | 8351 | ||
8286 | case (int)ScriptBaseClass.PRIM_PHANTOM: | 8352 | case (int)ScriptBaseClass.PRIM_PHANTOM: |
8287 | if (remain < 1) | 8353 | if (remain < 1) |
8288 | return; | 8354 | return null; |
8289 | 8355 | ||
8290 | string ph = rules.Data[idx++].ToString(); | 8356 | string ph = rules.Data[idx++].ToString(); |
8291 | parentgrp.ScriptSetPhantomStatus(ph.Equals("1")); | 8357 | parentgrp.ScriptSetPhantomStatus(ph.Equals("1")); |
@@ -8294,7 +8360,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8294 | 8360 | ||
8295 | case (int)ScriptBaseClass.PRIM_PHYSICS: | 8361 | case (int)ScriptBaseClass.PRIM_PHYSICS: |
8296 | if (remain < 1) | 8362 | if (remain < 1) |
8297 | return; | 8363 | return null; |
8298 | string phy = rules.Data[idx++].ToString(); | 8364 | string phy = rules.Data[idx++].ToString(); |
8299 | bool physics; | 8365 | bool physics; |
8300 | 8366 | ||
@@ -8308,7 +8374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8308 | 8374 | ||
8309 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | 8375 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: |
8310 | if (remain < 1) | 8376 | if (remain < 1) |
8311 | return; | 8377 | return null; |
8312 | 8378 | ||
8313 | int shape_type = rules.GetLSLIntegerItem(idx++); | 8379 | int shape_type = rules.GetLSLIntegerItem(idx++); |
8314 | 8380 | ||
@@ -8324,7 +8390,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8324 | 8390 | ||
8325 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: | 8391 | case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: |
8326 | if (remain < 5) | 8392 | if (remain < 5) |
8327 | return; | 8393 | return null; |
8328 | 8394 | ||
8329 | int material_bits = rules.GetLSLIntegerItem(idx++); | 8395 | int material_bits = rules.GetLSLIntegerItem(idx++); |
8330 | float material_density = (float)rules.GetLSLFloatItem(idx++); | 8396 | float material_density = (float)rules.GetLSLFloatItem(idx++); |
@@ -8338,7 +8404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8338 | 8404 | ||
8339 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | 8405 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: |
8340 | if (remain < 1) | 8406 | if (remain < 1) |
8341 | return; | 8407 | return null; |
8342 | string temp = rules.Data[idx++].ToString(); | 8408 | string temp = rules.Data[idx++].ToString(); |
8343 | 8409 | ||
8344 | parentgrp.ScriptSetTemporaryStatus(temp.Equals("1")); | 8410 | parentgrp.ScriptSetTemporaryStatus(temp.Equals("1")); |
@@ -8347,7 +8413,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8347 | 8413 | ||
8348 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 8414 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
8349 | if (remain < 2) | 8415 | if (remain < 2) |
8350 | return; | 8416 | return null; |
8351 | //face,type | 8417 | //face,type |
8352 | face = rules.GetLSLIntegerItem(idx++); | 8418 | face = rules.GetLSLIntegerItem(idx++); |
8353 | int style = rules.GetLSLIntegerItem(idx++); | 8419 | int style = rules.GetLSLIntegerItem(idx++); |
@@ -8355,7 +8421,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8355 | break; | 8421 | break; |
8356 | case (int)ScriptBaseClass.PRIM_TEXT: | 8422 | case (int)ScriptBaseClass.PRIM_TEXT: |
8357 | if (remain < 3) | 8423 | if (remain < 3) |
8358 | return; | 8424 | return null; |
8359 | string primText = rules.GetLSLStringItem(idx++); | 8425 | string primText = rules.GetLSLStringItem(idx++); |
8360 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); | 8426 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); |
8361 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); | 8427 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); |
@@ -8367,26 +8433,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8367 | break; | 8433 | break; |
8368 | case (int)ScriptBaseClass.PRIM_NAME: | 8434 | case (int)ScriptBaseClass.PRIM_NAME: |
8369 | if (remain < 1) | 8435 | if (remain < 1) |
8370 | return; | 8436 | return null; |
8371 | string primName = rules.GetLSLStringItem(idx++); | 8437 | string primName = rules.GetLSLStringItem(idx++); |
8372 | part.Name = primName; | 8438 | part.Name = primName; |
8373 | break; | 8439 | break; |
8374 | case (int)ScriptBaseClass.PRIM_DESC: | 8440 | case (int)ScriptBaseClass.PRIM_DESC: |
8375 | if (remain < 1) | 8441 | if (remain < 1) |
8376 | return; | 8442 | return null; |
8377 | string primDesc = rules.GetLSLStringItem(idx++); | 8443 | string primDesc = rules.GetLSLStringItem(idx++); |
8378 | part.Description = primDesc; | 8444 | part.Description = primDesc; |
8379 | break; | 8445 | break; |
8380 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 8446 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
8381 | if (remain < 1) | 8447 | if (remain < 1) |
8382 | return; | 8448 | return null; |
8383 | |||
8384 | LSL_Rotation lr = rules.GetQuaternionItem(idx++); | 8449 | LSL_Rotation lr = rules.GetQuaternionItem(idx++); |
8385 | SetRot(part, Rot2Quaternion(lr)); | 8450 | SetRot(part, Rot2Quaternion(lr)); |
8386 | break; | 8451 | break; |
8387 | case (int)ScriptBaseClass.PRIM_OMEGA: | 8452 | case (int)ScriptBaseClass.PRIM_OMEGA: |
8388 | if (remain < 3) | 8453 | if (remain < 3) |
8389 | return; | 8454 | return null; |
8390 | LSL_Vector axis = rules.GetVector3Item(idx++); | 8455 | LSL_Vector axis = rules.GetVector3Item(idx++); |
8391 | LSL_Float spinrate = rules.GetLSLFloatItem(idx++); | 8456 | LSL_Float spinrate = rules.GetLSLFloatItem(idx++); |
8392 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | 8457 | LSL_Float gain = rules.GetLSLFloatItem(idx++); |
@@ -8395,35 +8460,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8395 | 8460 | ||
8396 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 8461 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
8397 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 8462 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
8398 | return; | 8463 | return null; |
8399 | |||
8400 | // do a pending position change before jumping to other part/avatar | ||
8401 | if (positionChanged) | ||
8402 | { | ||
8403 | positionChanged = false; | ||
8404 | if (parentgrp == null) | ||
8405 | return; | ||
8406 | 8464 | ||
8407 | if (parentgrp.RootPart == part) | 8465 | return rules.GetSublist(idx, -1); |
8408 | { | ||
8409 | |||
8410 | Util.FireAndForget(delegate(object x) | ||
8411 | { | ||
8412 | parentgrp.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | ||
8413 | }); | ||
8414 | } | ||
8415 | else | ||
8416 | { | ||
8417 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | ||
8418 | parentgrp.HasGroupChanged = true; | ||
8419 | parentgrp.ScheduleGroupForTerseUpdate(); | ||
8420 | } | ||
8421 | } | ||
8422 | |||
8423 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
8424 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
8425 | setLinkPrimParams((int)new_linknumber, new_rules); | ||
8426 | return; | ||
8427 | } | 8466 | } |
8428 | } | 8467 | } |
8429 | } | 8468 | } |
@@ -8447,6 +8486,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8447 | } | 8486 | } |
8448 | } | 8487 | } |
8449 | } | 8488 | } |
8489 | return null; | ||
8450 | } | 8490 | } |
8451 | 8491 | ||
8452 | public LSL_String llStringToBase64(string str) | 8492 | public LSL_String llStringToBase64(string str) |
@@ -12082,7 +12122,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12082 | if (obj.OwnerID != m_host.OwnerID) | 12122 | if (obj.OwnerID != m_host.OwnerID) |
12083 | return; | 12123 | return; |
12084 | 12124 | ||
12085 | SetPrimParams(obj, rules); | 12125 | LSL_List remaining = SetPrimParams(obj, rules); |
12126 | |||
12127 | while ((object)remaining != null && remaining.Length > 2) | ||
12128 | { | ||
12129 | LSL_Integer newLink = remaining.GetLSLIntegerItem(0); | ||
12130 | LSL_List newrules = remaining.GetSublist(1, -1); | ||
12131 | foreach(SceneObjectPart part in GetLinkParts(obj, newLink)){ | ||
12132 | remaining = SetPrimParams(part, newrules); | ||
12133 | } | ||
12134 | } | ||
12086 | } | 12135 | } |
12087 | 12136 | ||
12088 | public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules) | 12137 | public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules) |