aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-01-07 03:02:13 +0000
committerJustin Clarke Casey2008-01-07 03:02:13 +0000
commit6b4b041902627d9d16f28847b1db7f369b931006 (patch)
tree40b44be799775829606766cf1ad8950655486b30
parentShameless self-promotion :) (diff)
downloadopensim-SC-6b4b041902627d9d16f28847b1db7f369b931006.zip
opensim-SC-6b4b041902627d9d16f28847b1db7f369b931006.tar.gz
opensim-SC-6b4b041902627d9d16f28847b1db7f369b931006.tar.bz2
opensim-SC-6b4b041902627d9d16f28847b1db7f369b931006.tar.xz
Refactor Scene.Inventory.RezScript to use newer script starting code
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs56
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs30
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs26
3 files changed, 65 insertions, 47 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index f3673fc..bfde643 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -559,57 +559,31 @@ namespace OpenSim.Region.Environment.Scenes
559 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 559 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
560 if (item != null) 560 if (item != null)
561 { 561 {
562 bool isTexture = false; 562 SceneObjectGroup group = GetGroupByPrim(localID);
563 bool rezzed = false; 563 if (group != null)
564 if (item.invType == 0)
565 { 564 {
566 isTexture = true; 565 // TODO: do we care about the value of this bool?
567 } 566 group.AddInventoryItem(remoteClient, localID, item, copyID);
568 567 group.StartScript(localID, copyID);
569 AssetBase rezAsset = AssetCache.GetAsset(item.assetID, isTexture); 568 group.GetProperites(remoteClient);
570
571 if (rezAsset != null)
572 {
573 string script = Helpers.FieldToUTF8String(rezAsset.Data);
574 EventManager.TriggerRezScript(localID, copyID, script);
575 rezzed = true;
576 }
577 569
578 if (rezzed) 570 MainLog.Instance.Verbose(
579 { 571 "PRIMINVENTORY",
580 SceneObjectGroup group = GetGroupByPrim(localID); 572 "Rezzed script {0} into prim local ID {1} for user {2}",
581 if (group != null) 573 item.inventoryName, localID, remoteClient.Name);
582 {
583 // TODO: do we care about the value of this bool?
584 group.AddInventoryItem(remoteClient, localID, item, copyID);
585 group.GetProperites(remoteClient);
586
587 MainLog.Instance.Verbose(
588 "PRIMINVENTORY",
589 "Rezzed script {0} (asset {1}) into prim {2} for user {3}",
590 item.inventoryName, rezAsset.FullID, localID, remoteClient.Name);
591 }
592 else
593 {
594 MainLog.Instance.Warn(
595 "PRIMINVENTORY",
596 "Could not rez script {0} into prim {1} for user {2}"
597 + " because the prim could not be found in the region!",
598 item.inventoryName, localID, remoteClient.Name);
599 }
600 } 574 }
601 else 575 else
602 { 576 {
603 MainLog.Instance.Warn( 577 MainLog.Instance.Error(
604 "PRIMINVENTORY", 578 "PRIMINVENTORY",
605 "Could not rez script {0} into prim {1} for user {2}" 579 "Could not rez script {0} into prim local ID {1} for user {2}"
606 + " because the item asset {3} could not be found!", 580 + " because the prim could not be found in the region!",
607 item.inventoryName, localID, item.assetID, remoteClient.Name); 581 item.inventoryName, localID, remoteClient.Name);
608 } 582 }
609 } 583 }
610 else 584 else
611 { 585 {
612 MainLog.Instance.Warn( 586 MainLog.Instance.Error(
613 "PRIMINVENTORY", "Could not find script inventory item {0} to rez for {1}!", 587 "PRIMINVENTORY", "Could not find script inventory item {0} to rez for {1}!",
614 itemID, remoteClient.Name); 588 itemID, remoteClient.Name);
615 } 589 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index 50e3fa7..1d382fa 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -37,7 +37,29 @@ using OpenSim.Region.Environment.Interfaces;
37namespace OpenSim.Region.Environment.Scenes 37namespace OpenSim.Region.Environment.Scenes
38{ 38{
39 public partial class SceneObjectGroup : EntityBase 39 public partial class SceneObjectGroup : EntityBase
40 { 40 {
41 /// <summary>
42 /// Start a given script.
43 /// </summary>
44 /// <param name="localID">
45 /// A <see cref="System.UInt32"/>
46 /// </param>
47 public void StartScript(uint localID, LLUUID itemID)
48 {
49 SceneObjectPart part = GetChildPart(localID);
50 if (part != null)
51 {
52 part.StartScript(itemID);
53 }
54 else
55 {
56 MainLog.Instance.Error(
57 "PRIMINVENTORY",
58 "Couldn't find part {0} in object group {1}, {2} to start script with ID {3}",
59 localID, Name, UUID, itemID);
60 }
61 }
62
41 /// <summary> 63 /// <summary>
42 /// Start the scripts contained in all the prims in this group. 64 /// Start the scripts contained in all the prims in this group.
43 /// </summary> 65 /// </summary>
@@ -63,8 +85,8 @@ namespace OpenSim.Region.Environment.Scenes
63 } 85 }
64 else 86 else
65 { 87 {
66 MainLog.Instance.Warn( 88 MainLog.Instance.Error(
67 "SCENE", 89 "PRIMINVENTORY",
68 "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", 90 "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory",
69 localID, Name, UUID); 91 localID, Name, UUID);
70 } 92 }
@@ -80,7 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
80 } 102 }
81 else 103 else
82 { 104 {
83 MainLog.Instance.Warn( 105 MainLog.Instance.Error(
84 "PRIMINVENTORY", 106 "PRIMINVENTORY",
85 "Couldn't find part {0} in object group {1}, {2} to request inventory data", 107 "Couldn't find part {0} in object group {1}, {2} to request inventory data",
86 localID, Name, UUID); 108 localID, Name, UUID);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 5f93986..98cd3af 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Environment.Scenes
97 } 97 }
98 98
99 /// <summary> 99 /// <summary>
100 /// Start a script in this prim 100 /// Start a script which is in this prim's inventory.
101 /// </summary> 101 /// </summary>
102 /// <param name="item"></param> 102 /// <param name="item"></param>
103 /// <returns>true if script asset was found, false if it wasn't</returns> 103 /// <returns>true if script asset was found, false if it wasn't</returns>
@@ -126,7 +126,29 @@ namespace OpenSim.Region.Environment.Scenes
126 } 126 }
127 127
128 return false; 128 return false;
129 } 129 }
130
131 /// <summary>
132 /// Start a script which is in this prim's inventory.
133 /// </summary>
134 /// <param name="itemId">
135 /// A <see cref="LLUUID"/>
136 /// </param>
137 public void StartScript(LLUUID itemId)
138 {
139 if (m_taskInventory.ContainsKey(itemId))
140 {
141 StartScript(m_taskInventory[itemId]);
142 }
143 else
144 {
145 MainLog.Instance.Error(
146 "PRIMINVENTORY",
147 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}",
148 itemId, Name, UUID);
149 }
150
151 }
130 152
131 /// <summary> 153 /// <summary>
132 /// Add an item to this prim's inventory. 154 /// Add an item to this prim's inventory.