aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJohn Hurliman2010-09-16 17:30:46 -0700
committerJohn Hurliman2010-09-16 17:30:46 -0700
commit860b2a502f797e5822c6705d4639f370f3ac5861 (patch)
tree5a74ddbd626142e27f6c3439ea267b8ea348ce9c /OpenSim/Region/ScriptEngine
parentAdd the modules include line back that i dropped by mistake (diff)
downloadopensim-SC_OLD-860b2a502f797e5822c6705d4639f370f3ac5861.zip
opensim-SC_OLD-860b2a502f797e5822c6705d4639f370f3ac5861.tar.gz
opensim-SC_OLD-860b2a502f797e5822c6705d4639f370f3ac5861.tar.bz2
opensim-SC_OLD-860b2a502f797e5822c6705d4639f370f3ac5861.tar.xz
Changed SceneObjectGroup to store parts with the fast and thread-safe MapAndArray collection
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs91
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs11
2 files changed, 42 insertions, 60 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0692fdb..01c026e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -236,8 +236,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
236 case ScriptBaseClass.LINK_SET: 236 case ScriptBaseClass.LINK_SET:
237 if (m_host.ParentGroup != null) 237 if (m_host.ParentGroup != null)
238 { 238 {
239 lock (m_host.ParentGroup.Children) 239 return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
240 return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
241 } 240 }
242 return ret; 241 return ret;
243 242
@@ -254,8 +253,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
254 if (m_host.ParentGroup == null) 253 if (m_host.ParentGroup == null)
255 return new List<SceneObjectPart>(); 254 return new List<SceneObjectPart>();
256 255
257 lock (m_host.ParentGroup.Children) 256 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
258 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
259 257
260 if (ret.Contains(m_host)) 258 if (ret.Contains(m_host))
261 ret.Remove(m_host); 259 ret.Remove(m_host);
@@ -265,8 +263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
265 if (m_host.ParentGroup == null) 263 if (m_host.ParentGroup == null)
266 return new List<SceneObjectPart>(); 264 return new List<SceneObjectPart>();
267 265
268 lock (m_host.ParentGroup.Children) 266 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
269 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
270 267
271 if (ret.Contains(m_host.ParentGroup.RootPart)) 268 if (ret.Contains(m_host.ParentGroup.RootPart))
272 ret.Remove(m_host.ParentGroup.RootPart); 269 ret.Remove(m_host.ParentGroup.RootPart);
@@ -1187,16 +1184,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1187 if (group == null) 1184 if (group == null)
1188 return; 1185 return;
1189 bool allow = true; 1186 bool allow = true;
1190 1187
1191 lock (group.Children) 1188 foreach (SceneObjectPart part in group.Parts)
1192 { 1189 {
1193 foreach (SceneObjectPart part in group.Children.Values) 1190 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
1194 { 1191 {
1195 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) 1192 allow = false;
1196 { 1193 break;
1197 allow = false;
1198 break;
1199 }
1200 } 1194 }
1201 } 1195 }
1202 1196
@@ -3617,18 +3611,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3617 case ScriptBaseClass.LINK_ALL_OTHERS: 3611 case ScriptBaseClass.LINK_ALL_OTHERS:
3618 case ScriptBaseClass.LINK_ALL_CHILDREN: 3612 case ScriptBaseClass.LINK_ALL_CHILDREN:
3619 case ScriptBaseClass.LINK_THIS: 3613 case ScriptBaseClass.LINK_THIS:
3620 lock (parentPrim.Children) 3614 foreach (SceneObjectPart part in parentPrim.Parts)
3621 { 3615 {
3622 foreach (SceneObjectPart part in parentPrim.Children.Values) 3616 if (part.UUID != m_host.UUID)
3623 { 3617 {
3624 if (part.UUID != m_host.UUID) 3618 childPrim = part;
3625 { 3619 break;
3626 childPrim = part;
3627 break;
3628 }
3629 } 3620 }
3630 break;
3631 } 3621 }
3622 break;
3632 default: 3623 default:
3633 childPrim = parentPrim.GetLinkNumPart(linknum); 3624 childPrim = parentPrim.GetLinkNumPart(linknum);
3634 if (childPrim.UUID == m_host.UUID) 3625 if (childPrim.UUID == m_host.UUID)
@@ -3639,30 +3630,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3639 if (linknum == ScriptBaseClass.LINK_ROOT) 3630 if (linknum == ScriptBaseClass.LINK_ROOT)
3640 { 3631 {
3641 // Restructuring Multiple Prims. 3632 // Restructuring Multiple Prims.
3642 lock (parentPrim.Children) 3633 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts);
3634 parts.Remove(parentPrim.RootPart);
3635 foreach (SceneObjectPart part in parts)
3643 { 3636 {
3644 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); 3637 parentPrim.DelinkFromGroup(part.LocalId, true);
3645 parts.Remove(parentPrim.RootPart); 3638 }
3639 parentPrim.HasGroupChanged = true;
3640 parentPrim.ScheduleGroupForFullUpdate();
3641 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3642
3643 if (parts.Count > 0)
3644 {
3645 SceneObjectPart newRoot = parts[0];
3646 parts.Remove(newRoot);
3646 foreach (SceneObjectPart part in parts) 3647 foreach (SceneObjectPart part in parts)
3647 { 3648 {
3648 parentPrim.DelinkFromGroup(part.LocalId, true); 3649 part.UpdateFlag = 0;
3649 } 3650 newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
3650 parentPrim.HasGroupChanged = true;
3651 parentPrim.ScheduleGroupForFullUpdate();
3652 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3653
3654 if (parts.Count > 0)
3655 {
3656 SceneObjectPart newRoot = parts[0];
3657 parts.Remove(newRoot);
3658 foreach (SceneObjectPart part in parts)
3659 {
3660 part.UpdateFlag = 0;
3661 newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
3662 }
3663 newRoot.ParentGroup.HasGroupChanged = true;
3664 newRoot.ParentGroup.ScheduleGroupForFullUpdate();
3665 } 3651 }
3652 newRoot.ParentGroup.HasGroupChanged = true;
3653 newRoot.ParentGroup.ScheduleGroupForFullUpdate();
3666 } 3654 }
3667 } 3655 }
3668 else 3656 else
@@ -3684,19 +3672,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3684 if (parentPrim.RootPart.AttachmentPoint != 0) 3672 if (parentPrim.RootPart.AttachmentPoint != 0)
3685 return; // Fail silently if attached 3673 return; // Fail silently if attached
3686 3674
3687 lock (parentPrim.Children) 3675 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts);
3676 parts.Remove(parentPrim.RootPart);
3677
3678 foreach (SceneObjectPart part in parts)
3688 { 3679 {
3689 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); 3680 parentPrim.DelinkFromGroup(part.LocalId, true);
3690 parts.Remove(parentPrim.RootPart); 3681 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3691
3692 foreach (SceneObjectPart part in parts)
3693 {
3694 parentPrim.DelinkFromGroup(part.LocalId, true);
3695 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3696 }
3697 parentPrim.HasGroupChanged = true;
3698 parentPrim.ScheduleGroupForFullUpdate();
3699 } 3682 }
3683 parentPrim.HasGroupChanged = true;
3684 parentPrim.ScheduleGroupForFullUpdate();
3700 } 3685 }
3701 3686
3702 public LSL_String llGetLinkKey(int linknum) 3687 public LSL_String llGetLinkKey(int linknum)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 41501f2..3575889 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -209,15 +209,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
209 else 209 else
210 Type = 0x02; // Passive 210 Type = 0x02; // Passive
211 211
212 lock (part.ParentGroup.Children) 212 foreach (SceneObjectPart p in part.ParentGroup.Parts)
213 { 213 {
214 foreach (SceneObjectPart p in part.ParentGroup.Children.Values) 214 if (p.Inventory.ContainsScripts())
215 { 215 {
216 if (p.Inventory.ContainsScripts()) 216 Type |= 0x08; // Scripted
217 { 217 break;
218 Type |= 0x08; // Scripted
219 break;
220 }
221 } 218 }
222 } 219 }
223 220