diff options
author | Justin Clark-Casey (justincc) | 2010-07-20 21:57:03 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-20 21:57:03 +0100 |
commit | 79d33418f0950a75d64d2779bf7eeacc97ac3e31 (patch) | |
tree | ce0f3741579e68845cfe46ffed7a7bf4ebfc7225 /OpenSim | |
parent | Add region name on the end of script startup debug messages (diff) | |
parent | Relaxed the ultra-conservative lock on m_items. Needs testing under linux and... (diff) | |
download | opensim-SC_OLD-79d33418f0950a75d64d2779bf7eeacc97ac3e31.zip opensim-SC_OLD-79d33418f0950a75d64d2779bf7eeacc97ac3e31.tar.gz opensim-SC_OLD-79d33418f0950a75d64d2779bf7eeacc97ac3e31.tar.bz2 opensim-SC_OLD-79d33418f0950a75d64d2779bf7eeacc97ac3e31.tar.xz |
Merge branch '0.7-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7-post-fixes
Diffstat (limited to 'OpenSim')
3 files changed, 294 insertions, 312 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3a8f168..20d5486 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -118,20 +118,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
118 | /// <param name="linkNum">Link number for the part</param> | 118 | /// <param name="linkNum">Link number for the part</param> |
119 | public void ResetInventoryIDs() | 119 | public void ResetInventoryIDs() |
120 | { | 120 | { |
121 | lock (Items) | 121 | lock (m_items) |
122 | { | 122 | { |
123 | if (0 == Items.Count) | 123 | if (0 == m_items.Count) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | HasInventoryChanged = true; | 126 | HasInventoryChanged = true; |
127 | m_part.ParentGroup.HasGroupChanged = true; | 127 | m_part.ParentGroup.HasGroupChanged = true; |
128 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 128 | IList<TaskInventoryItem> items = GetInventoryItems(); |
129 | Items.Clear(); | 129 | m_items.Clear(); |
130 | 130 | ||
131 | foreach (TaskInventoryItem item in items) | 131 | foreach (TaskInventoryItem item in items) |
132 | { | 132 | { |
133 | item.ResetIDs(m_part.UUID); | 133 | item.ResetIDs(m_part.UUID); |
134 | Items.Add(item.ItemID, item); | 134 | m_items.Add(item.ItemID, item); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | } | 137 | } |
@@ -148,17 +148,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
148 | { | 148 | { |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | } | ||
151 | 152 | ||
152 | HasInventoryChanged = true; | 153 | HasInventoryChanged = true; |
153 | m_part.ParentGroup.HasGroupChanged = true; | 154 | m_part.ParentGroup.HasGroupChanged = true; |
154 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 155 | List<TaskInventoryItem> items = GetInventoryItems(); |
155 | foreach (TaskInventoryItem item in items) | 156 | foreach (TaskInventoryItem item in items) |
157 | { | ||
158 | if (ownerId != item.OwnerID) | ||
156 | { | 159 | { |
157 | if (ownerId != item.OwnerID) | 160 | item.LastOwnerID = item.OwnerID; |
158 | { | 161 | item.OwnerID = ownerId; |
159 | item.LastOwnerID = item.OwnerID; | ||
160 | item.OwnerID = ownerId; | ||
161 | } | ||
162 | } | 162 | } |
163 | } | 163 | } |
164 | } | 164 | } |
@@ -175,17 +175,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
175 | { | 175 | { |
176 | return; | 176 | return; |
177 | } | 177 | } |
178 | } | ||
178 | 179 | ||
179 | HasInventoryChanged = true; | 180 | HasInventoryChanged = true; |
180 | m_part.ParentGroup.HasGroupChanged = true; | 181 | m_part.ParentGroup.HasGroupChanged = true; |
181 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 182 | List<TaskInventoryItem> items = GetInventoryItems(); |
182 | foreach (TaskInventoryItem item in items) | 183 | foreach (TaskInventoryItem item in items) |
183 | { | 184 | { |
184 | if (groupID != item.GroupID) | 185 | if (groupID != item.GroupID) |
185 | { | 186 | item.GroupID = groupID; |
186 | item.GroupID = groupID; | ||
187 | } | ||
188 | } | ||
189 | } | 187 | } |
190 | } | 188 | } |
191 | 189 | ||
@@ -194,17 +192,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
194 | /// </summary> | 192 | /// </summary> |
195 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | 193 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
196 | { | 194 | { |
197 | lock (m_items) | 195 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
198 | { | 196 | foreach (TaskInventoryItem item in scripts) |
199 | foreach (TaskInventoryItem item in Items.Values) | 197 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
200 | { | ||
201 | if ((int)InventoryType.LSL == item.InvType) | ||
202 | { | ||
203 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | ||
204 | Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | } | 198 | } |
209 | 199 | ||
210 | public ArrayList GetScriptErrors(UUID itemID) | 200 | public ArrayList GetScriptErrors(UUID itemID) |
@@ -237,16 +227,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
237 | /// </param> | 227 | /// </param> |
238 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | 228 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) |
239 | { | 229 | { |
240 | lock (Items) | 230 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
241 | { | 231 | foreach (TaskInventoryItem item in scripts) |
242 | foreach (TaskInventoryItem item in Items.Values) | 232 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); |
243 | { | ||
244 | if ((int)InventoryType.LSL == item.InvType) | ||
245 | { | ||
246 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | } | 233 | } |
251 | 234 | ||
252 | /// <summary> | 235 | /// <summary> |
@@ -259,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
259 | // m_log.InfoFormat( | 242 | // m_log.InfoFormat( |
260 | // "[PRIM INVENTORY]: " + | 243 | // "[PRIM INVENTORY]: " + |
261 | // "Starting script {0}, {1} in prim {2}, {3}", | 244 | // "Starting script {0}, {1} in prim {2}, {3}", |
262 | // item.Name, item.ItemID, m_part.Name, m_part.UUID); | 245 | // item.Name, item.ItemID, Name, UUID); |
263 | 246 | ||
264 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) | 247 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) |
265 | return; | 248 | return; |
@@ -295,20 +278,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
295 | } | 278 | } |
296 | else | 279 | else |
297 | { | 280 | { |
281 | if (m_part.ParentGroup.m_savedScriptState != null) | ||
282 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | ||
283 | |||
298 | lock (m_items) | 284 | lock (m_items) |
299 | { | 285 | { |
300 | if (m_part.ParentGroup.m_savedScriptState != null) | ||
301 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | ||
302 | |||
303 | m_items[item.ItemID].PermsMask = 0; | 286 | m_items[item.ItemID].PermsMask = 0; |
304 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 287 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
305 | |||
306 | string script = Utils.BytesToString(asset.Data); | ||
307 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
308 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | ||
309 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
310 | m_part.ScheduleFullUpdate(); | ||
311 | } | 288 | } |
289 | |||
290 | string script = Utils.BytesToString(asset.Data); | ||
291 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
292 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | ||
293 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
294 | m_part.ScheduleFullUpdate(); | ||
312 | } | 295 | } |
313 | } | 296 | } |
314 | } | 297 | } |
@@ -376,21 +359,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
376 | /// </param> | 359 | /// </param> |
377 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) | 360 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) |
378 | { | 361 | { |
379 | lock (m_items) | 362 | TaskInventoryItem item = GetInventoryItem(itemId); |
380 | { | 363 | if (item != null) |
381 | if (m_items.ContainsKey(itemId)) | 364 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
382 | { | 365 | else |
383 | CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource); | 366 | m_log.ErrorFormat( |
384 | } | 367 | "[PRIM INVENTORY]: " + |
385 | else | 368 | "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", |
386 | { | 369 | itemId, m_part.Name, m_part.UUID, |
387 | m_log.ErrorFormat( | 370 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); |
388 | "[PRIM INVENTORY]: " + | ||
389 | "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", | ||
390 | itemId, m_part.Name, m_part.UUID, | ||
391 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
392 | } | ||
393 | } | ||
394 | } | 371 | } |
395 | 372 | ||
396 | /// <summary> | 373 | /// <summary> |
@@ -431,16 +408,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
431 | 408 | ||
432 | /// <summary> | 409 | /// <summary> |
433 | /// Check if the inventory holds an item with a given name. | 410 | /// Check if the inventory holds an item with a given name. |
434 | /// This method assumes that the task inventory is already locked. | ||
435 | /// </summary> | 411 | /// </summary> |
436 | /// <param name="name"></param> | 412 | /// <param name="name"></param> |
437 | /// <returns></returns> | 413 | /// <returns></returns> |
438 | private bool InventoryContainsName(string name) | 414 | private bool InventoryContainsName(string name) |
439 | { | 415 | { |
440 | foreach (TaskInventoryItem item in Items.Values) | 416 | lock (m_items) |
441 | { | 417 | { |
442 | if (item.Name == name) | 418 | foreach (TaskInventoryItem item in m_items.Values) |
443 | return true; | 419 | { |
420 | if (item.Name == name) | ||
421 | return true; | ||
422 | } | ||
444 | } | 423 | } |
445 | return false; | 424 | return false; |
446 | } | 425 | } |
@@ -483,12 +462,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
483 | /// <param name="item"></param> | 462 | /// <param name="item"></param> |
484 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) | 463 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) |
485 | { | 464 | { |
486 | List<TaskInventoryItem> il; | 465 | List<TaskInventoryItem> il = GetInventoryItems(); |
487 | |||
488 | lock (m_items) | ||
489 | { | ||
490 | il = new List<TaskInventoryItem>(m_items.Values); | ||
491 | } | ||
492 | 466 | ||
493 | foreach (TaskInventoryItem i in il) | 467 | foreach (TaskInventoryItem i in il) |
494 | { | 468 | { |
@@ -528,14 +502,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
528 | item.GroupID = m_part.GroupID; | 502 | item.GroupID = m_part.GroupID; |
529 | 503 | ||
530 | lock (m_items) | 504 | lock (m_items) |
531 | { | ||
532 | m_items.Add(item.ItemID, item); | 505 | m_items.Add(item.ItemID, item); |
533 | 506 | ||
534 | if (allowedDrop) | 507 | if (allowedDrop) |
535 | m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP); | 508 | m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP); |
536 | else | 509 | else |
537 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 510 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
538 | } | ||
539 | 511 | ||
540 | m_inventorySerial++; | 512 | m_inventorySerial++; |
541 | //m_inventorySerial += 2; | 513 | //m_inventorySerial += 2; |
@@ -559,9 +531,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
559 | m_items.Add(item.ItemID, item); | 531 | m_items.Add(item.ItemID, item); |
560 | // m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 532 | // m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
561 | } | 533 | } |
534 | m_inventorySerial++; | ||
562 | } | 535 | } |
563 | |||
564 | m_inventorySerial++; | ||
565 | } | 536 | } |
566 | 537 | ||
567 | /// <summary> | 538 | /// <summary> |
@@ -616,45 +587,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
616 | 587 | ||
617 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) | 588 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) |
618 | { | 589 | { |
619 | lock(m_items) | 590 | TaskInventoryItem it = GetInventoryItem(item.ItemID); |
591 | if (it != null) | ||
620 | { | 592 | { |
621 | if (m_items.ContainsKey(item.ItemID)) | 593 | item.ParentID = m_part.UUID; |
622 | { | 594 | item.ParentPartID = m_part.UUID; |
623 | if (m_items.ContainsKey(item.ItemID)) | 595 | item.Flags = m_items[item.ItemID].Flags; |
624 | { | 596 | |
625 | item.ParentID = m_part.UUID; | 597 | // If group permissions have been set on, check that the groupID is up to date in case it has |
626 | item.ParentPartID = m_part.UUID; | 598 | // changed since permissions were last set. |
627 | item.Flags = m_items[item.ItemID].Flags; | 599 | if (item.GroupPermissions != (uint)PermissionMask.None) |
628 | 600 | item.GroupID = m_part.GroupID; | |
629 | // If group permissions have been set on, check that the groupID is up to date in case it has | ||
630 | // changed since permissions were last set. | ||
631 | if (item.GroupPermissions != (uint)PermissionMask.None) | ||
632 | item.GroupID = m_part.GroupID; | ||
633 | 601 | ||
634 | if (item.AssetID == UUID.Zero) | 602 | if (item.AssetID == UUID.Zero) |
635 | { | 603 | item.AssetID = it.AssetID; |
636 | item.AssetID = m_items[item.ItemID].AssetID; | ||
637 | } | ||
638 | m_items[item.ItemID] = item; | ||
639 | m_inventorySerial++; | ||
640 | if (fireScriptEvents) | ||
641 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
642 | HasInventoryChanged = true; | ||
643 | m_part.ParentGroup.HasGroupChanged = true; | ||
644 | return true; | ||
645 | } | ||
646 | else | ||
647 | { | ||
648 | m_log.ErrorFormat( | ||
649 | "[PRIM INVENTORY]: " + | ||
650 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
651 | item.ItemID, m_part.Name, m_part.UUID, | ||
652 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
653 | } | ||
654 | 604 | ||
605 | lock (m_items) | ||
606 | { | ||
607 | m_items[item.ItemID] = item; | ||
608 | m_inventorySerial++; | ||
655 | } | 609 | } |
656 | return false; | 610 | |
611 | if (fireScriptEvents) | ||
612 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
613 | |||
614 | HasInventoryChanged = true; | ||
615 | m_part.ParentGroup.HasGroupChanged = true; | ||
616 | return true; | ||
617 | } | ||
618 | else | ||
619 | { | ||
620 | m_log.ErrorFormat( | ||
621 | "[PRIM INVENTORY]: " + | ||
622 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
623 | item.ItemID, m_part.Name, m_part.UUID, | ||
624 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
657 | } | 625 | } |
626 | return false; | ||
627 | |||
658 | } | 628 | } |
659 | 629 | ||
660 | /// <summary> | 630 | /// <summary> |
@@ -665,52 +635,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
665 | /// in this prim's inventory.</returns> | 635 | /// in this prim's inventory.</returns> |
666 | public int RemoveInventoryItem(UUID itemID) | 636 | public int RemoveInventoryItem(UUID itemID) |
667 | { | 637 | { |
668 | lock (m_items) | 638 | TaskInventoryItem item = GetInventoryItem(itemID); |
639 | if (item != null) | ||
669 | { | 640 | { |
670 | if (m_items.ContainsKey(itemID)) | 641 | int type = m_items[itemID].InvType; |
642 | if (type == 10) // Script | ||
671 | { | 643 | { |
672 | int type = m_items[itemID].InvType; | 644 | m_part.RemoveScriptEvents(itemID); |
673 | if (type == 10) // Script | 645 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); |
674 | { | 646 | } |
675 | m_part.RemoveScriptEvents(itemID); | 647 | m_items.Remove(itemID); |
676 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); | 648 | m_inventorySerial++; |
677 | } | 649 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
678 | m_items.Remove(itemID); | ||
679 | m_inventorySerial++; | ||
680 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
681 | |||
682 | HasInventoryChanged = true; | ||
683 | m_part.ParentGroup.HasGroupChanged = true; | ||
684 | 650 | ||
685 | int scriptcount = 0; | 651 | HasInventoryChanged = true; |
686 | lock (m_items) | 652 | m_part.ParentGroup.HasGroupChanged = true; |
687 | { | ||
688 | foreach (TaskInventoryItem item in m_items.Values) | ||
689 | { | ||
690 | if (item.Type == 10) | ||
691 | { | ||
692 | scriptcount++; | ||
693 | } | ||
694 | } | ||
695 | } | ||
696 | 653 | ||
697 | if (scriptcount <= 0) | 654 | if (!ContainsScripts()) |
698 | { | 655 | m_part.RemFlag(PrimFlags.Scripted); |
699 | m_part.RemFlag(PrimFlags.Scripted); | ||
700 | } | ||
701 | 656 | ||
702 | m_part.ScheduleFullUpdate(); | 657 | m_part.ScheduleFullUpdate(); |
703 | 658 | ||
704 | return type; | 659 | return type; |
705 | } | 660 | |
706 | else | 661 | } |
707 | { | 662 | else |
708 | m_log.ErrorFormat( | 663 | { |
709 | "[PRIM INVENTORY]: " + | 664 | m_log.ErrorFormat( |
710 | "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | 665 | "[PRIM INVENTORY]: " + |
711 | itemID, m_part.Name, m_part.UUID, | 666 | "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", |
712 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | 667 | itemID, m_part.Name, m_part.UUID, |
713 | } | 668 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); |
714 | } | 669 | } |
715 | 670 | ||
716 | return -1; | 671 | return -1; |
@@ -764,52 +719,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
764 | // isn't available (such as drag from prim inventory to agent inventory) | 719 | // isn't available (such as drag from prim inventory to agent inventory) |
765 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); | 720 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); |
766 | 721 | ||
767 | lock (m_items) | 722 | List<TaskInventoryItem> items = GetInventoryItems(); |
723 | foreach (TaskInventoryItem item in items) | ||
768 | { | 724 | { |
769 | foreach (TaskInventoryItem item in m_items.Values) | 725 | UUID ownerID = item.OwnerID; |
770 | { | 726 | uint everyoneMask = 0; |
771 | UUID ownerID = item.OwnerID; | 727 | uint baseMask = item.BasePermissions; |
772 | uint everyoneMask = 0; | 728 | uint ownerMask = item.CurrentPermissions; |
773 | uint baseMask = item.BasePermissions; | 729 | uint groupMask = item.GroupPermissions; |
774 | uint ownerMask = item.CurrentPermissions; | ||
775 | uint groupMask = item.GroupPermissions; | ||
776 | 730 | ||
777 | invString.AddItemStart(); | 731 | invString.AddItemStart(); |
778 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | 732 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); |
779 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); | 733 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); |
780 | 734 | ||
781 | invString.AddPermissionsStart(); | 735 | invString.AddPermissionsStart(); |
782 | 736 | ||
783 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); | 737 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); |
784 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); | 738 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); |
785 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); | 739 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); |
786 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); | 740 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); |
787 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); | 741 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); |
788 | 742 | ||
789 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); | 743 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); |
790 | invString.AddNameValueLine("owner_id", ownerID.ToString()); | 744 | invString.AddNameValueLine("owner_id", ownerID.ToString()); |
791 | 745 | ||
792 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); | 746 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); |
793 | 747 | ||
794 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); | 748 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); |
795 | invString.AddSectionEnd(); | 749 | invString.AddSectionEnd(); |
796 | 750 | ||
797 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); | 751 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); |
798 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); | 752 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); |
799 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); | 753 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); |
800 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); | 754 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); |
801 | 755 | ||
802 | invString.AddSaleStart(); | 756 | invString.AddSaleStart(); |
803 | invString.AddNameValueLine("sale_type", "not"); | 757 | invString.AddNameValueLine("sale_type", "not"); |
804 | invString.AddNameValueLine("sale_price", "0"); | 758 | invString.AddNameValueLine("sale_price", "0"); |
805 | invString.AddSectionEnd(); | 759 | invString.AddSectionEnd(); |
806 | 760 | ||
807 | invString.AddNameValueLine("name", item.Name + "|"); | 761 | invString.AddNameValueLine("name", item.Name + "|"); |
808 | invString.AddNameValueLine("desc", item.Description + "|"); | 762 | invString.AddNameValueLine("desc", item.Description + "|"); |
809 | 763 | ||
810 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); | 764 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); |
811 | invString.AddSectionEnd(); | 765 | invString.AddSectionEnd(); |
812 | } | ||
813 | } | 766 | } |
814 | 767 | ||
815 | fileData = Utils.StringToBytes(invString.BuildString); | 768 | fileData = Utils.StringToBytes(invString.BuildString); |
@@ -831,12 +784,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
831 | { | 784 | { |
832 | if (HasInventoryChanged) | 785 | if (HasInventoryChanged) |
833 | { | 786 | { |
834 | lock (Items) | ||
835 | { | ||
836 | datastore.StorePrimInventory(m_part.UUID, Items.Values); | ||
837 | } | ||
838 | |||
839 | HasInventoryChanged = false; | 787 | HasInventoryChanged = false; |
788 | List<TaskInventoryItem> items = GetInventoryItems(); | ||
789 | datastore.StorePrimInventory(m_part.UUID, items); | ||
790 | |||
840 | } | 791 | } |
841 | } | 792 | } |
842 | 793 | ||
@@ -1002,6 +953,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1002 | 953 | ||
1003 | return ret; | 954 | return ret; |
1004 | } | 955 | } |
956 | |||
957 | public List<TaskInventoryItem> GetInventoryItems() | ||
958 | { | ||
959 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | ||
960 | |||
961 | lock (m_items) | ||
962 | ret = new List<TaskInventoryItem>(m_items.Values); | ||
963 | |||
964 | return ret; | ||
965 | } | ||
966 | |||
967 | public List<TaskInventoryItem> GetInventoryScripts() | ||
968 | { | ||
969 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | ||
970 | |||
971 | lock (m_items) | ||
972 | { | ||
973 | foreach (TaskInventoryItem item in m_items.Values) | ||
974 | if (item.InvType == (int)InventoryType.LSL) | ||
975 | ret.Add(item); | ||
976 | } | ||
977 | |||
978 | return ret; | ||
979 | } | ||
1005 | 980 | ||
1006 | public Dictionary<UUID, string> GetScriptStates() | 981 | public Dictionary<UUID, string> GetScriptStates() |
1007 | { | 982 | { |
@@ -1011,24 +986,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1011 | if (engines == null) // No engine at all | 986 | if (engines == null) // No engine at all |
1012 | return ret; | 987 | return ret; |
1013 | 988 | ||
1014 | lock (m_items) | 989 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
990 | |||
991 | foreach (TaskInventoryItem item in scripts) | ||
1015 | { | 992 | { |
1016 | foreach (TaskInventoryItem item in m_items.Values) | 993 | foreach (IScriptModule e in engines) |
1017 | { | 994 | { |
1018 | if (item.InvType == (int)InventoryType.LSL) | 995 | if (e != null) |
1019 | { | 996 | { |
1020 | foreach (IScriptModule e in engines) | 997 | string n = e.GetXMLState(item.ItemID); |
998 | if (n != String.Empty) | ||
1021 | { | 999 | { |
1022 | if (e != null) | 1000 | if (!ret.ContainsKey(item.ItemID)) |
1023 | { | 1001 | ret[item.ItemID] = n; |
1024 | string n = e.GetXMLState(item.ItemID); | 1002 | break; |
1025 | if (n != String.Empty) | ||
1026 | { | ||
1027 | if (!ret.ContainsKey(item.ItemID)) | ||
1028 | ret[item.ItemID] = n; | ||
1029 | break; | ||
1030 | } | ||
1031 | } | ||
1032 | } | 1003 | } |
1033 | } | 1004 | } |
1034 | } | 1005 | } |
@@ -1043,25 +1014,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1043 | if (engines == null) | 1014 | if (engines == null) |
1044 | return; | 1015 | return; |
1045 | 1016 | ||
1046 | lock (m_items) | 1017 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
1018 | |||
1019 | foreach (TaskInventoryItem item in scripts) | ||
1047 | { | 1020 | { |
1048 | foreach (TaskInventoryItem item in m_items.Values) | 1021 | foreach (IScriptModule engine in engines) |
1049 | { | 1022 | { |
1050 | if (item.InvType == (int)InventoryType.LSL) | 1023 | if (engine != null) |
1051 | { | 1024 | { |
1052 | foreach (IScriptModule engine in engines) | 1025 | if (item.OwnerChanged) |
1053 | { | 1026 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); |
1054 | if (engine != null) | 1027 | item.OwnerChanged = false; |
1055 | { | 1028 | engine.ResumeScript(item.ItemID); |
1056 | if (item.OwnerChanged) | ||
1057 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); | ||
1058 | item.OwnerChanged = false; | ||
1059 | engine.ResumeScript(item.ItemID); | ||
1060 | } | ||
1061 | } | ||
1062 | } | 1029 | } |
1063 | } | 1030 | } |
1064 | } | 1031 | } |
1065 | } | 1032 | } |
1033 | |||
1066 | } | 1034 | } |
1067 | } | 1035 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c5226ba..f3f7269 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -465,22 +465,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
465 | 465 | ||
466 | //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke | 466 | //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke |
467 | 467 | ||
468 | // Utility function for llRot2Euler | 468 | // Old implementation of llRot2Euler. Normalization not required as Atan2 function will |
469 | 469 | // only return values >= -PI (-180 degrees) and <= PI (180 degrees). | |
470 | // normalize an angle between -PI and PI (-180 to +180 degrees) | ||
471 | protected double NormalizeAngle(double angle) | ||
472 | { | ||
473 | if (angle > -Math.PI && angle < Math.PI) | ||
474 | return angle; | ||
475 | |||
476 | int numPis = (int)(Math.PI / angle); | ||
477 | double remainder = angle - Math.PI * numPis; | ||
478 | if (numPis % 2 == 1) | ||
479 | return Math.PI - angle; | ||
480 | return remainder; | ||
481 | } | ||
482 | |||
483 | // Old implementation of llRot2Euler, now normalized | ||
484 | 470 | ||
485 | public LSL_Vector llRot2Euler(LSL_Rotation r) | 471 | public LSL_Vector llRot2Euler(LSL_Rotation r) |
486 | { | 472 | { |
@@ -492,13 +478,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
492 | double n = 2 * (r.y * r.s + r.x * r.z); | 478 | double n = 2 * (r.y * r.s + r.x * r.z); |
493 | double p = m * m - n * n; | 479 | double p = m * m - n * n; |
494 | if (p > 0) | 480 | if (p > 0) |
495 | return new LSL_Vector(NormalizeAngle(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s))), | 481 | return new LSL_Vector(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s)), |
496 | NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))), | 482 | Math.Atan2(n, Math.Sqrt(p)), |
497 | NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)))); | 483 | Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s))); |
498 | else if (n > 0) | 484 | else if (n > 0) |
499 | return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); | 485 | return new LSL_Vector(0.0, Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)); |
500 | else | 486 | else |
501 | return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); | 487 | return new LSL_Vector(0.0, -Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)); |
502 | } | 488 | } |
503 | 489 | ||
504 | /* From wiki: | 490 | /* From wiki: |
@@ -5874,6 +5860,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5874 | PSYS_PART_MAX_AGE = 7, | 5860 | PSYS_PART_MAX_AGE = 7, |
5875 | PSYS_SRC_ACCEL = 8, | 5861 | PSYS_SRC_ACCEL = 8, |
5876 | PSYS_SRC_PATTERN = 9, | 5862 | PSYS_SRC_PATTERN = 9, |
5863 | PSYS_SRC_INNERANGLE = 10, | ||
5864 | PSYS_SRC_OUTERANGLE = 11, | ||
5877 | PSYS_SRC_TEXTURE = 12, | 5865 | PSYS_SRC_TEXTURE = 12, |
5878 | PSYS_SRC_BURST_RATE = 13, | 5866 | PSYS_SRC_BURST_RATE = 13, |
5879 | PSYS_SRC_BURST_PART_COUNT = 15, | 5867 | PSYS_SRC_BURST_PART_COUNT = 15, |
@@ -6006,6 +5994,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6006 | prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; | 5994 | prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; |
6007 | break; | 5995 | break; |
6008 | 5996 | ||
5997 | // PSYS_SRC_INNERANGLE and PSYS_SRC_ANGLE_BEGIN use the same variables. The | ||
5998 | // PSYS_SRC_OUTERANGLE and PSYS_SRC_ANGLE_END also use the same variable. The | ||
5999 | // client tells the difference between the two by looking at the 0x02 bit in | ||
6000 | // the PartFlags variable. | ||
6001 | case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE: | ||
6002 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6003 | prules.InnerAngle = (float)tempf; | ||
6004 | prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off. | ||
6005 | break; | ||
6006 | |||
6007 | case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE: | ||
6008 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6009 | prules.OuterAngle = (float)tempf; | ||
6010 | prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off. | ||
6011 | break; | ||
6012 | |||
6009 | case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: | 6013 | case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: |
6010 | prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1)); | 6014 | prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1)); |
6011 | break; | 6015 | break; |
@@ -6062,11 +6066,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6062 | case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN: | 6066 | case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN: |
6063 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6067 | tempf = (float)rules.GetLSLFloatItem(i + 1); |
6064 | prules.InnerAngle = (float)tempf; | 6068 | prules.InnerAngle = (float)tempf; |
6069 | prules.PartFlags |= 0x02; // Set new angle format. | ||
6065 | break; | 6070 | break; |
6066 | 6071 | ||
6067 | case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END: | 6072 | case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END: |
6068 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6073 | tempf = (float)rules.GetLSLFloatItem(i + 1); |
6069 | prules.OuterAngle = (float)tempf; | 6074 | prules.OuterAngle = (float)tempf; |
6075 | prules.PartFlags |= 0x02; // Set new angle format. | ||
6070 | break; | 6076 | break; |
6071 | } | 6077 | } |
6072 | 6078 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index bc5df11..cc9e58c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -701,9 +701,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
701 | } | 701 | } |
702 | } | 702 | } |
703 | 703 | ||
704 | ScriptInstance instance = null; | ||
704 | lock (m_Scripts) | 705 | lock (m_Scripts) |
705 | { | 706 | { |
706 | ScriptInstance instance = null; | ||
707 | // Create the object record | 707 | // Create the object record |
708 | 708 | ||
709 | if ((!m_Scripts.ContainsKey(itemID)) || | 709 | if ((!m_Scripts.ContainsKey(itemID)) || |
@@ -786,28 +786,29 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
786 | 786 | ||
787 | m_Scripts[itemID] = instance; | 787 | m_Scripts[itemID] = instance; |
788 | } | 788 | } |
789 | } | ||
789 | 790 | ||
790 | lock (m_PrimObjects) | 791 | lock (m_PrimObjects) |
791 | { | 792 | { |
792 | if (!m_PrimObjects.ContainsKey(localID)) | 793 | if (!m_PrimObjects.ContainsKey(localID)) |
793 | m_PrimObjects[localID] = new List<UUID>(); | 794 | m_PrimObjects[localID] = new List<UUID>(); |
794 | |||
795 | if (!m_PrimObjects[localID].Contains(itemID)) | ||
796 | m_PrimObjects[localID].Add(itemID); | ||
797 | 795 | ||
798 | } | 796 | if (!m_PrimObjects[localID].Contains(itemID)) |
797 | m_PrimObjects[localID].Add(itemID); | ||
799 | 798 | ||
800 | if (!m_Assemblies.ContainsKey(assetID)) | 799 | } |
801 | m_Assemblies[assetID] = assembly; | ||
802 | 800 | ||
803 | lock (m_AddingAssemblies) | 801 | if (!m_Assemblies.ContainsKey(assetID)) |
804 | { | 802 | m_Assemblies[assetID] = assembly; |
805 | m_AddingAssemblies[assembly]--; | ||
806 | } | ||
807 | 803 | ||
808 | if (instance!=null) | 804 | lock (m_AddingAssemblies) |
809 | instance.Init(); | 805 | { |
806 | m_AddingAssemblies[assembly]--; | ||
810 | } | 807 | } |
808 | |||
809 | if (instance != null) | ||
810 | instance.Init(); | ||
811 | |||
811 | return true; | 812 | return true; |
812 | } | 813 | } |
813 | 814 | ||
@@ -820,60 +821,60 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
820 | m_CompileDict.Remove(itemID); | 821 | m_CompileDict.Remove(itemID); |
821 | } | 822 | } |
822 | 823 | ||
824 | IScriptInstance instance = null; | ||
825 | |||
823 | lock (m_Scripts) | 826 | lock (m_Scripts) |
824 | { | 827 | { |
825 | // Do we even have it? | 828 | // Do we even have it? |
826 | if (!m_Scripts.ContainsKey(itemID)) | 829 | if (!m_Scripts.ContainsKey(itemID)) |
827 | return; | 830 | return; |
828 | 831 | ||
829 | IScriptInstance instance=m_Scripts[itemID]; | 832 | instance=m_Scripts[itemID]; |
830 | m_Scripts.Remove(itemID); | 833 | m_Scripts.Remove(itemID); |
834 | } | ||
831 | 835 | ||
832 | instance.ClearQueue(); | 836 | instance.ClearQueue(); |
833 | instance.Stop(0); | 837 | instance.Stop(0); |
834 | |||
835 | // bool objectRemoved = false; | 838 | // bool objectRemoved = false; |
836 | 839 | ||
837 | lock (m_PrimObjects) | 840 | lock (m_PrimObjects) |
841 | { | ||
842 | // Remove the script from it's prim | ||
843 | if (m_PrimObjects.ContainsKey(localID)) | ||
838 | { | 844 | { |
839 | // Remove the script from it's prim | 845 | // Remove inventory item record |
840 | if (m_PrimObjects.ContainsKey(localID)) | 846 | if (m_PrimObjects[localID].Contains(itemID)) |
841 | { | 847 | m_PrimObjects[localID].Remove(itemID); |
842 | // Remove inventory item record | ||
843 | if (m_PrimObjects[localID].Contains(itemID)) | ||
844 | m_PrimObjects[localID].Remove(itemID); | ||
845 | 848 | ||
846 | // If there are no more scripts, remove prim | 849 | // If there are no more scripts, remove prim |
847 | if (m_PrimObjects[localID].Count == 0) | 850 | if (m_PrimObjects[localID].Count == 0) |
848 | { | 851 | { |
849 | m_PrimObjects.Remove(localID); | 852 | m_PrimObjects.Remove(localID); |
850 | // objectRemoved = true; | 853 | // objectRemoved = true; |
851 | } | ||
852 | } | 854 | } |
853 | } | 855 | } |
856 | } | ||
854 | 857 | ||
855 | instance.RemoveState(); | 858 | instance.RemoveState(); |
856 | instance.DestroyScriptInstance(); | 859 | instance.DestroyScriptInstance(); |
857 | |||
858 | m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); | ||
859 | if (m_DomainScripts[instance.AppDomain].Count == 0) | ||
860 | { | ||
861 | m_DomainScripts.Remove(instance.AppDomain); | ||
862 | UnloadAppDomain(instance.AppDomain); | ||
863 | } | ||
864 | 860 | ||
865 | instance = null; | 861 | m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); |
862 | if (m_DomainScripts[instance.AppDomain].Count == 0) | ||
863 | { | ||
864 | m_DomainScripts.Remove(instance.AppDomain); | ||
865 | UnloadAppDomain(instance.AppDomain); | ||
866 | } | ||
866 | 867 | ||
867 | ObjectRemoved handlerObjectRemoved = OnObjectRemoved; | 868 | instance = null; |
868 | if (handlerObjectRemoved != null) | ||
869 | { | ||
870 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); | ||
871 | handlerObjectRemoved(part.UUID); | ||
872 | } | ||
873 | 869 | ||
874 | CleanAssemblies(); | 870 | ObjectRemoved handlerObjectRemoved = OnObjectRemoved; |
871 | if (handlerObjectRemoved != null) | ||
872 | { | ||
873 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); | ||
874 | handlerObjectRemoved(part.UUID); | ||
875 | } | 875 | } |
876 | 876 | ||
877 | |||
877 | ScriptRemoved handlerScriptRemoved = OnScriptRemoved; | 878 | ScriptRemoved handlerScriptRemoved = OnScriptRemoved; |
878 | if (handlerScriptRemoved != null) | 879 | if (handlerScriptRemoved != null) |
879 | handlerScriptRemoved(itemID); | 880 | handlerScriptRemoved(itemID); |
@@ -1007,26 +1008,33 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1007 | public bool PostObjectEvent(uint localID, EventParams p) | 1008 | public bool PostObjectEvent(uint localID, EventParams p) |
1008 | { | 1009 | { |
1009 | bool result = false; | 1010 | bool result = false; |
1010 | 1011 | List<UUID> uuids = null; | |
1012 | |||
1011 | lock (m_PrimObjects) | 1013 | lock (m_PrimObjects) |
1012 | { | 1014 | { |
1013 | if (!m_PrimObjects.ContainsKey(localID)) | 1015 | if (!m_PrimObjects.ContainsKey(localID)) |
1014 | return false; | 1016 | return false; |
1015 | 1017 | ||
1016 | 1018 | uuids = m_PrimObjects[localID]; | |
1017 | foreach (UUID itemID in m_PrimObjects[localID]) | 1019 | } |
1020 | |||
1021 | foreach (UUID itemID in uuids) | ||
1022 | { | ||
1023 | IScriptInstance instance = null; | ||
1024 | try | ||
1018 | { | 1025 | { |
1019 | if (m_Scripts.ContainsKey(itemID)) | 1026 | if (m_Scripts.ContainsKey(itemID)) |
1020 | { | 1027 | instance = m_Scripts[itemID]; |
1021 | IScriptInstance instance = m_Scripts[itemID]; | 1028 | } |
1022 | if (instance != null) | 1029 | catch { /* ignore race conditions */ } |
1023 | { | 1030 | |
1024 | instance.PostEvent(p); | 1031 | if (instance != null) |
1025 | result = true; | 1032 | { |
1026 | } | 1033 | instance.PostEvent(p); |
1027 | } | 1034 | result = true; |
1028 | } | 1035 | } |
1029 | } | 1036 | } |
1037 | |||
1030 | return result; | 1038 | return result; |
1031 | } | 1039 | } |
1032 | 1040 | ||