aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs69
1 files changed, 39 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a407ef3..8381efa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -293,7 +293,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
293 { 293 {
294 case ScriptBaseClass.LINK_SET: 294 case ScriptBaseClass.LINK_SET:
295 if (m_host.ParentGroup != null) 295 if (m_host.ParentGroup != null)
296 return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); 296 {
297 lock (m_host.ParentGroup.Children)
298 return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
299 }
297 return ret; 300 return ret;
298 301
299 case ScriptBaseClass.LINK_ROOT: 302 case ScriptBaseClass.LINK_ROOT:
@@ -308,7 +311,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
308 case ScriptBaseClass.LINK_ALL_OTHERS: 311 case ScriptBaseClass.LINK_ALL_OTHERS:
309 if (m_host.ParentGroup == null) 312 if (m_host.ParentGroup == null)
310 return new List<SceneObjectPart>(); 313 return new List<SceneObjectPart>();
311 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); 314
315 lock (m_host.ParentGroup.Children)
316 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
317
312 if (ret.Contains(m_host)) 318 if (ret.Contains(m_host))
313 ret.Remove(m_host); 319 ret.Remove(m_host);
314 return ret; 320 return ret;
@@ -316,7 +322,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
316 case ScriptBaseClass.LINK_ALL_CHILDREN: 322 case ScriptBaseClass.LINK_ALL_CHILDREN:
317 if (m_host.ParentGroup == null) 323 if (m_host.ParentGroup == null)
318 return new List<SceneObjectPart>(); 324 return new List<SceneObjectPart>();
319 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); 325
326 lock (m_host.ParentGroup.Children)
327 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
328
320 if (ret.Contains(m_host.ParentGroup.RootPart)) 329 if (ret.Contains(m_host.ParentGroup.RootPart))
321 ret.Remove(m_host.ParentGroup.RootPart); 330 ret.Remove(m_host.ParentGroup.RootPart);
322 return ret; 331 return ret;
@@ -1272,12 +1281,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1272 if (group == null) 1281 if (group == null)
1273 return; 1282 return;
1274 bool allow = true; 1283 bool allow = true;
1275 foreach (SceneObjectPart part in group.Children.Values) 1284
1285 lock (group.Children)
1276 { 1286 {
1277 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) 1287 foreach (SceneObjectPart part in group.Children.Values)
1278 { 1288 {
1279 allow = false; 1289 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
1280 break; 1290 {
1291 allow = false;
1292 break;
1293 }
1281 } 1294 }
1282 } 1295 }
1283 1296
@@ -3757,7 +3770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3757 { 3770 {
3758 m_host.AddScriptLPS(1); 3771 m_host.AddScriptLPS(1);
3759 3772
3760 if (m_host.ParentGroup.Children.Count > 1) 3773 if (m_host.ParentGroup.PrimCount > 1)
3761 { 3774 {
3762 return m_host.LinkNum; 3775 return m_host.LinkNum;
3763 } 3776 }
@@ -3878,15 +3891,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3878 case ScriptBaseClass.LINK_ALL_OTHERS: 3891 case ScriptBaseClass.LINK_ALL_OTHERS:
3879 case ScriptBaseClass.LINK_ALL_CHILDREN: 3892 case ScriptBaseClass.LINK_ALL_CHILDREN:
3880 case ScriptBaseClass.LINK_THIS: 3893 case ScriptBaseClass.LINK_THIS:
3881 foreach (SceneObjectPart part in parentPrim.Children.Values) 3894 lock (parentPrim.Children)
3882 { 3895 {
3883 if (part.UUID != m_host.UUID) 3896 foreach (SceneObjectPart part in parentPrim.Children.Values)
3884 { 3897 {
3885 childPrim = part; 3898 if (part.UUID != m_host.UUID)
3886 break; 3899 {
3900 childPrim = part;
3901 break;
3902 }
3887 } 3903 }
3904 break;
3888 } 3905 }
3889 break;
3890 default: 3906 default:
3891 childPrim = parentPrim.GetLinkNumPart(linknum); 3907 childPrim = parentPrim.GetLinkNumPart(linknum);
3892 if (childPrim.UUID == m_host.UUID) 3908 if (childPrim.UUID == m_host.UUID)
@@ -3962,26 +3978,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3962 if (parentPrim.RootPart.AttachmentPoint != 0) 3978 if (parentPrim.RootPart.AttachmentPoint != 0)
3963 return; // Fail silently if attached 3979 return; // Fail silently if attached
3964 3980
3965 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); 3981 lock (parentPrim.Children)
3966 parts.Remove(parentPrim.RootPart);
3967 if (parts.Count > 0)
3968 { 3982 {
3969 try 3983 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
3970 { 3984 parts.Remove(parentPrim.RootPart);
3971 parts[0].ParentGroup.areUpdatesSuspended = true; 3985
3972 foreach (SceneObjectPart part in parts) 3986 foreach (SceneObjectPart part in parts)
3973 {
3974 parentPrim.DelinkFromGroup(part.LocalId, true);
3975 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3976 }
3977 }
3978 finally
3979 { 3987 {
3980 parts[0].ParentGroup.areUpdatesSuspended = false; 3988 parentPrim.DelinkFromGroup(part.LocalId, true);
3989 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3981 } 3990 }
3991 parentPrim.HasGroupChanged = true;
3992 parentPrim.ScheduleGroupForFullUpdate();
3982 } 3993 }
3983 parentPrim.HasGroupChanged = true;
3984 parentPrim.ScheduleGroupForFullUpdate();
3985 } 3994 }
3986 3995
3987 public LSL_String llGetLinkKey(int linknum) 3996 public LSL_String llGetLinkKey(int linknum)
@@ -4545,7 +4554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4545 { 4554 {
4546 partItemID = item.ItemID; 4555 partItemID = item.ItemID;
4547 int linkNumber = m_host.LinkNum; 4556 int linkNumber = m_host.LinkNum;
4548 if (m_host.ParentGroup.Children.Count == 1) 4557 if (m_host.ParentGroup.PrimCount == 1)
4549 linkNumber = 0; 4558 linkNumber = 0;
4550 4559
4551 object[] resobj = new object[] 4560 object[] resobj = new object[]