diff options
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
10 files changed, 269 insertions, 117 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index bbdf92a..b4f6b5a 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -335,54 +335,70 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
335 | { | 335 | { |
336 | UserData oldUser; | 336 | UserData oldUser; |
337 | //lock the whole block - prevent concurrent update | 337 | //lock the whole block - prevent concurrent update |
338 | lock (m_UserCache) { | 338 | lock (m_UserCache) |
339 | { | ||
339 | m_UserCache.TryGetValue (id, out oldUser); | 340 | m_UserCache.TryGetValue (id, out oldUser); |
340 | if (oldUser != null) { | 341 | if (oldUser != null) |
341 | if (creatorData == null || creatorData == String.Empty) { | 342 | { |
343 | if (creatorData == null || creatorData == String.Empty) | ||
344 | { | ||
342 | //ignore updates without creator data | 345 | //ignore updates without creator data |
343 | return; | 346 | return; |
344 | } | 347 | } |
345 | //try update unknown users | 348 | //try update unknown users |
346 | //and creator's home URL's | 349 | //and creator's home URL's |
347 | if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) { | 350 | if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) |
351 | { | ||
348 | m_UserCache.Remove (id); | 352 | m_UserCache.Remove (id); |
349 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL); | 353 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL); |
350 | } else { | 354 | } |
355 | else | ||
356 | { | ||
351 | //we have already a valid user within the cache | 357 | //we have already a valid user within the cache |
352 | return; | 358 | return; |
353 | } | 359 | } |
354 | } | 360 | } |
355 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); | 361 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); |
356 | 362 | ||
357 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes[0].RegionInfo.ScopeID, id); | 363 | UserAccount account = m_Scenes [0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id); |
358 | 364 | ||
359 | if (account != null) { | 365 | if (account != null) |
366 | { | ||
360 | AddUser (id, account.FirstName, account.LastName); | 367 | AddUser (id, account.FirstName, account.LastName); |
361 | } else { | 368 | } |
369 | else | ||
370 | { | ||
362 | UserData user = new UserData (); | 371 | UserData user = new UserData (); |
363 | user.Id = id; | 372 | user.Id = id; |
364 | 373 | ||
365 | if (creatorData != null && creatorData != string.Empty) { | 374 | if (creatorData != null && creatorData != string.Empty) |
375 | { | ||
366 | //creatorData = <endpoint>;<name> | 376 | //creatorData = <endpoint>;<name> |
367 | 377 | ||
368 | string[] parts = creatorData.Split (';'); | 378 | string[] parts = creatorData.Split (';'); |
369 | if (parts.Length >= 1) { | 379 | if (parts.Length >= 1) |
370 | user.HomeURL = parts[0]; | 380 | { |
371 | try { | 381 | user.HomeURL = parts [0]; |
372 | Uri uri = new Uri (parts[0]); | 382 | try |
383 | { | ||
384 | Uri uri = new Uri (parts [0]); | ||
373 | user.LastName = "@" + uri.Authority; | 385 | user.LastName = "@" + uri.Authority; |
374 | } catch (UriFormatException) { | 386 | } |
375 | m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts[0]); | 387 | catch (UriFormatException) |
388 | { | ||
389 | m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts [0]); | ||
376 | user.LastName = "@unknown"; | 390 | user.LastName = "@unknown"; |
377 | } | 391 | } |
378 | } | 392 | } |
379 | if (parts.Length >= 2) | 393 | if (parts.Length >= 2) |
380 | user.FirstName = parts[1].Replace (' ', '.'); | 394 | user.FirstName = parts [1].Replace (' ', '.'); |
381 | } else { | 395 | } |
396 | else | ||
397 | { | ||
382 | user.FirstName = "Unknown"; | 398 | user.FirstName = "Unknown"; |
383 | user.LastName = "User"; | 399 | user.LastName = "User"; |
384 | } | 400 | } |
385 | 401 | ||
386 | AddUserInternal (user); | 402 | AddUserInternal (user); |
387 | } | 403 | } |
388 | } | 404 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index f5683f0..f4cf6b4 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -132,6 +132,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
132 | 132 | ||
133 | public void RegionLoaded(Scene scene) | 133 | public void RegionLoaded(Scene scene) |
134 | { | 134 | { |
135 | IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>(); | ||
136 | foreach (IScriptModule scriptModule in scriptModules) | ||
137 | { | ||
138 | scriptModule.OnScriptRemoved += ScriptRemoved; | ||
139 | scriptModule.OnObjectRemoved += ObjectRemoved; | ||
140 | } | ||
135 | } | 141 | } |
136 | 142 | ||
137 | public void RemoveRegion(Scene scene) | 143 | public void RemoveRegion(Scene scene) |
@@ -289,6 +295,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
289 | 295 | ||
290 | public void ScriptRemoved(UUID itemID) | 296 | public void ScriptRemoved(UUID itemID) |
291 | { | 297 | { |
298 | // m_log.DebugFormat("[URL MODULE]: Removing script {0}", itemID); | ||
299 | |||
292 | lock (m_UrlMap) | 300 | lock (m_UrlMap) |
293 | { | 301 | { |
294 | List<string> removeURLs = new List<string>(); | 302 | List<string> removeURLs = new List<string>(); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 0707cbe..a945fc2 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -98,6 +98,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
98 | 98 | ||
99 | OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; }); | 99 | OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; }); |
100 | options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; }); | 100 | options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; }); |
101 | |||
102 | // Send a message to the region ready module | ||
103 | IRegionReadyModule rready = m_scene.RequestModuleInterface<IRegionReadyModule>(); | ||
104 | |||
105 | if (rready != null) | ||
106 | { | ||
107 | rready.OarLoadingAlert("load"); | ||
108 | } | ||
101 | 109 | ||
102 | List<string> mainParams = options.Parse(cmdparams); | 110 | List<string> mainParams = options.Parse(cmdparams); |
103 | 111 | ||
@@ -125,7 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
125 | Dictionary<string, object> options = new Dictionary<string, object>(); | 133 | Dictionary<string, object> options = new Dictionary<string, object>(); |
126 | 134 | ||
127 | OptionSet ops = new OptionSet(); | 135 | OptionSet ops = new OptionSet(); |
128 | 136 | ||
129 | // legacy argument [obsolete] | 137 | // legacy argument [obsolete] |
130 | ops.Add("p|profile=", delegate(string v) { Console.WriteLine("\n WARNING: -profile option is obsolete and it will not work. Use -home instead.\n"); }); | 138 | ops.Add("p|profile=", delegate(string v) { Console.WriteLine("\n WARNING: -profile option is obsolete and it will not work. Use -home instead.\n"); }); |
131 | // preferred | 139 | // preferred |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs new file mode 100644 index 0000000..aa4a757 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | |||
29 | using System; | ||
30 | |||
31 | namespace OpenSim.Region.Framework.Interfaces | ||
32 | { | ||
33 | public interface IRegionReadyModule | ||
34 | { | ||
35 | void OarLoadingAlert(string msg); | ||
36 | } | ||
37 | } | ||
38 | |||
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 9d68eb4..2d6758b 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -31,8 +31,21 @@ using OpenMetaverse; | |||
31 | 31 | ||
32 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Region.Framework.Interfaces |
33 | { | 33 | { |
34 | public delegate void ScriptRemoved(UUID script); | ||
35 | public delegate void ObjectRemoved(UUID prim); | ||
36 | |||
34 | public interface IScriptModule: INonSharedRegionModule | 37 | public interface IScriptModule: INonSharedRegionModule |
35 | { | 38 | { |
39 | /// <summary> | ||
40 | /// Triggered when a script is removed from the script module. | ||
41 | /// </summary> | ||
42 | event ScriptRemoved OnScriptRemoved; | ||
43 | |||
44 | /// <summary> | ||
45 | /// Triggered when an object is removed via the script module. | ||
46 | /// </summary> | ||
47 | event ObjectRemoved OnObjectRemoved; | ||
48 | |||
36 | string ScriptEngineName { get; } | 49 | string ScriptEngineName { get; } |
37 | 50 | ||
38 | string GetXMLState(UUID itemID); | 51 | string GetXMLState(UUID itemID); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 193ef0d..c9a8832 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -226,11 +226,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | 226 | ||
227 | public Quaternion SpinOldOrientation = Quaternion.Identity; | 227 | public Quaternion SpinOldOrientation = Quaternion.Identity; |
228 | 228 | ||
229 | public Quaternion m_APIDTarget = Quaternion.Identity; | 229 | protected int m_APIDIterations = 0; |
230 | 230 | protected Quaternion m_APIDTarget = Quaternion.Identity; | |
231 | public float m_APIDDamp = 0; | 231 | protected float m_APIDDamp = 0; |
232 | 232 | protected float m_APIDStrength = 0; | |
233 | public float m_APIDStrength = 0; | ||
234 | 233 | ||
235 | /// <summary> | 234 | /// <summary> |
236 | /// This part's inventory | 235 | /// This part's inventory |
@@ -578,22 +577,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
578 | } | 577 | } |
579 | } | 578 | } |
580 | 579 | ||
581 | 580 | protected Quaternion APIDTarget | |
582 | public Quaternion APIDTarget | ||
583 | { | 581 | { |
584 | get { return m_APIDTarget; } | 582 | get { return m_APIDTarget; } |
585 | set { m_APIDTarget = value; } | 583 | set { m_APIDTarget = value; } |
586 | } | 584 | } |
587 | 585 | ||
588 | 586 | ||
589 | public float APIDDamp | 587 | protected float APIDDamp |
590 | { | 588 | { |
591 | get { return m_APIDDamp; } | 589 | get { return m_APIDDamp; } |
592 | set { m_APIDDamp = value; } | 590 | set { m_APIDDamp = value; } |
593 | } | 591 | } |
594 | 592 | ||
595 | 593 | ||
596 | public float APIDStrength | 594 | protected float APIDStrength |
597 | { | 595 | { |
598 | get { return m_APIDStrength; } | 596 | get { return m_APIDStrength; } |
599 | set { m_APIDStrength = value; } | 597 | set { m_APIDStrength = value; } |
@@ -2768,17 +2766,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
2768 | APIDDamp = damping; | 2766 | APIDDamp = damping; |
2769 | APIDStrength = strength; | 2767 | APIDStrength = strength; |
2770 | APIDTarget = target; | 2768 | APIDTarget = target; |
2769 | |||
2770 | if (APIDStrength <= 0) | ||
2771 | { | ||
2772 | m_log.WarnFormat("[SceneObjectPart] Invalid rotation strength {0}",APIDStrength); | ||
2773 | return; | ||
2774 | } | ||
2775 | |||
2776 | m_APIDIterations = 1 + (int)(Math.PI * APIDStrength); | ||
2771 | } | 2777 | } |
2778 | |||
2779 | // Necessary to get the lookat deltas applied | ||
2780 | ParentGroup.QueueForUpdateCheck(); | ||
2772 | } | 2781 | } |
2773 | 2782 | ||
2774 | public void startLookAt(Quaternion rot, float damp, float strength) | 2783 | public void StartLookAt(Quaternion target, float strength, float damping) |
2775 | { | 2784 | { |
2776 | APIDDamp = damp; | 2785 | RotLookAt(target,strength,damping); |
2777 | APIDStrength = strength; | ||
2778 | APIDTarget = rot; | ||
2779 | } | 2786 | } |
2780 | 2787 | ||
2781 | public void stopLookAt() | 2788 | public void StopLookAt() |
2782 | { | 2789 | { |
2783 | APIDTarget = Quaternion.Identity; | 2790 | APIDTarget = Quaternion.Identity; |
2784 | } | 2791 | } |
@@ -3468,13 +3475,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3468 | } | 3475 | } |
3469 | } | 3476 | } |
3470 | 3477 | ||
3471 | public void StopLookAt() | ||
3472 | { | ||
3473 | ParentGroup.stopLookAt(); | ||
3474 | |||
3475 | ParentGroup.ScheduleGroupForTerseUpdate(); | ||
3476 | } | ||
3477 | |||
3478 | /// <summary> | 3478 | /// <summary> |
3479 | /// Set the text displayed for this part. | 3479 | /// Set the text displayed for this part. |
3480 | /// </summary> | 3480 | /// </summary> |
@@ -4790,24 +4790,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
4790 | { | 4790 | { |
4791 | if (APIDTarget != Quaternion.Identity) | 4791 | if (APIDTarget != Quaternion.Identity) |
4792 | { | 4792 | { |
4793 | if (Single.IsNaN(APIDTarget.W) == true) | 4793 | if (m_APIDIterations <= 1) |
4794 | { | 4794 | { |
4795 | UpdateRotation(APIDTarget); | ||
4795 | APIDTarget = Quaternion.Identity; | 4796 | APIDTarget = Quaternion.Identity; |
4796 | return; | 4797 | return; |
4797 | } | 4798 | } |
4798 | Quaternion rot = RotationOffset; | 4799 | |
4799 | Quaternion dir = (rot - APIDTarget); | 4800 | Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); |
4800 | float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f)); | ||
4801 | if (dir.Z > speed) | ||
4802 | { | ||
4803 | rot.Z -= speed; | ||
4804 | } | ||
4805 | if (dir.Z < -speed) | ||
4806 | { | ||
4807 | rot.Z += speed; | ||
4808 | } | ||
4809 | rot.Normalize(); | ||
4810 | UpdateRotation(rot); | 4801 | UpdateRotation(rot); |
4802 | |||
4803 | m_APIDIterations--; | ||
4804 | |||
4805 | // This ensures that we'll check this object on the next iteration | ||
4806 | ParentGroup.QueueForUpdateCheck(); | ||
4811 | } | 4807 | } |
4812 | } | 4808 | } |
4813 | catch (Exception ex) | 4809 | catch (Exception ex) |
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 4c4f5fb..f5d4da8 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | |||
@@ -44,12 +44,13 @@ using OpenSim.Region.Framework.Scenes; | |||
44 | 44 | ||
45 | namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | 45 | namespace OpenSim.Region.OptionalModules.Scripting.RegionReady |
46 | { | 46 | { |
47 | public class RegionReadyModule : INonSharedRegionModule | 47 | public class RegionReadyModule : IRegionReadyModule, INonSharedRegionModule |
48 | { | 48 | { |
49 | private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
50 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | private IConfig m_config = null; | 52 | private IConfig m_config = null; |
53 | private bool m_ScriptRez; | ||
53 | private bool m_firstEmptyCompileQueue; | 54 | private bool m_firstEmptyCompileQueue; |
54 | private bool m_oarFileLoading; | 55 | private bool m_oarFileLoading; |
55 | private bool m_lastOarLoadedOk; | 56 | private bool m_lastOarLoadedOk; |
@@ -93,14 +94,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
93 | if (!m_enabled) | 94 | if (!m_enabled) |
94 | return; | 95 | return; |
95 | 96 | ||
97 | m_scene = scene; | ||
98 | |||
99 | m_scene.RegisterModuleInterface<IRegionReadyModule>(this); | ||
100 | |||
101 | m_ScriptRez = false; | ||
96 | m_firstEmptyCompileQueue = true; | 102 | m_firstEmptyCompileQueue = true; |
97 | m_oarFileLoading = false; | 103 | m_oarFileLoading = false; |
98 | m_lastOarLoadedOk = true; | 104 | m_lastOarLoadedOk = true; |
99 | 105 | ||
100 | m_scene = scene; | ||
101 | |||
102 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; | ||
103 | m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; | 106 | m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; |
107 | m_scene.EventManager.OnRezScript += OnRezScript; | ||
104 | m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; | 108 | m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; |
105 | 109 | ||
106 | m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); | 110 | m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); |
@@ -118,6 +122,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
118 | } | 122 | } |
119 | } | 123 | } |
120 | 124 | ||
125 | void OnRezScript (uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) | ||
126 | { | ||
127 | if (!m_ScriptRez) | ||
128 | { | ||
129 | m_ScriptRez = true; | ||
130 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; | ||
131 | m_scene.EventManager.OnRezScript -= OnRezScript; | ||
132 | } | ||
133 | } | ||
134 | |||
121 | public void RemoveRegion(Scene scene) | 135 | public void RemoveRegion(Scene scene) |
122 | { | 136 | { |
123 | if (!m_enabled) | 137 | if (!m_enabled) |
@@ -125,6 +139,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
125 | 139 | ||
126 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; | 140 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; |
127 | m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; | 141 | m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; |
142 | m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled; | ||
128 | 143 | ||
129 | if(m_uri != string.Empty) | 144 | if(m_uri != string.Empty) |
130 | { | 145 | { |
@@ -148,9 +163,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
148 | } | 163 | } |
149 | 164 | ||
150 | #endregion | 165 | #endregion |
151 | 166 | ||
167 | |||
152 | void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) | 168 | void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) |
153 | { | 169 | { |
170 | m_log.InfoFormat("[RegionReady]: Script compile queue empty!"); | ||
171 | |||
154 | if (m_firstEmptyCompileQueue || m_oarFileLoading) | 172 | if (m_firstEmptyCompileQueue || m_oarFileLoading) |
155 | { | 173 | { |
156 | OSChatMessage c = new OSChatMessage(); | 174 | OSChatMessage c = new OSChatMessage(); |
@@ -197,6 +215,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
197 | } | 215 | } |
198 | } | 216 | } |
199 | 217 | ||
218 | // This will be triggerd by Scene if we have no scripts | ||
219 | // m_ScriptsRezzing will be false if there were none | ||
220 | // else it will be true and we should wait on the | ||
221 | // empty compile queue | ||
200 | void OnLoginsEnabled(string regionName) | 222 | void OnLoginsEnabled(string regionName) |
201 | { | 223 | { |
202 | if (m_disable_logins == true) | 224 | if (m_disable_logins == true) |
@@ -205,7 +227,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
205 | { | 227 | { |
206 | m_scene.LoginsDisabled = false; | 228 | m_scene.LoginsDisabled = false; |
207 | m_scene.LoginLock = false; | 229 | m_scene.LoginLock = false; |
208 | m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName); | 230 | |
231 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; | ||
232 | |||
233 | m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", | ||
234 | m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); | ||
235 | |||
209 | if ( m_uri != string.Empty ) | 236 | if ( m_uri != string.Empty ) |
210 | { | 237 | { |
211 | RRAlert("enabled"); | 238 | RRAlert("enabled"); |
@@ -214,6 +241,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
214 | } | 241 | } |
215 | } | 242 | } |
216 | 243 | ||
244 | public void OarLoadingAlert(string msg) | ||
245 | { | ||
246 | if (msg == "load") | ||
247 | { | ||
248 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; | ||
249 | m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; | ||
250 | m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; | ||
251 | m_scene.EventManager.OnRezScript += OnRezScript; | ||
252 | m_oarFileLoading = true; | ||
253 | m_firstEmptyCompileQueue = true; | ||
254 | // Will need some controls around this | ||
255 | m_scene.LoginsDisabled = true; | ||
256 | m_scene.LoginLock = true; | ||
257 | RRAlert("loading oar"); | ||
258 | RRAlert("disabled"); | ||
259 | } | ||
260 | } | ||
261 | |||
217 | public void RRAlert(string status) | 262 | public void RRAlert(string status) |
218 | { | 263 | { |
219 | string request_method = "POST"; | 264 | string request_method = "POST"; |
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 581a9a9..17c2708 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs | |||
@@ -42,10 +42,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
42 | /// An interface for a script API module to communicate with | 42 | /// An interface for a script API module to communicate with |
43 | /// the engine it's running under | 43 | /// the engine it's running under |
44 | /// </summary> | 44 | /// </summary> |
45 | |||
46 | public delegate void ScriptRemoved(UUID script); | ||
47 | public delegate void ObjectRemoved(UUID prim); | ||
48 | |||
49 | public interface IScriptEngine | 45 | public interface IScriptEngine |
50 | { | 46 | { |
51 | /// <summary> | 47 | /// <summary> |
@@ -57,9 +53,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
57 | 53 | ||
58 | IScriptModule ScriptModule { get; } | 54 | IScriptModule ScriptModule { get; } |
59 | 55 | ||
60 | event ScriptRemoved OnScriptRemoved; | ||
61 | event ObjectRemoved OnObjectRemoved; | ||
62 | |||
63 | /// <summary> | 56 | /// <summary> |
64 | /// Post an event to a single script | 57 | /// Post an event to a single script |
65 | /// </summary> | 58 | /// </summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 466e540..943f37d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -140,11 +140,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
140 | m_TransferModule = | 140 | m_TransferModule = |
141 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | 141 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); |
142 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | 142 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); |
143 | if (m_UrlModule != null) | ||
144 | { | ||
145 | m_ScriptEngine.OnScriptRemoved += m_UrlModule.ScriptRemoved; | ||
146 | m_ScriptEngine.OnObjectRemoved += m_UrlModule.ObjectRemoved; | ||
147 | } | ||
148 | 143 | ||
149 | AsyncCommands = new AsyncCommandManager(ScriptEngine); | 144 | AsyncCommands = new AsyncCommandManager(ScriptEngine); |
150 | } | 145 | } |
@@ -3063,6 +3058,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3063 | // we need to convert from a vector describing | 3058 | // we need to convert from a vector describing |
3064 | // the angles of rotation in radians into rotation value | 3059 | // the angles of rotation in radians into rotation value |
3065 | 3060 | ||
3061 | <<<<<<< HEAD:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
3066 | LSL_Types.Quaternion rot = llEuler2Rot(angle); | 3062 | LSL_Types.Quaternion rot = llEuler2Rot(angle); |
3067 | 3063 | ||
3068 | // This would only work if your physics system contains an APID controller: | 3064 | // This would only work if your physics system contains an APID controller: |
@@ -3095,10 +3091,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3095 | LSL_Vector ae = new LSL_Vector(0.0f, terot, 0.0f); | 3091 | LSL_Vector ae = new LSL_Vector(0.0f, terot, 0.0f); |
3096 | LSL_Types.Quaternion spin = llEuler2Rot(az); | 3092 | LSL_Types.Quaternion spin = llEuler2Rot(az); |
3097 | LSL_Types.Quaternion rot = llEuler2Rot(ae) * spin; | 3093 | LSL_Types.Quaternion rot = llEuler2Rot(ae) * spin; |
3094 | ======= | ||
3095 | LSL_Rotation rot = llEuler2Rot(angle); | ||
3096 | |||
3097 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply | ||
3098 | // set the rotation of the object, copy that behavior | ||
3099 | if (strength == 0 || m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) | ||
3100 | { | ||
3101 | >>>>>>> master:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
3098 | llSetRot(rot); | 3102 | llSetRot(rot); |
3099 | } | 3103 | } |
3100 | else | 3104 | else |
3101 | { | 3105 | { |
3106 | <<<<<<< HEAD:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
3102 | // Physical, send the target vector to RotLookAt method inside a 'rotation', the .w -99.9 value indicates it is really a LookAt. | 3107 | // Physical, send the target vector to RotLookAt method inside a 'rotation', the .w -99.9 value indicates it is really a LookAt. |
3103 | Quaternion q = new Quaternion((float)target.x, (float)target.y, (float)target.z, -99.9f); | 3108 | Quaternion q = new Quaternion((float)target.x, (float)target.y, (float)target.z, -99.9f); |
3104 | m_host.RotLookAt(q, (float)strength, (float)damping); | 3109 | m_host.RotLookAt(q, (float)strength, (float)damping); |
@@ -3112,6 +3117,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3112 | // NotImplemented("llRotLookAt"); | 3117 | // NotImplemented("llRotLookAt"); |
3113 | m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); | 3118 | m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); |
3114 | 3119 | ||
3120 | ======= | ||
3121 | m_host.StartLookAt(Rot2Quaternion(rot), (float)strength, (float)damping); | ||
3122 | } | ||
3123 | >>>>>>> master:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
3115 | } | 3124 | } |
3116 | 3125 | ||
3117 | public void llStopLookAt() | 3126 | public void llStopLookAt() |
@@ -3534,6 +3543,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3534 | m_host.AddScriptLPS(1); | 3543 | m_host.AddScriptLPS(1); |
3535 | } | 3544 | } |
3536 | 3545 | ||
3546 | <<<<<<< HEAD:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
3547 | ======= | ||
3548 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | ||
3549 | { | ||
3550 | m_host.AddScriptLPS(1); | ||
3551 | |||
3552 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply | ||
3553 | // set the rotation of the object, copy that behavior | ||
3554 | if (strength == 0 || m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) | ||
3555 | { | ||
3556 | llSetLocalRot(target); | ||
3557 | } | ||
3558 | else | ||
3559 | { | ||
3560 | m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); | ||
3561 | } | ||
3562 | } | ||
3563 | |||
3564 | >>>>>>> master:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | ||
3537 | public LSL_Integer llStringLength(string str) | 3565 | public LSL_Integer llStringLength(string str) |
3538 | { | 3566 | { |
3539 | m_host.AddScriptLPS(1); | 3567 | m_host.AddScriptLPS(1); |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 65c7416..23531a9 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -341,11 +341,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
341 | } | 341 | } |
342 | 342 | ||
343 | MainConsole.Instance.Commands.AddCommand( | 343 | MainConsole.Instance.Commands.AddCommand( |
344 | "scripts", false, "scripts show", "scripts show", "Show script information", | 344 | "scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", |
345 | "Show information on all scripts known to the script engine", HandleShowScripts); | 345 | "Show information on all scripts known to the script engine." |
346 | + "If a <script-item-uuid> is given then only information on that script will be shown.", | ||
347 | HandleShowScripts); | ||
346 | 348 | ||
347 | MainConsole.Instance.Commands.AddCommand( | 349 | MainConsole.Instance.Commands.AddCommand( |
348 | "scripts", false, "show scripts", "show scripts", "Show script information", | 350 | "scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information", |
349 | "Synonym for scripts show command", HandleShowScripts); | 351 | "Synonym for scripts show command", HandleShowScripts); |
350 | 352 | ||
351 | MainConsole.Instance.Commands.AddCommand( | 353 | MainConsole.Instance.Commands.AddCommand( |
@@ -376,43 +378,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
376 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); | 378 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); |
377 | } | 379 | } |
378 | 380 | ||
379 | public void HandleShowScripts(string module, string[] cmdparams) | ||
380 | { | ||
381 | lock (m_Scripts) | ||
382 | { | ||
383 | MainConsole.Instance.OutputFormat( | ||
384 | "Showing {0} scripts in {1}", m_Scripts.Count, m_Scene.RegionInfo.RegionName); | ||
385 | |||
386 | foreach (IScriptInstance instance in m_Scripts.Values) | ||
387 | { | ||
388 | SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); | ||
389 | string status; | ||
390 | |||
391 | if (instance.ShuttingDown) | ||
392 | { | ||
393 | status = "shutting down"; | ||
394 | } | ||
395 | else if (instance.Suspended) | ||
396 | { | ||
397 | status = "suspended"; | ||
398 | } | ||
399 | else if (!instance.Running) | ||
400 | { | ||
401 | status = "stopped"; | ||
402 | } | ||
403 | else | ||
404 | { | ||
405 | status = "running"; | ||
406 | } | ||
407 | |||
408 | MainConsole.Instance.OutputFormat( | ||
409 | "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})", | ||
410 | instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, | ||
411 | sop.AbsolutePosition, status); | ||
412 | } | ||
413 | } | ||
414 | } | ||
415 | |||
416 | /// <summary> | 381 | /// <summary> |
417 | /// Parse the raw item id into a script instance from the command params if it's present. | 382 | /// Parse the raw item id into a script instance from the command params if it's present. |
418 | /// </summary> | 383 | /// </summary> |
@@ -462,6 +427,48 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
462 | } | 427 | } |
463 | } | 428 | } |
464 | 429 | ||
430 | public void HandleShowScripts(string module, string[] cmdparams) | ||
431 | { | ||
432 | if (cmdparams.Length == 2) | ||
433 | { | ||
434 | lock (m_Scripts) | ||
435 | { | ||
436 | MainConsole.Instance.OutputFormat( | ||
437 | "Showing {0} scripts in {1}", m_Scripts.Count, m_Scene.RegionInfo.RegionName); | ||
438 | } | ||
439 | } | ||
440 | |||
441 | HandleScriptsAction(cmdparams, HandleShowScript); | ||
442 | } | ||
443 | |||
444 | private void HandleShowScript(IScriptInstance instance) | ||
445 | { | ||
446 | SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); | ||
447 | string status; | ||
448 | |||
449 | if (instance.ShuttingDown) | ||
450 | { | ||
451 | status = "shutting down"; | ||
452 | } | ||
453 | else if (instance.Suspended) | ||
454 | { | ||
455 | status = "suspended"; | ||
456 | } | ||
457 | else if (!instance.Running) | ||
458 | { | ||
459 | status = "stopped"; | ||
460 | } | ||
461 | else | ||
462 | { | ||
463 | status = "running"; | ||
464 | } | ||
465 | |||
466 | MainConsole.Instance.OutputFormat( | ||
467 | "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})", | ||
468 | instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, | ||
469 | sop.AbsolutePosition, status); | ||
470 | } | ||
471 | |||
465 | private void HandleSuspendScript(IScriptInstance instance) | 472 | private void HandleSuspendScript(IScriptInstance instance) |
466 | { | 473 | { |
467 | if (!instance.Suspended) | 474 | if (!instance.Suspended) |