aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs112
7 files changed, 119 insertions, 67 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index c605fc1..4f0e100 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -81,7 +81,12 @@ namespace OpenSim.Region.Framework.Interfaces
81 /// <summary> 81 /// <summary>
82 /// Start all the scripts contained in this entity's inventory 82 /// Start all the scripts contained in this entity's inventory
83 /// </summary> 83 /// </summary>
84 void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); 84 /// <param name="startParam"></param>
85 /// <param name="postOnRez"></param>
86 /// <param name="engine"></param>
87 /// <param name="stateSource"></param>
88 /// <returns>Number of scripts started.</returns>
89 int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
85 90
86 ArrayList GetScriptErrors(UUID itemID); 91 ArrayList GetScriptErrors(UUID itemID);
87 void ResumeScripts(); 92 void ResumeScripts();
@@ -102,7 +107,11 @@ namespace OpenSim.Region.Framework.Interfaces
102 /// <param name="postOnRez"></param> 107 /// <param name="postOnRez"></param>
103 /// <param name="engine"></param> 108 /// <param name="engine"></param>
104 /// <param name="stateSource"></param> 109 /// <param name="stateSource"></param>
105 void CreateScriptInstance( 110 /// <returns>
111 /// true if the script instance was valid for starting, false otherwise. This does not guarantee
112 /// that the script was actually started, just that the script was valid (i.e. its asset data could be found, etc.)
113 /// </returns>
114 bool CreateScriptInstance(
106 TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource); 115 TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource);
107 116
108 /// <summary> 117 /// <summary>
@@ -113,7 +122,11 @@ namespace OpenSim.Region.Framework.Interfaces
113 /// <param name="postOnRez"></param> 122 /// <param name="postOnRez"></param>
114 /// <param name="engine"></param> 123 /// <param name="engine"></param>
115 /// <param name="stateSource"></param> 124 /// <param name="stateSource"></param>
116 void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource); 125 /// <returns>
126 /// true if the script instance was valid for starting, false otherwise. This does not guarantee
127 /// that the script was actually started, just that the script was valid (i.e. its asset data could be found, etc.)
128 /// </returns>
129 bool CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource);
117 130
118 ArrayList CreateScriptInstanceEr(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource); 131 ArrayList CreateScriptInstanceEr(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource);
119 132
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index e1281a6..98b8fcc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -60,19 +60,32 @@ namespace OpenSim.Region.Framework.Scenes
60 /// <summary> 60 /// <summary>
61 /// Creates all the scripts in the scene which should be started. 61 /// Creates all the scripts in the scene which should be started.
62 /// </summary> 62 /// </summary>
63 public void CreateScriptInstances() 63 /// <returns>
64 /// Number of scripts that were valid for starting. This does not guarantee that all these scripts
65 /// were actually started, but just that the start could be attempt (e.g. the asset data for the script could be found)
66 /// </returns>
67 public int CreateScriptInstances()
64 { 68 {
65 m_log.Info("[PRIM INVENTORY]: Creating scripts in scene"); 69 m_log.InfoFormat("[SCENE]: Initializing script instances in {0}", RegionInfo.RegionName);
70
71 int scriptsValidForStarting = 0;
66 72
67 EntityBase[] entities = Entities.GetEntities(); 73 EntityBase[] entities = Entities.GetEntities();
68 foreach (EntityBase group in entities) 74 foreach (EntityBase group in entities)
69 { 75 {
70 if (group is SceneObjectGroup) 76 if (group is SceneObjectGroup)
71 { 77 {
72 ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0); 78 scriptsValidForStarting
79 += ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
73 ((SceneObjectGroup) group).ResumeScripts(); 80 ((SceneObjectGroup) group).ResumeScripts();
74 } 81 }
75 } 82 }
83
84 m_log.InfoFormat(
85 "[SCENE]: Initialized {0} script instances in {1}",
86 scriptsValidForStarting, RegionInfo.RegionName);
87
88 return scriptsValidForStarting;
76 } 89 }
77 90
78 /// <summary> 91 /// <summary>
@@ -80,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes
80 /// </summary> 93 /// </summary>
81 public void StartScripts() 94 public void StartScripts()
82 { 95 {
83 m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); 96 m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName);
84 97
85 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>(); 98 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
86 99
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 85bae9a..757ac9f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1522,11 +1522,11 @@ namespace OpenSim.Region.Framework.Scenes
1522 LoginLock = false; 1522 LoginLock = false;
1523 EventManager.TriggerLoginsEnabled(RegionInfo.RegionName); 1523 EventManager.TriggerLoginsEnabled(RegionInfo.RegionName);
1524 } 1524 }
1525 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1526 1525
1527 // For RegionReady lockouts 1526 // For RegionReady lockouts
1528 if(LoginLock == false) 1527 if (!LoginLock)
1529 { 1528 {
1529 m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1530 LoginsDisabled = false; 1530 LoginsDisabled = false;
1531 } 1531 }
1532 1532
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 2effa25..1038111 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -54,16 +54,28 @@ namespace OpenSim.Region.Framework.Scenes
54 /// <summary> 54 /// <summary>
55 /// Start the scripts contained in all the prims in this group. 55 /// Start the scripts contained in all the prims in this group.
56 /// </summary> 56 /// </summary>
57 public void CreateScriptInstances(int startParam, bool postOnRez, 57 /// <param name="startParam"></param>
58 string engine, int stateSource) 58 /// <param name="postOnRez"></param>
59 /// <param name="engine"></param>
60 /// <param name="stateSource"></param>
61 /// <returns>
62 /// Number of scripts that were valid for starting. This does not guarantee that all these scripts
63 /// were actually started, but just that the start could be attempt (e.g. the asset data for the script could be found)
64 /// </returns>
65 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
59 { 66 {
67 int scriptsStarted = 0;
68
60 // Don't start scripts if they're turned off in the region! 69 // Don't start scripts if they're turned off in the region!
61 if (!m_scene.RegionInfo.RegionSettings.DisableScripts) 70 if (!m_scene.RegionInfo.RegionSettings.DisableScripts)
62 { 71 {
63 SceneObjectPart[] parts = m_parts.GetArray(); 72 SceneObjectPart[] parts = m_parts.GetArray();
64 for (int i = 0; i < parts.Length; i++) 73 for (int i = 0; i < parts.Length; i++)
65 parts[i].Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource); 74 scriptsStarted
75 += parts[i].Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource);
66 } 76 }
77
78 return scriptsStarted;
67 } 79 }
68 80
69 /// <summary> 81 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 8ed58a6..88afee7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1824,8 +1824,9 @@ namespace OpenSim.Region.Framework.Scenes
1824 part.ClearUpdateSchedule(); 1824 part.ClearUpdateSchedule();
1825 if (part == m_rootPart) 1825 if (part == m_rootPart)
1826 { 1826 {
1827 if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) || 1827 if (!IsAttachment
1828 (AttachmentPoint < 31) || (AttachmentPoint > 38)) 1828 || AttachedAvatar == avatar.ControllingClient.AgentId
1829 || !HasPrivateAttachmentPoint)
1829 avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId }); 1830 avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId });
1830 } 1831 }
1831 } 1832 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index c1fe6a3..f1e781c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2059,7 +2059,7 @@ namespace OpenSim.Region.Framework.Scenes
2059 else 2059 else
2060 m_log.WarnFormat( 2060 m_log.WarnFormat(
2061 "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data", 2061 "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data",
2062 Name, LocalId, id); 2062 Name, UUID, id);
2063 } 2063 }
2064 2064
2065 /// <summary> 2065 /// <summary>
@@ -5026,8 +5026,9 @@ namespace OpenSim.Region.Framework.Scenes
5026 if (ParentGroup.IsDeleted) 5026 if (ParentGroup.IsDeleted)
5027 return; 5027 return;
5028 5028
5029 if (ParentGroup.IsAttachment && ((ParentGroup.RootPart != this) || 5029 if (ParentGroup.IsAttachment
5030 ((ParentGroup.AttachedAvatar != remoteClient.AgentId) && (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38)))) 5030 && (ParentGroup.RootPart != this
5031 || ParentGroup.AttachedAvatar != remoteClient.AgentId && ParentGroup.HasPrivateAttachmentPoint))
5031 return; 5032 return;
5032 5033
5033 // Causes this thread to dig into the Client Thread Data. 5034 // Causes this thread to dig into the Client Thread Data.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 81477e7..14ef0fb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -260,14 +260,16 @@ namespace OpenSim.Region.Framework.Scenes
260 Items.LockItemsForRead(false); 260 Items.LockItemsForRead(false);
261 } 261 }
262 262
263 /// <summary> 263 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
264 /// Start all the scripts contained in this prim's inventory
265 /// </summary>
266 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
267 { 264 {
265 int scriptsValidForStarting = 0;
266
268 List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); 267 List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
269 foreach (TaskInventoryItem item in scripts) 268 foreach (TaskInventoryItem item in scripts)
270 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); 269 if (CreateScriptInstance(item, startParam, postOnRez, engine, stateSource))
270 scriptsValidForStarting++;
271
272 return scriptsValidForStarting;
271 } 273 }
272 274
273 public ArrayList GetScriptErrors(UUID itemID) 275 public ArrayList GetScriptErrors(UUID itemID)
@@ -310,8 +312,8 @@ namespace OpenSim.Region.Framework.Scenes
310 /// Start a script which is in this prim's inventory. 312 /// Start a script which is in this prim's inventory.
311 /// </summary> 313 /// </summary>
312 /// <param name="item"></param> 314 /// <param name="item"></param>
313 /// <returns></returns> 315 /// <returns>true if the script instance was created, false otherwise</returns>
314 public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource) 316 public bool CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource)
315 { 317 {
316// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", 318// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
317// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); 319// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
@@ -319,61 +321,70 @@ namespace OpenSim.Region.Framework.Scenes
319 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 321 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
320 { 322 {
321 StoreScriptError(item.ItemID, "no permission"); 323 StoreScriptError(item.ItemID, "no permission");
322 return; 324 return false;
323 } 325 }
324 326
325 m_part.AddFlag(PrimFlags.Scripted); 327 m_part.AddFlag(PrimFlags.Scripted);
326 328
327 if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) 329 if (m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
330 return false;
331
332 if (stateSource == 2 && // Prim crossing
333 m_part.ParentGroup.Scene.m_trustBinaries)
328 { 334 {
329 if (stateSource == 2 && // Prim crossing 335 m_items.LockItemsForWrite(true);
330 m_part.ParentGroup.Scene.m_trustBinaries) 336 m_items[item.ItemID].PermsMask = 0;
331 { 337 m_items[item.ItemID].PermsGranter = UUID.Zero;
332 m_items.LockItemsForWrite(true); 338 m_items.LockItemsForWrite(false);
333 m_items[item.ItemID].PermsMask = 0; 339 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
334 m_items[item.ItemID].PermsGranter = UUID.Zero; 340 m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
335 m_items.LockItemsForWrite(false); 341 StoreScriptErrors(item.ItemID, null);
336 m_part.ParentGroup.Scene.EventManager.TriggerRezScript( 342 m_part.ParentGroup.AddActiveScriptCount(1);
337 m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); 343 m_part.ScheduleFullUpdate();
338 StoreScriptErrors(item.ItemID, null); 344 return true;
339 m_part.ParentGroup.AddActiveScriptCount(1); 345 }
340 m_part.ScheduleFullUpdate();
341 return;
342 }
343 346
344 AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); 347 AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
345 if (null == asset) 348 if (null == asset)
346 { 349 {
347 string msg = String.Format("asset ID {0} could not be found", item.AssetID); 350 m_log.ErrorFormat(
348 StoreScriptError(item.ItemID, msg); 351 "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
349 m_log.ErrorFormat( 352 item.Name, item.ItemID, m_part.AbsolutePosition,
353 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
354
355 return false;
356 }
357 else
358 {
359 if (m_part.ParentGroup.m_savedScriptState != null)
360 item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID);
361
362 string msg = String.Format("asset ID {0} could not be found", item.AssetID);
363 StoreScriptError(item.ItemID, msg);
364 m_log.ErrorFormat(
350 "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", 365 "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
351 item.Name, item.ItemID, m_part.AbsolutePosition, 366 item.Name, item.ItemID, m_part.AbsolutePosition,
352 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); 367 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
353 }
354 else
355 {
356 if (m_part.ParentGroup.m_savedScriptState != null)
357 item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID);
358 368
359 m_items.LockItemsForWrite(true); 369 m_items.LockItemsForWrite(true);
360 370
361 m_items[item.ItemID].OldItemID = item.OldItemID; 371 m_items[item.ItemID].OldItemID = item.OldItemID;
362 m_items[item.ItemID].PermsMask = 0; 372 m_items[item.ItemID].PermsMask = 0;
363 m_items[item.ItemID].PermsGranter = UUID.Zero; 373 m_items[item.ItemID].PermsGranter = UUID.Zero;
364 374
365 m_items.LockItemsForWrite(false); 375 m_items.LockItemsForWrite(false);
366 376
367 string script = Utils.BytesToString(asset.Data); 377 string script = Utils.BytesToString(asset.Data);
368 m_part.ParentGroup.Scene.EventManager.TriggerRezScript( 378 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
369 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); 379 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
370 StoreScriptErrors(item.ItemID, null); 380 StoreScriptErrors(item.ItemID, null);
371 if (!item.ScriptRunning) 381 if (!item.ScriptRunning)
372 m_part.ParentGroup.Scene.EventManager.TriggerStopScript( 382 m_part.ParentGroup.Scene.EventManager.TriggerStopScript(
373 m_part.LocalId, item.ItemID); 383 m_part.LocalId, item.ItemID);
374 m_part.ParentGroup.AddActiveScriptCount(1); 384 m_part.ParentGroup.AddActiveScriptCount(1);
375 m_part.ScheduleFullUpdate(); 385 m_part.ScheduleFullUpdate();
376 } 386
387 return true;
377 } 388 }
378 } 389 }
379 390
@@ -446,7 +457,7 @@ namespace OpenSim.Region.Framework.Scenes
446 /// <param name="itemId"> 457 /// <param name="itemId">
447 /// A <see cref="UUID"/> 458 /// A <see cref="UUID"/>
448 /// </param> 459 /// </param>
449 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 460 public bool CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
450 { 461 {
451 lock (m_scriptErrors) 462 lock (m_scriptErrors)
452 { 463 {
@@ -454,6 +465,7 @@ namespace OpenSim.Region.Framework.Scenes
454 m_scriptErrors.Remove(itemId); 465 m_scriptErrors.Remove(itemId);
455 } 466 }
456 CreateScriptInstanceInternal(itemId, startParam, postOnRez, engine, stateSource); 467 CreateScriptInstanceInternal(itemId, startParam, postOnRez, engine, stateSource);
468 return true;
457 } 469 }
458 470
459 private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 471 private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)