aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs478
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs69
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs90
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs82
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs52
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs17
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs2
13 files changed, 524 insertions, 294 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index b5fa6de..fce8ff8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Threading;
29using System.Reflection; 30using System.Reflection;
30using System.Collections; 31using System.Collections;
31using System.Collections.Generic; 32using System.Collections.Generic;
@@ -62,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
62 internal TaskInventoryItem m_item; 63 internal TaskInventoryItem m_item;
63 internal bool m_CMFunctionsEnabled = false; 64 internal bool m_CMFunctionsEnabled = false;
64 65
65 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 66 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
66 { 67 {
67 m_ScriptEngine = ScriptEngine; 68 m_ScriptEngine = ScriptEngine;
68 m_host = host; 69 m_host = host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7be64eb..4a24d22 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -48,6 +48,7 @@ using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes; 48using OpenSim.Region.Framework.Scenes;
49using OpenSim.Region.Framework.Scenes.Serialization; 49using OpenSim.Region.Framework.Scenes.Serialization;
50using OpenSim.Region.Framework.Scenes.Animation; 50using OpenSim.Region.Framework.Scenes.Animation;
51using OpenSim.Region.Framework.Scenes.Scripting;
51using OpenSim.Region.Physics.Manager; 52using OpenSim.Region.Physics.Manager;
52using OpenSim.Region.ScriptEngine.Shared; 53using OpenSim.Region.ScriptEngine.Shared;
53using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; 54using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
@@ -87,10 +88,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
87 public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi 88 public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi
88 { 89 {
89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 90 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
91
90 protected IScriptEngine m_ScriptEngine; 92 protected IScriptEngine m_ScriptEngine;
91 protected SceneObjectPart m_host; 93 protected SceneObjectPart m_host;
92 94
93 /// <summary> 95 /// <summary>
96 /// Used for script sleeps when we are using co-operative script termination.
97 /// </summary>
98 /// <remarks>null if co-operative script termination is not active</remarks>
99 WaitHandle m_coopSleepHandle;
100
101 /// <summary>
94 /// The item that hosts this script 102 /// The item that hosts this script
95 /// </summary> 103 /// </summary>
96 protected TaskInventoryItem m_item; 104 protected TaskInventoryItem m_item;
@@ -100,6 +108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
100 protected float m_ScriptDelayFactor = 1.0f; 108 protected float m_ScriptDelayFactor = 1.0f;
101 protected float m_ScriptDistanceFactor = 1.0f; 109 protected float m_ScriptDistanceFactor = 1.0f;
102 protected float m_MinTimerInterval = 0.5f; 110 protected float m_MinTimerInterval = 0.5f;
111 protected float m_recoilScaleFactor = 0.0f;
103 112
104 protected DateTime m_timer = DateTime.Now; 113 protected DateTime m_timer = DateTime.Now;
105 protected bool m_waitingForScriptAnswer = false; 114 protected bool m_waitingForScriptAnswer = false;
@@ -141,33 +150,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
141 {"TURNRIGHT", "Turning Right"} 150 {"TURNRIGHT", "Turning Right"}
142 }; 151 };
143 152
144 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 153 public void Initialize(
154 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
145 { 155 {
146/*
147 m_ShoutSayTimer = new Timer(1000);
148 m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed;
149 m_ShoutSayTimer.AutoReset = true;
150 m_ShoutSayTimer.Start();
151*/
152 m_lastSayShoutCheck = DateTime.UtcNow; 156 m_lastSayShoutCheck = DateTime.UtcNow;
153 157
154 m_ScriptEngine = ScriptEngine; 158 m_ScriptEngine = scriptEngine;
155 m_host = host; 159 m_host = host;
156 m_item = item; 160 m_item = item;
157 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); 161 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
162 m_coopSleepHandle = coopSleepHandle;
158 163
159 LoadLimits(); // read script limits from config. 164 LoadConfig();
160 165
161 m_TransferModule = 166 m_TransferModule =
162 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); 167 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
163 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 168 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
164 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); 169 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();
165 170
166 AsyncCommands = new AsyncCommandManager(ScriptEngine); 171 AsyncCommands = new AsyncCommandManager(m_ScriptEngine);
167 } 172 }
168 173
169 /* load configuration items that affect script, object and run-time behavior. */ 174 /// <summary>
170 private void LoadLimits() 175 /// Load configuration items that affect script, object and run-time behavior. */
176 /// </summary>
177 private void LoadConfig()
171 { 178 {
172 m_ScriptDelayFactor = 179 m_ScriptDelayFactor =
173 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 180 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
@@ -181,12 +188,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
181 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); 188 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
182 if (m_notecardLineReadCharsMax > 65535) 189 if (m_notecardLineReadCharsMax > 65535)
183 m_notecardLineReadCharsMax = 65535; 190 m_notecardLineReadCharsMax = 65535;
191
184 // load limits for particular subsystems. 192 // load limits for particular subsystems.
185 IConfig SMTPConfig; 193 IConfig SMTPConfig;
186 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { 194 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) {
187 // there's an smtp config, so load in the snooze time. 195 // there's an smtp config, so load in the snooze time.
188 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); 196 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
189 } 197 }
198
199 // Rezzing an object with a velocity can create recoil. This feature seems to have been
200 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales
201 // it by this factor. May be zero to turn off recoil all together.
202 m_recoilScaleFactor = m_ScriptEngine.Config.GetFloat("RecoilScaleFactor", m_recoilScaleFactor);
190 } 203 }
191 204
192 public override Object InitializeLifetimeService() 205 public override Object InitializeLifetimeService()
@@ -207,7 +220,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
207 delay = (int)((float)delay * m_ScriptDelayFactor); 220 delay = (int)((float)delay * m_ScriptDelayFactor);
208 if (delay == 0) 221 if (delay == 0)
209 return; 222 return;
210 System.Threading.Thread.Sleep(delay); 223
224 Sleep(delay);
225 }
226
227 protected virtual void Sleep(int delay)
228 {
229 if (m_coopSleepHandle == null)
230 System.Threading.Thread.Sleep(delay);
231 else
232 CheckForCoopTermination(delay);
233 }
234
235 /// <summary>
236 /// Check for co-operative termination.
237 /// </summary>
238 /// <param name='delay'>If called with 0, then just the check is performed with no wait.</param>
239 protected virtual void CheckForCoopTermination(int delay)
240 {
241 if (m_coopSleepHandle.WaitOne(delay))
242 throw new ScriptCoopStopException();
211 } 243 }
212 244
213 public Scene World 245 public Scene World
@@ -392,79 +424,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
392 } 424 }
393 } 425 }
394 426
395 protected UUID InventoryKey(string name, int type)
396 {
397 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
398
399 if (item != null && item.Type == type)
400 return item.AssetID;
401 else
402 return UUID.Zero;
403 }
404
405 /// <summary>
406 /// accepts a valid UUID, -or- a name of an inventory item.
407 /// Returns a valid UUID or UUID.Zero if key invalid and item not found
408 /// in prim inventory.
409 /// </summary>
410 /// <param name="k"></param>
411 /// <returns></returns>
412 protected UUID KeyOrName(string k)
413 {
414 UUID key;
415
416 // if we can parse the string as a key, use it.
417 // else try to locate the name in inventory of object. found returns key,
418 // not found returns UUID.Zero
419 if (!UUID.TryParse(k, out key))
420 {
421 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
422
423 if (item != null)
424 key = item.AssetID;
425 else
426 key = UUID.Zero;
427 }
428
429 return key;
430 }
431
432 /// <summary>
433 /// Return the UUID of the asset matching the specified key or name
434 /// and asset type.
435 /// </summary>
436 /// <param name="k"></param>
437 /// <param name="type"></param>
438 /// <returns></returns>
439 protected UUID KeyOrName(string k, AssetType type)
440 {
441 UUID key;
442
443 if (!UUID.TryParse(k, out key))
444 {
445 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
446 if (item != null && item.Type == (int)type)
447 key = item.AssetID;
448 }
449 else
450 {
451 lock (m_host.TaskInventory)
452 {
453 foreach (KeyValuePair<UUID, TaskInventoryItem> item in m_host.TaskInventory)
454 {
455 if (item.Value.Type == (int)type && item.Value.Name == k)
456 {
457 key = item.Value.ItemID;
458 break;
459 }
460 }
461 }
462 }
463
464
465 return key;
466 }
467
468 //These are the implementations of the various ll-functions used by the LSL scripts. 427 //These are the implementations of the various ll-functions used by the LSL scripts.
469 public LSL_Float llSin(double f) 428 public LSL_Float llSin(double f)
470 { 429 {
@@ -1483,19 +1442,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1483 return 0; 1442 return 0;
1484 1443
1485 case ScriptBaseClass.STATUS_ROTATE_X: 1444 case ScriptBaseClass.STATUS_ROTATE_X:
1486 if (m_host.GetAxisRotation(2) == 2) 1445 // if (m_host.GetAxisRotation(2) != 0)
1446 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0)
1487 return 1; 1447 return 1;
1488 else 1448 else
1489 return 0; 1449 return 0;
1490 1450
1491 case ScriptBaseClass.STATUS_ROTATE_Y: 1451 case ScriptBaseClass.STATUS_ROTATE_Y:
1492 if (m_host.GetAxisRotation(4) == 4) 1452 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0)
1493 return 1; 1453 return 1;
1494 else 1454 else
1495 return 0; 1455 return 0;
1496 1456
1497 case ScriptBaseClass.STATUS_ROTATE_Z: 1457 case ScriptBaseClass.STATUS_ROTATE_Z:
1498 if (m_host.GetAxisRotation(8) == 8) 1458 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0)
1499 return 1; 1459 return 1;
1500 else 1460 else
1501 return 0; 1461 return 0;
@@ -1875,10 +1835,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1875 part.Shape.FlexiForceX = (float)Force.x; 1835 part.Shape.FlexiForceX = (float)Force.x;
1876 part.Shape.FlexiForceY = (float)Force.y; 1836 part.Shape.FlexiForceY = (float)Force.y;
1877 part.Shape.FlexiForceZ = (float)Force.z; 1837 part.Shape.FlexiForceZ = (float)Force.z;
1878 part.Shape.PathCurve = 0x80; 1838 part.Shape.PathCurve = (byte)Extrusion.Flexible;
1879 part.ParentGroup.HasGroupChanged = true; 1839 }
1880 part.ScheduleFullUpdate(); 1840 else
1841 {
1842 // Other values not set, they do not seem to be sent to the viewer
1843 // Setting PathCurve appears to be what actually toggles the check box and turns Flexi on and off
1844 part.Shape.PathCurve = (byte)Extrusion.Straight;
1845 part.Shape.FlexiEntry = false;
1881 } 1846 }
1847 part.ParentGroup.HasGroupChanged = true;
1848 part.ScheduleFullUpdate();
1882 } 1849 }
1883 1850
1884 /// <summary> 1851 /// <summary>
@@ -1996,7 +1963,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1996 1963
1997 UUID textureID = new UUID(); 1964 UUID textureID = new UUID();
1998 1965
1999 textureID = InventoryKey(texture, (int)AssetType.Texture); 1966 textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
2000 if (textureID == UUID.Zero) 1967 if (textureID == UUID.Zero)
2001 { 1968 {
2002 if (!UUID.TryParse(texture, out textureID)) 1969 if (!UUID.TryParse(texture, out textureID))
@@ -2712,7 +2679,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2712 if (m_SoundModule != null) 2679 if (m_SoundModule != null)
2713 { 2680 {
2714 m_SoundModule.SendSound(m_host.UUID, 2681 m_SoundModule.SendSound(m_host.UUID,
2715 KeyOrName(sound, AssetType.Sound), volume, false, 0, 2682 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, false, 0,
2716 0, false, false); 2683 0, false, false);
2717 } 2684 }
2718 } 2685 }
@@ -2722,7 +2689,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2722 m_host.AddScriptLPS(1); 2689 m_host.AddScriptLPS(1);
2723 if (m_SoundModule != null) 2690 if (m_SoundModule != null)
2724 { 2691 {
2725 m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), 2692 m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
2726 volume, 20, false); 2693 volume, 20, false);
2727 } 2694 }
2728 } 2695 }
@@ -2732,7 +2699,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2732 m_host.AddScriptLPS(1); 2699 m_host.AddScriptLPS(1);
2733 if (m_SoundModule != null) 2700 if (m_SoundModule != null)
2734 { 2701 {
2735 m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), 2702 m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
2736 volume, 20, true); 2703 volume, 20, true);
2737 } 2704 }
2738 } 2705 }
@@ -2754,7 +2721,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2754 if (m_SoundModule != null) 2721 if (m_SoundModule != null)
2755 { 2722 {
2756 m_SoundModule.SendSound(m_host.UUID, 2723 m_SoundModule.SendSound(m_host.UUID,
2757 KeyOrName(sound, AssetType.Sound), volume, false, 0, 2724 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, false, 0,
2758 0, true, false); 2725 0, true, false);
2759 } 2726 }
2760 } 2727 }
@@ -2766,7 +2733,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2766 if (m_SoundModule != null) 2733 if (m_SoundModule != null)
2767 { 2734 {
2768 m_SoundModule.SendSound(m_host.UUID, 2735 m_SoundModule.SendSound(m_host.UUID,
2769 KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, 2736 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, true, 0, 0,
2770 false, false); 2737 false, false);
2771 } 2738 }
2772 } 2739 }
@@ -2783,7 +2750,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2783 { 2750 {
2784 m_host.AddScriptLPS(1); 2751 m_host.AddScriptLPS(1);
2785 if (m_SoundModule != null) 2752 if (m_SoundModule != null)
2786 m_SoundModule.PreloadSound(m_host.UUID, KeyOrName(sound), 0); 2753 m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0);
2787 ScriptSleep(1000); 2754 ScriptSleep(1000);
2788 } 2755 }
2789 2756
@@ -3141,11 +3108,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3141 3108
3142 PhysicsActor pa = new_group.RootPart.PhysActor; 3109 PhysicsActor pa = new_group.RootPart.PhysActor;
3143 3110
3111 //Recoil.
3144 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) 3112 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
3145 { 3113 {
3146 float groupmass = new_group.GetMass(); 3114 float groupmass = new_group.GetMass();
3147 vel *= -groupmass; 3115 Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
3148 llApplyImpulse(vel, 0); 3116 if (recoil != Vector3.Zero)
3117 {
3118 llApplyImpulse(recoil, 0);
3119 }
3149 } 3120 }
3150 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 3121 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
3151 return; 3122 return;
@@ -3220,7 +3191,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3220 { 3191 {
3221// m_log.Info("llSleep snoozing " + sec + "s."); 3192// m_log.Info("llSleep snoozing " + sec + "s.");
3222 m_host.AddScriptLPS(1); 3193 m_host.AddScriptLPS(1);
3223 Thread.Sleep((int)(sec * 1000)); 3194
3195 Sleep((int)(sec * 1000));
3224 } 3196 }
3225 3197
3226 public LSL_Float llGetMass() 3198 public LSL_Float llGetMass()
@@ -3322,7 +3294,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3322 /// <summary> 3294 /// <summary>
3323 /// Attach the object containing this script to the avatar that owns it. 3295 /// Attach the object containing this script to the avatar that owns it.
3324 /// </summary> 3296 /// </summary>
3325 /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> 3297 /// <param name='attachmentPoint'>
3298 /// The attachment point (e.g. <see cref="OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.ATTACH_CHEST">ATTACH_CHEST</see>)
3299 /// </param>
3326 /// <returns>true if the attach suceeded, false if it did not</returns> 3300 /// <returns>true if the attach suceeded, false if it did not</returns>
3327 public bool AttachToAvatar(int attachmentPoint) 3301 public bool AttachToAvatar(int attachmentPoint)
3328 { 3302 {
@@ -3653,7 +3627,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3653 if (presence != null) 3627 if (presence != null)
3654 { 3628 {
3655 // Do NOT try to parse UUID, animations cannot be triggered by ID 3629 // Do NOT try to parse UUID, animations cannot be triggered by ID
3656 UUID animID = InventoryKey(anim, (int)AssetType.Animation); 3630 UUID animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation);
3657 if (animID == UUID.Zero) 3631 if (animID == UUID.Zero)
3658 presence.Animator.AddAnimation(anim, m_host.UUID); 3632 presence.Animator.AddAnimation(anim, m_host.UUID);
3659 else 3633 else
@@ -3675,12 +3649,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3675 3649
3676 if (presence != null) 3650 if (presence != null)
3677 { 3651 {
3678 UUID animID = KeyOrName(anim); 3652 UUID animID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, anim);
3679 3653
3680 if (animID == UUID.Zero) 3654 if (animID == UUID.Zero)
3681 presence.Animator.RemoveAnimation(anim); 3655 presence.Animator.RemoveAnimation(anim);
3682 else 3656 else
3683 presence.Animator.RemoveAnimation(animID); 3657 presence.Animator.RemoveAnimation(animID, true);
3684 } 3658 }
3685 } 3659 }
3686 } 3660 }
@@ -3753,21 +3727,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3753 } 3727 }
3754 else 3728 else
3755 { 3729 {
3756 bool sitting = false; 3730 if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID))
3757 if (m_host.SitTargetAvatar == agentID)
3758 {
3759 sitting = true;
3760 }
3761 else
3762 {
3763 foreach (SceneObjectPart p in m_host.ParentGroup.Parts)
3764 {
3765 if (p.SitTargetAvatar == agentID)
3766 sitting = true;
3767 }
3768 }
3769
3770 if (sitting)
3771 { 3731 {
3772 // When agent is sitting, certain permissions are implicit if requested from sitting agent 3732 // When agent is sitting, certain permissions are implicit if requested from sitting agent
3773 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 3733 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@@ -3809,7 +3769,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3809 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3769 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3810 if (npcModule != null && npcModule.IsNPC(agentID, World)) 3770 if (npcModule != null && npcModule.IsNPC(agentID, World))
3811 { 3771 {
3812 if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) 3772 if (npcModule.CheckPermissions(agentID, m_host.OwnerID))
3813 { 3773 {
3814 lock (m_host.TaskInventory) 3774 lock (m_host.TaskInventory)
3815 { 3775 {
@@ -4184,62 +4144,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4184 public LSL_String llGetLinkName(int linknum) 4144 public LSL_String llGetLinkName(int linknum)
4185 { 4145 {
4186 m_host.AddScriptLPS(1); 4146 m_host.AddScriptLPS(1);
4187 // simplest case, this prims link number
4188 if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS)
4189 return m_host.Name;
4190 4147
4191 // parse for sitting avatare-names 4148 if (linknum < 0)
4192 List<String> nametable = new List<String>();
4193 World.ForEachRootScenePresence(delegate(ScenePresence presence)
4194 { 4149 {
4195 SceneObjectPart sitPart = presence.ParentPart; 4150 if (linknum == ScriptBaseClass.LINK_THIS)
4196 if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId))
4197 nametable.Add(presence.ControllingClient.Name);
4198 });
4199
4200 int totalprims = m_host.ParentGroup.PrimCount + nametable.Count;
4201 if (totalprims > m_host.ParentGroup.PrimCount)
4202 {
4203 // sitting Avatar-Name with negativ linknum / SinglePrim
4204 if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4205 return nametable[0];
4206 // Prim-Name / SinglePrim Sitting Avatar
4207 if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4208 return m_host.Name; 4151 return m_host.Name;
4209 // LinkNumber > of Real PrimSet = AvatarName 4152 else
4210 if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) 4153 return ScriptBaseClass.NULL_KEY;
4211 return nametable[totalprims - linknum];
4212 } 4154 }
4213 4155
4214 // Single prim 4156 int actualPrimCount = m_host.ParentGroup.PrimCount;
4215 if (m_host.LinkNum == 0) 4157 List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
4158 int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
4159
4160 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
4161 // prim that has any avatars sat upon it (in which case the root prim is link 1).
4162 if (linknum == 0)
4216 { 4163 {
4217 if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT) 4164 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
4218 return m_host.Name; 4165 return m_host.Name;
4219 else
4220 return UUID.Zero.ToString();
4221 }
4222 4166
4223 // Link set 4167 return ScriptBaseClass.NULL_KEY;
4224 SceneObjectPart part = null; 4168 }
4225 if (m_host.LinkNum == 1) // this is the Root prim 4169 // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
4170 // here we must match 1 (ScriptBaseClass.LINK_ROOT).
4171 else if (linknum == 1 && actualPrimCount == 1)
4226 { 4172 {
4227 if (linknum < 0) 4173 if (sittingAvatarIds.Count > 0)
4228 part = m_host.ParentGroup.GetLinkNumPart(2); 4174 return m_host.ParentGroup.RootPart.Name;
4229 else 4175 else
4230 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4176 return ScriptBaseClass.NULL_KEY;
4231 } 4177 }
4232 else // this is a child prim 4178 else if (linknum <= adjustedPrimCount)
4233 { 4179 {
4234 if (linknum < 2) 4180 if (linknum <= actualPrimCount)
4235 part = m_host.ParentGroup.GetLinkNumPart(1); 4181 {
4182 return m_host.ParentGroup.GetLinkNumPart(linknum).Name;
4183 }
4236 else 4184 else
4237 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4185 {
4186 ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]);
4187 if (sp != null)
4188 return sp.Name;
4189 else
4190 return ScriptBaseClass.NULL_KEY;
4191 }
4238 } 4192 }
4239 if (part != null)
4240 return part.Name;
4241 else 4193 else
4242 return UUID.Zero.ToString(); 4194 {
4195 return ScriptBaseClass.NULL_KEY;
4196 }
4243 } 4197 }
4244 4198
4245 public LSL_Integer llGetInventoryNumber(int type) 4199 public LSL_Integer llGetInventoryNumber(int type)
@@ -4691,7 +4645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4691 4645
4692 private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt) 4646 private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt)
4693 { 4647 {
4694 UUID assetID = KeyOrName(destination); 4648 UUID assetID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, destination);
4695 4649
4696 // The destinaion is not an asset ID and also doesn't name a landmark. 4650 // The destinaion is not an asset ID and also doesn't name a landmark.
4697 // Use it as a sim name 4651 // Use it as a sim name
@@ -4764,7 +4718,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4764 return; 4718 return;
4765 } 4719 }
4766 // TODO: Parameter check logic required. 4720 // TODO: Parameter check logic required.
4767 m_host.CollisionSound = KeyOrName(impact_sound, AssetType.Sound); 4721 m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
4768 m_host.CollisionSoundVolume = (float)impact_volume; 4722 m_host.CollisionSoundVolume = (float)impact_volume;
4769 m_host.CollisionSoundType = 1; 4723 m_host.CollisionSoundType = 1;
4770 } 4724 }
@@ -4934,6 +4888,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4934 } 4888 }
4935 } 4889 }
4936 } 4890 }
4891
4937 if (pushAllowed) 4892 if (pushAllowed)
4938 { 4893 {
4939 float distance = (PusheePos - m_host.AbsolutePosition).Length(); 4894 float distance = (PusheePos - m_host.AbsolutePosition).Length();
@@ -4963,17 +4918,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4963 applied_linear_impulse *= scaling_factor; 4918 applied_linear_impulse *= scaling_factor;
4964 4919
4965 } 4920 }
4921
4966 if (pusheeIsAvatar) 4922 if (pusheeIsAvatar)
4967 { 4923 {
4968 if (pusheeav != null) 4924 if (pusheeav != null)
4969 { 4925 {
4970 if (pusheeav.PhysicsActor != null) 4926 PhysicsActor pa = pusheeav.PhysicsActor;
4927
4928 if (pa != null)
4971 { 4929 {
4972 if (local != 0) 4930 if (local != 0)
4973 { 4931 {
4974 applied_linear_impulse *= m_host.GetWorldRotation(); 4932 applied_linear_impulse *= m_host.GetWorldRotation();
4975 } 4933 }
4976 pusheeav.PhysicsActor.AddForce(applied_linear_impulse, true); 4934
4935 pa.AddForce(applied_linear_impulse, true);
4977 } 4936 }
4978 } 4937 }
4979 } 4938 }
@@ -5851,9 +5810,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5851 } 5810 }
5852 5811
5853 /// <summary> 5812 /// <summary>
5854 /// Insert the list identified by <src> into the 5813 /// Insert the list identified by <paramref name="src"/> into the
5855 /// list designated by <dest> such that the first 5814 /// list designated by <paramref name="dest"/> such that the first
5856 /// new element has the index specified by <index> 5815 /// new element has the index specified by <paramref name="index"/>
5857 /// </summary> 5816 /// </summary>
5858 5817
5859 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index) 5818 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
@@ -6219,13 +6178,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6219 if (parcelOwned && land.LandData.OwnerID == id || 6178 if (parcelOwned && land.LandData.OwnerID == id ||
6220 parcel && land.LandData.GlobalID == id) 6179 parcel && land.LandData.GlobalID == id)
6221 { 6180 {
6222 result.Add(ssp.UUID.ToString()); 6181 result.Add(new LSL_Key(ssp.UUID.ToString()));
6223 } 6182 }
6224 } 6183 }
6225 } 6184 }
6226 else 6185 else
6227 { 6186 {
6228 result.Add(ssp.UUID.ToString()); 6187 result.Add(new LSL_Key(ssp.UUID.ToString()));
6229 } 6188 }
6230 } 6189 }
6231 // Maximum of 100 results 6190 // Maximum of 100 results
@@ -6329,7 +6288,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6329 if (m_SoundModule != null) 6288 if (m_SoundModule != null)
6330 { 6289 {
6331 m_SoundModule.TriggerSoundLimited(m_host.UUID, 6290 m_SoundModule.TriggerSoundLimited(m_host.UUID,
6332 KeyOrName(sound, AssetType.Sound), volume, 6291 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume,
6333 bottom_south_west, top_north_east); 6292 bottom_south_west, top_north_east);
6334 } 6293 }
6335 } 6294 }
@@ -6686,6 +6645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6686 ps.BurstSpeedMax = 1.0f; 6645 ps.BurstSpeedMax = 1.0f;
6687 ps.BurstRate = 0.1f; 6646 ps.BurstRate = 0.1f;
6688 ps.PartMaxAge = 10.0f; 6647 ps.PartMaxAge = 10.0f;
6648 ps.BurstPartCount = 1;
6689 return ps; 6649 return ps;
6690 } 6650 }
6691 6651
@@ -6707,10 +6667,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6707 SetParticleSystem(m_host, rules); 6667 SetParticleSystem(m_host, rules);
6708 } 6668 }
6709 6669
6710 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) 6670 private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
6711 { 6671 {
6712
6713
6714 if (rules.Length == 0) 6672 if (rules.Length == 0)
6715 { 6673 {
6716 part.RemoveParticleSystem(); 6674 part.RemoveParticleSystem();
@@ -6801,7 +6759,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6801 break; 6759 break;
6802 6760
6803 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: 6761 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
6804 prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1)); 6762 prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1));
6805 break; 6763 break;
6806 6764
6807 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE: 6765 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
@@ -7373,6 +7331,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7373 public void llCloseRemoteDataChannel(string channel) 7331 public void llCloseRemoteDataChannel(string channel)
7374 { 7332 {
7375 m_host.AddScriptLPS(1); 7333 m_host.AddScriptLPS(1);
7334
7335 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
7336 if (xmlRpcRouter != null)
7337 {
7338 xmlRpcRouter.UnRegisterReceiver(channel, m_item.ItemID);
7339 }
7340
7376 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 7341 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7377 if (xmlrpcMod != null) 7342 if (xmlrpcMod != null)
7378 xmlrpcMod.CloseXMLRPCChannel((UUID)channel); 7343 xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
@@ -7746,9 +7711,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7746 UUID sculptId; 7711 UUID sculptId;
7747 7712
7748 if (!UUID.TryParse(map, out sculptId)) 7713 if (!UUID.TryParse(map, out sculptId))
7749 { 7714 sculptId = ScriptUtils.GetAssetIdFromItemName(m_host, map, (int)AssetType.Texture);
7750 sculptId = InventoryKey(map, (int)AssetType.Texture);
7751 }
7752 7715
7753 if (sculptId == UUID.Zero) 7716 if (sculptId == UUID.Zero)
7754 return; 7717 return;
@@ -10238,6 +10201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10238 return UUID.Zero.ToString(); 10201 return UUID.Zero.ToString();
10239 } 10202 }
10240 } 10203 }
10204
10241 public LSL_String llRequestURL() 10205 public LSL_String llRequestURL()
10242 { 10206 {
10243 m_host.AddScriptLPS(1); 10207 m_host.AddScriptLPS(1);
@@ -11519,6 +11483,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11519 case ScriptBaseClass.OBJECT_PHYSICS_COST: 11483 case ScriptBaseClass.OBJECT_PHYSICS_COST:
11520 ret.Add(new LSL_Float(0)); 11484 ret.Add(new LSL_Float(0));
11521 break; 11485 break;
11486 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
11487 ret.Add(new LSL_Float(0));
11488 break;
11489 case ScriptBaseClass.OBJECT_ROOT:
11490 SceneObjectPart p = av.ParentPart;
11491 if (p != null)
11492 {
11493 ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString()));
11494 }
11495 else
11496 {
11497 ret.Add(new LSL_String(id));
11498 }
11499 break;
11500 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
11501 ret.Add(new LSL_Integer(0));
11502 break;
11503 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding
11504 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR));
11505 break;
11506 case ScriptBaseClass.OBJECT_PHYSICS:
11507 ret.Add(new LSL_Integer(0));
11508 break;
11509 case ScriptBaseClass.OBJECT_PHANTOM:
11510 ret.Add(new LSL_Integer(0));
11511 break;
11512 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11513 ret.Add(new LSL_Integer(0));
11514 break;
11522 default: 11515 default:
11523 // Invalid or unhandled constant. 11516 // Invalid or unhandled constant.
11524 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 11517 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -11610,6 +11603,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11610 // The value returned in SL for normal prims is prim count 11603 // The value returned in SL for normal prims is prim count
11611 ret.Add(new LSL_Float(obj.PhysicsCost)); 11604 ret.Add(new LSL_Float(obj.PhysicsCost));
11612 break; 11605 break;
11606 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
11607 ret.Add(new LSL_Float(0));
11608 break;
11609 case ScriptBaseClass.OBJECT_ROOT:
11610 ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString()));
11611 break;
11612 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
11613 ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint));
11614 break;
11615 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
11616 byte pcode = obj.Shape.PCode;
11617 if (obj.ParentGroup.AttachmentPoint != 0
11618 || pcode == (byte)PCode.Grass
11619 || pcode == (byte)PCode.Tree
11620 || pcode == (byte)PCode.NewTree)
11621 {
11622 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER));
11623 }
11624 else
11625 {
11626 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET));
11627 }
11628 break;
11629 case ScriptBaseClass.OBJECT_PHYSICS:
11630 if (obj.ParentGroup.AttachmentPoint != 0)
11631 {
11632 ret.Add(new LSL_Integer(0)); // Always false if attached
11633 }
11634 else
11635 {
11636 ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
11637 }
11638 break;
11639 case ScriptBaseClass.OBJECT_PHANTOM:
11640 if (obj.ParentGroup.AttachmentPoint != 0)
11641 {
11642 ret.Add(new LSL_Integer(0)); // Always false if attached
11643 }
11644 else
11645 {
11646 ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
11647 }
11648 break;
11649 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11650 ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
11651 break;
11613 default: 11652 default:
11614 // Invalid or unhandled constant. 11653 // Invalid or unhandled constant.
11615 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 11654 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -11689,14 +11728,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11689 return UUID.Zero.ToString(); 11728 return UUID.Zero.ToString();
11690 } 11729 }
11691 11730
11731 string reqIdentifier = UUID.Random().ToString();
11732
11692 // was: UUID tid = tid = AsyncCommands. 11733 // was: UUID tid = tid = AsyncCommands.
11693 UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); 11734 UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier);
11694 11735
11695 if (NotecardCache.IsCached(assetID)) 11736 if (NotecardCache.IsCached(assetID))
11696 { 11737 {
11697 AsyncCommands. 11738 AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString());
11698 DataserverPlugin.DataserverReply(assetID.ToString(), 11739
11699 NotecardCache.GetLines(assetID).ToString());
11700 ScriptSleep(100); 11740 ScriptSleep(100);
11701 return tid.ToString(); 11741 return tid.ToString();
11702 } 11742 }
@@ -11712,9 +11752,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11712 string data = Encoding.UTF8.GetString(a.Data); 11752 string data = Encoding.UTF8.GetString(a.Data);
11713 //m_log.Debug(data); 11753 //m_log.Debug(data);
11714 NotecardCache.Cache(id, data); 11754 NotecardCache.Cache(id, data);
11715 AsyncCommands. 11755 AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString());
11716 DataserverPlugin.DataserverReply(id.ToString(),
11717 NotecardCache.GetLines(id).ToString());
11718 }); 11756 });
11719 11757
11720 ScriptSleep(100); 11758 ScriptSleep(100);
@@ -11743,13 +11781,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11743 return UUID.Zero.ToString(); 11781 return UUID.Zero.ToString();
11744 } 11782 }
11745 11783
11784 string reqIdentifier = UUID.Random().ToString();
11785
11746 // was: UUID tid = tid = AsyncCommands. 11786 // was: UUID tid = tid = AsyncCommands.
11747 UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); 11787 UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier);
11748 11788
11749 if (NotecardCache.IsCached(assetID)) 11789 if (NotecardCache.IsCached(assetID))
11750 { 11790 {
11751 AsyncCommands.DataserverPlugin.DataserverReply(assetID.ToString(), 11791 AsyncCommands.DataserverPlugin.DataserverReply(
11752 NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); 11792 reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
11793
11753 ScriptSleep(100); 11794 ScriptSleep(100);
11754 return tid.ToString(); 11795 return tid.ToString();
11755 } 11796 }
@@ -11765,8 +11806,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11765 string data = Encoding.UTF8.GetString(a.Data); 11806 string data = Encoding.UTF8.GetString(a.Data);
11766 //m_log.Debug(data); 11807 //m_log.Debug(data);
11767 NotecardCache.Cache(id, data); 11808 NotecardCache.Cache(id, data);
11768 AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), 11809 AsyncCommands.DataserverPlugin.DataserverReply(
11769 NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); 11810 reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
11770 }); 11811 });
11771 11812
11772 ScriptSleep(100); 11813 ScriptSleep(100);
@@ -11993,12 +12034,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11993 radius = Math.Abs(maxY); 12034 radius = Math.Abs(maxY);
11994 if (Math.Abs(maxZ) > radius) 12035 if (Math.Abs(maxZ) > radius)
11995 radius = Math.Abs(maxZ); 12036 radius = Math.Abs(maxZ);
11996 12037 radius = radius*1.413f;
11997 Vector3 ac = group.AbsolutePosition - rayStart; 12038 Vector3 ac = group.AbsolutePosition - rayStart;
11998 Vector3 bc = group.AbsolutePosition - rayEnd; 12039 Vector3 bc = group.AbsolutePosition - rayEnd;
11999 12040
12000 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); 12041 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
12001 12042
12002 // Too far off ray, don't bother 12043 // Too far off ray, don't bother
12003 if (d > radius) 12044 if (d > radius)
12004 return; 12045 return;
@@ -12008,11 +12049,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12008 if (d2 > 0) 12049 if (d2 > 0)
12009 return; 12050 return;
12010 12051
12052 ray = new Ray(rayStart, Vector3.Normalize(rayEnd - rayStart));
12011 EntityIntersection intersection = group.TestIntersection(ray, true, false); 12053 EntityIntersection intersection = group.TestIntersection(ray, true, false);
12012 // Miss. 12054 // Miss.
12013 if (!intersection.HitTF) 12055 if (!intersection.HitTF)
12014 return; 12056 return;
12015 12057
12058 Vector3 b1 = group.AbsolutePosition + new Vector3(minX, minY, minZ);
12059 Vector3 b2 = group.AbsolutePosition + new Vector3(maxX, maxY, maxZ);
12060 //m_log.DebugFormat("[LLCASTRAY]: min<{0},{1},{2}>, max<{3},{4},{5}> = hitp<{6},{7},{8}>", b1.X,b1.Y,b1.Z,b2.X,b2.Y,b2.Z,intersection.ipoint.X,intersection.ipoint.Y,intersection.ipoint.Z);
12061 if (!(intersection.ipoint.X >= b1.X && intersection.ipoint.X <= b2.X &&
12062 intersection.ipoint.Y >= b1.Y && intersection.ipoint.Y <= b2.Y &&
12063 intersection.ipoint.Z >= b1.Z && intersection.ipoint.Z <= b2.Z))
12064 return;
12065
12016 ContactResult result = new ContactResult (); 12066 ContactResult result = new ContactResult ();
12017 result.ConsumerID = group.LocalId; 12067 result.ConsumerID = group.LocalId;
12018// result.Depth = intersection.distance; 12068// result.Depth = intersection.distance;
@@ -12228,7 +12278,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12228 if (checkNonPhysical) 12278 if (checkNonPhysical)
12229 rayfilter |= RayFilterFlags.nonphysical; 12279 rayfilter |= RayFilterFlags.nonphysical;
12230 if (detectPhantom) 12280 if (detectPhantom)
12231 rayfilter |= RayFilterFlags.LSLPhanton; 12281 rayfilter |= RayFilterFlags.LSLPhantom;
12232 12282
12233 Vector3 direction = dir * ( 1/dist); 12283 Vector3 direction = dir * ( 1/dist);
12234 12284
@@ -12286,8 +12336,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12286 if (checkPhysical || checkNonPhysical || detectPhantom) 12336 if (checkPhysical || checkNonPhysical || detectPhantom)
12287 { 12337 {
12288 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom); 12338 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom);
12289 foreach (ContactResult r in objectHits) 12339 for (int iter = 0; iter < objectHits.Length; iter++)
12290 results.Add(r); 12340 {
12341 // Redistance the Depth because the Scene RayCaster returns distance from center to make the rezzing code simpler.
12342 objectHits[iter].Depth = Vector3.Distance(objectHits[iter].Pos, rayStart);
12343 results.Add(objectHits[iter]);
12344 }
12291 } 12345 }
12292 } 12346 }
12293 12347
@@ -13235,7 +13289,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13235 13289
13236 public static void Cache(UUID assetID, string text) 13290 public static void Cache(UUID assetID, string text)
13237 { 13291 {
13238 CacheCheck(); 13292 CheckCache();
13239 13293
13240 lock (m_Notecards) 13294 lock (m_Notecards)
13241 { 13295 {
@@ -13273,7 +13327,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13273 /// Get a notecard line. 13327 /// Get a notecard line.
13274 /// </summary> 13328 /// </summary>
13275 /// <param name="assetID"></param> 13329 /// <param name="assetID"></param>
13276 /// <param name="line">Lines start at index 0</param> 13330 /// <param name="lineNumber">Lines start at index 0</param>
13277 /// <returns></returns> 13331 /// <returns></returns>
13278 public static string GetLine(UUID assetID, int lineNumber) 13332 public static string GetLine(UUID assetID, int lineNumber)
13279 { 13333 {
@@ -13302,9 +13356,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13302 /// Get a notecard line. 13356 /// Get a notecard line.
13303 /// </summary> 13357 /// </summary>
13304 /// <param name="assetID"></param> 13358 /// <param name="assetID"></param>
13305 /// <param name="line">Lines start at index 0</param> 13359 /// <param name="lineNumber">Lines start at index 0</param>
13306 /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> 13360 /// <param name="maxLength">
13307 /// <returns></returns> 13361 /// Maximum length of the returned line.
13362 /// </param>
13363 /// <returns>
13364 /// If the line length is longer than <paramref name="maxLength"/>,
13365 /// the return string will be truncated.
13366 /// </returns>
13308 public static string GetLine(UUID assetID, int lineNumber, int maxLength) 13367 public static string GetLine(UUID assetID, int lineNumber, int maxLength)
13309 { 13368 {
13310 string line = GetLine(assetID, lineNumber); 13369 string line = GetLine(assetID, lineNumber);
@@ -13315,14 +13374,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13315 return line; 13374 return line;
13316 } 13375 }
13317 13376
13318 public static void CacheCheck() 13377 public static void CheckCache()
13319 { 13378 {
13320 foreach (UUID key in new List<UUID>(m_Notecards.Keys)) 13379 lock (m_Notecards)
13321 { 13380 {
13322 Notecard nc = m_Notecards[key]; 13381 foreach (UUID key in new List<UUID>(m_Notecards.Keys))
13323 if (nc.lastRef.AddSeconds(30) < DateTime.Now) 13382 {
13324 m_Notecards.Remove(key); 13383 Notecard nc = m_Notecards[key];
13384 if (nc.lastRef.AddSeconds(30) < DateTime.Now)
13385 m_Notecards.Remove(key);
13386 }
13325 } 13387 }
13326 } 13388 }
13327 } 13389 }
13328} 13390} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index ceb4660..1d6cb6d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -30,6 +30,7 @@ using System.Reflection;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
33using System.Threading;
33using OpenMetaverse; 34using OpenMetaverse;
34using Nini.Config; 35using Nini.Config;
35using OpenSim; 36using OpenSim;
@@ -61,9 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
61 internal bool m_LSFunctionsEnabled = false; 62 internal bool m_LSFunctionsEnabled = false;
62 internal IScriptModuleComms m_comms = null; 63 internal IScriptModuleComms m_comms = null;
63 64
64 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 65 public void Initialize(
66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
65 { 67 {
66 m_ScriptEngine = ScriptEngine; 68 m_ScriptEngine = scriptEngine;
67 m_host = host; 69 m_host = host;
68 70
69 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) 71 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
@@ -92,10 +94,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
92 get { return m_ScriptEngine.World; } 94 get { return m_ScriptEngine.World; }
93 } 95 }
94 96
95 // 97 /// <summary>
96 //Dumps an error message on the debug console. 98 /// Dumps an error message on the debug console.
97 // 99 /// </summary>
98
99 internal void LSShoutError(string message) 100 internal void LSShoutError(string message)
100 { 101 {
101 if (message.Length > 1023) 102 if (message.Length > 1023)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index ee89f9d..542222e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -30,6 +30,8 @@ using System.Reflection;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
33using System.Threading;
34using log4net;
33using OpenMetaverse; 35using OpenMetaverse;
34using Nini.Config; 36using Nini.Config;
35using OpenSim; 37using OpenSim;
@@ -55,15 +57,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
55 [Serializable] 57 [Serializable]
56 public class MOD_Api : MarshalByRefObject, IMOD_Api, IScriptApi 58 public class MOD_Api : MarshalByRefObject, IMOD_Api, IScriptApi
57 { 59 {
60// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61
58 internal IScriptEngine m_ScriptEngine; 62 internal IScriptEngine m_ScriptEngine;
59 internal SceneObjectPart m_host; 63 internal SceneObjectPart m_host;
60 internal TaskInventoryItem m_item; 64 internal TaskInventoryItem m_item;
61 internal bool m_MODFunctionsEnabled = false; 65 internal bool m_MODFunctionsEnabled = false;
62 internal IScriptModuleComms m_comms = null; 66 internal IScriptModuleComms m_comms = null;
63 67
64 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 68 public void Initialize(
69 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
65 { 70 {
66 m_ScriptEngine = ScriptEngine; 71 m_ScriptEngine = scriptEngine;
67 m_host = host; 72 m_host = host;
68 m_item = item; 73 m_item = item;
69 74
@@ -107,8 +112,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
107 if (message.Length > 1023) 112 if (message.Length > 1023)
108 message = message.Substring(0, 1023); 113 message = message.Substring(0, 1023);
109 114
110 World.SimChat(Utils.StringToBytes(message), 115 World.SimChat(
111 ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); 116 Utils.StringToBytes(message),
117 ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL,
118 m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
112 119
113 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 120 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
114 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); 121 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
@@ -122,6 +129,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
122 /// <returns>string result of the invocation</returns> 129 /// <returns>string result of the invocation</returns>
123 public void modInvokeN(string fname, params object[] parms) 130 public void modInvokeN(string fname, params object[] parms)
124 { 131 {
132// m_log.DebugFormat(
133// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
134// fname,
135// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
136// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
137
125 Type returntype = m_comms.LookupReturnType(fname); 138 Type returntype = m_comms.LookupReturnType(fname);
126 if (returntype != typeof(void)) 139 if (returntype != typeof(void))
127 MODError(String.Format("return type mismatch for {0}",fname)); 140 MODError(String.Format("return type mismatch for {0}",fname));
@@ -131,6 +144,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
131 144
132 public LSL_String modInvokeS(string fname, params object[] parms) 145 public LSL_String modInvokeS(string fname, params object[] parms)
133 { 146 {
147// m_log.DebugFormat(
148// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
149// fname,
150// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
151// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
152
134 Type returntype = m_comms.LookupReturnType(fname); 153 Type returntype = m_comms.LookupReturnType(fname);
135 if (returntype != typeof(string)) 154 if (returntype != typeof(string))
136 MODError(String.Format("return type mismatch for {0}",fname)); 155 MODError(String.Format("return type mismatch for {0}",fname));
@@ -141,6 +160,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
141 160
142 public LSL_Integer modInvokeI(string fname, params object[] parms) 161 public LSL_Integer modInvokeI(string fname, params object[] parms)
143 { 162 {
163// m_log.DebugFormat(
164// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
165// fname,
166// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
167// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
168
144 Type returntype = m_comms.LookupReturnType(fname); 169 Type returntype = m_comms.LookupReturnType(fname);
145 if (returntype != typeof(int)) 170 if (returntype != typeof(int))
146 MODError(String.Format("return type mismatch for {0}",fname)); 171 MODError(String.Format("return type mismatch for {0}",fname));
@@ -151,6 +176,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
151 176
152 public LSL_Float modInvokeF(string fname, params object[] parms) 177 public LSL_Float modInvokeF(string fname, params object[] parms)
153 { 178 {
179// m_log.DebugFormat(
180// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
181// fname,
182// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
183// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
184
154 Type returntype = m_comms.LookupReturnType(fname); 185 Type returntype = m_comms.LookupReturnType(fname);
155 if (returntype != typeof(float)) 186 if (returntype != typeof(float))
156 MODError(String.Format("return type mismatch for {0}",fname)); 187 MODError(String.Format("return type mismatch for {0}",fname));
@@ -161,6 +192,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
161 192
162 public LSL_Key modInvokeK(string fname, params object[] parms) 193 public LSL_Key modInvokeK(string fname, params object[] parms)
163 { 194 {
195// m_log.DebugFormat(
196// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
197// fname,
198// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
199// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
200
164 Type returntype = m_comms.LookupReturnType(fname); 201 Type returntype = m_comms.LookupReturnType(fname);
165 if (returntype != typeof(UUID)) 202 if (returntype != typeof(UUID))
166 MODError(String.Format("return type mismatch for {0}",fname)); 203 MODError(String.Format("return type mismatch for {0}",fname));
@@ -171,6 +208,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
171 208
172 public LSL_Vector modInvokeV(string fname, params object[] parms) 209 public LSL_Vector modInvokeV(string fname, params object[] parms)
173 { 210 {
211// m_log.DebugFormat(
212// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
213// fname,
214// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
215// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
216
174 Type returntype = m_comms.LookupReturnType(fname); 217 Type returntype = m_comms.LookupReturnType(fname);
175 if (returntype != typeof(OpenMetaverse.Vector3)) 218 if (returntype != typeof(OpenMetaverse.Vector3))
176 MODError(String.Format("return type mismatch for {0}",fname)); 219 MODError(String.Format("return type mismatch for {0}",fname));
@@ -181,6 +224,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
181 224
182 public LSL_Rotation modInvokeR(string fname, params object[] parms) 225 public LSL_Rotation modInvokeR(string fname, params object[] parms)
183 { 226 {
227// m_log.DebugFormat(
228// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
229// fname,
230// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
231// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
232
184 Type returntype = m_comms.LookupReturnType(fname); 233 Type returntype = m_comms.LookupReturnType(fname);
185 if (returntype != typeof(OpenMetaverse.Quaternion)) 234 if (returntype != typeof(OpenMetaverse.Quaternion))
186 MODError(String.Format("return type mismatch for {0}",fname)); 235 MODError(String.Format("return type mismatch for {0}",fname));
@@ -191,6 +240,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
191 240
192 public LSL_List modInvokeL(string fname, params object[] parms) 241 public LSL_List modInvokeL(string fname, params object[] parms)
193 { 242 {
243// m_log.DebugFormat(
244// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
245// fname,
246// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
247// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
248
194 Type returntype = m_comms.LookupReturnType(fname); 249 Type returntype = m_comms.LookupReturnType(fname);
195 if (returntype != typeof(object[])) 250 if (returntype != typeof(object[]))
196 MODError(String.Format("return type mismatch for {0}",fname)); 251 MODError(String.Format("return type mismatch for {0}",fname));
@@ -248,6 +303,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
248 return ""; 303 return "";
249 } 304 }
250 305
306// m_log.DebugFormat(
307// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
308// fname,
309// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
310// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
311
251 Type[] signature = m_comms.LookupTypeSignature(fname); 312 Type[] signature = m_comms.LookupTypeSignature(fname);
252 if (signature.Length != parms.Length) 313 if (signature.Length != parms.Length)
253 MODError(String.Format("wrong number of parameters to function {0}",fname)); 314 MODError(String.Format("wrong number of parameters to function {0}",fname));
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8aac33f..e87bb04 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -143,9 +143,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
143 143
144 protected IUrlModule m_UrlModule = null; 144 protected IUrlModule m_UrlModule = null;
145 145
146 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 146 public void Initialize(
147 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
147 { 148 {
148 m_ScriptEngine = ScriptEngine; 149 m_ScriptEngine = scriptEngine;
149 m_host = host; 150 m_host = host;
150 m_item = item; 151 m_item = item;
151 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); 152 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
@@ -254,11 +255,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
254 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); 255 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
255 } 256 }
256 257
258 // Returns of the function is allowed. Throws a script exception if not allowed.
257 public void CheckThreatLevel(ThreatLevel level, string function) 259 public void CheckThreatLevel(ThreatLevel level, string function)
258 { 260 {
259 if (!m_OSFunctionsEnabled) 261 if (!m_OSFunctionsEnabled)
260 OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws 262 OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws
261 263
264 string reasonWhyNot = CheckThreatLevelTest(level, function);
265 if (!String.IsNullOrEmpty(reasonWhyNot))
266 {
267 OSSLError(reasonWhyNot);
268 }
269 }
270
271 // Check to see if function is allowed. Returns an empty string if function permitted
272 // or a string explaining why this function can't be used.
273 private string CheckThreatLevelTest(ThreatLevel level, string function)
274 {
262 if (!m_FunctionPerms.ContainsKey(function)) 275 if (!m_FunctionPerms.ContainsKey(function))
263 { 276 {
264 FunctionPerms perms = new FunctionPerms(); 277 FunctionPerms perms = new FunctionPerms();
@@ -338,10 +351,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
338 { 351 {
339 // Allow / disallow by threat level 352 // Allow / disallow by threat level
340 if (level > m_MaxThreatLevel) 353 if (level > m_MaxThreatLevel)
341 OSSLError( 354 return
342 String.Format( 355 String.Format(
343 "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.", 356 "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.",
344 function, m_MaxThreatLevel, level)); 357 function, m_MaxThreatLevel, level);
345 } 358 }
346 else 359 else
347 { 360 {
@@ -351,7 +364,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
351 if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID)) 364 if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID))
352 { 365 {
353 // prim owner is in the list of allowed owners 366 // prim owner is in the list of allowed owners
354 return; 367 return String.Empty;
355 } 368 }
356 369
357 UUID ownerID = m_item.OwnerID; 370 UUID ownerID = m_item.OwnerID;
@@ -363,7 +376,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
363 376
364 if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) 377 if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero)
365 { 378 {
366 return; 379 return String.Empty;
367 } 380 }
368 } 381 }
369 382
@@ -374,7 +387,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
374 387
375 if (land.LandData.OwnerID == ownerID) 388 if (land.LandData.OwnerID == ownerID)
376 { 389 {
377 return; 390 return String.Empty;
378 } 391 }
379 } 392 }
380 393
@@ -384,7 +397,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
384 //Only Estate Managers may use the function 397 //Only Estate Managers may use the function
385 if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) 398 if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID)
386 { 399 {
387 return; 400 return String.Empty;
388 } 401 }
389 } 402 }
390 403
@@ -393,25 +406,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
393 { 406 {
394 if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) 407 if (World.RegionInfo.EstateSettings.EstateOwner == ownerID)
395 { 408 {
396 return; 409 return String.Empty;
397 } 410 }
398 } 411 }
399 412
400 if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) 413 if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID))
401 OSSLError( 414 return(
402 String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", 415 String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.",
403 function)); 416 function));
404 417
405 if (m_item.CreatorID != ownerID) 418 if (m_item.CreatorID != ownerID)
406 { 419 {
407 if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) 420 if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0)
408 OSSLError( 421 return String.Format("{0} permission denied. Script permissions error.", function);
409 String.Format("{0} permission denied. Script permissions error.",
410 function));
411 422
412 } 423 }
413 } 424 }
414 } 425 }
426 return String.Empty;
415 } 427 }
416 428
417 internal void OSSLDeprecated(string function, string replacement) 429 internal void OSSLDeprecated(string function, string replacement)
@@ -983,7 +995,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
983 if (animID == UUID.Zero) 995 if (animID == UUID.Zero)
984 target.Animator.RemoveAnimation(animation); 996 target.Animator.RemoveAnimation(animation);
985 else 997 else
986 target.Animator.RemoveAnimation(animID); 998 target.Animator.RemoveAnimation(animID, true);
987 } 999 }
988 } 1000 }
989 } 1001 }
@@ -1214,12 +1226,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1214 sunHour += 24.0; 1226 sunHour += 24.0;
1215 1227
1216 World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; 1228 World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun;
1217 World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 1229 World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30
1218 World.RegionInfo.RegionSettings.FixedSun = sunFixed; 1230 World.RegionInfo.RegionSettings.FixedSun = sunFixed;
1219 World.RegionInfo.RegionSettings.Save(); 1231 World.RegionInfo.RegionSettings.Save();
1220 1232
1221 World.EventManager.TriggerEstateToolsSunUpdate( 1233 World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle);
1222 World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour);
1223 } 1234 }
1224 1235
1225 /// <summary> 1236 /// <summary>
@@ -1244,8 +1255,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1244 World.RegionInfo.EstateSettings.FixedSun = sunFixed; 1255 World.RegionInfo.EstateSettings.FixedSun = sunFixed;
1245 World.RegionInfo.EstateSettings.Save(); 1256 World.RegionInfo.EstateSettings.Save();
1246 1257
1247 World.EventManager.TriggerEstateToolsSunUpdate( 1258 World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle);
1248 World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour);
1249 } 1259 }
1250 1260
1251 /// <summary> 1261 /// <summary>
@@ -1569,6 +1579,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1569 } 1579 }
1570 } 1580 }
1571 1581
1582 public string osGetPhysicsEngineType()
1583 {
1584 // High because it can be used to target attacks to known weaknesses
1585 // This would allow a new class of griefer scripts that don't even
1586 // require their user to know what they are doing (see script
1587 // kiddie)
1588 // Because it would be nice if scripts didn't blow up if the information
1589 // about the physics engine, this function returns an empty string if
1590 // the user does not have permission to see it. This as opposed to
1591 // throwing an exception.
1592 m_host.AddScriptLPS(1);
1593 string ret = String.Empty;
1594 if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType")))
1595 {
1596 if (m_ScriptEngine.World.PhysicsScene != null)
1597 {
1598 ret = m_ScriptEngine.World.PhysicsScene.EngineType;
1599 // An old physics engine might have an uninitialized engine type
1600 if (ret == null)
1601 ret = "unknown";
1602 }
1603 }
1604
1605 return ret;
1606 }
1607
1572 public string osGetSimulatorVersion() 1608 public string osGetSimulatorVersion()
1573 { 1609 {
1574 // High because it can be used to target attacks to known weaknesses 1610 // High because it can be used to target attacks to known weaknesses
@@ -2136,9 +2172,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2136 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); 2172 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI");
2137 m_host.AddScriptLPS(1); 2173 m_host.AddScriptLPS(1);
2138 2174
2139 string HomeURI = String.Empty;
2140 IConfigSource config = m_ScriptEngine.ConfigSource; 2175 IConfigSource config = m_ScriptEngine.ConfigSource;
2176 string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI",
2177 new string[] { "Startup", "Hypergrid" }, String.Empty);
2178
2179 if (!string.IsNullOrEmpty(HomeURI))
2180 return HomeURI;
2141 2181
2182 // Legacy. Remove soon!
2142 if (config.Configs["LoginService"] != null) 2183 if (config.Configs["LoginService"] != null)
2143 HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI); 2184 HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI);
2144 2185
@@ -2153,9 +2194,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2153 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); 2194 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI");
2154 m_host.AddScriptLPS(1); 2195 m_host.AddScriptLPS(1);
2155 2196
2156 string gatekeeperURI = String.Empty;
2157 IConfigSource config = m_ScriptEngine.ConfigSource; 2197 IConfigSource config = m_ScriptEngine.ConfigSource;
2198 string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
2199 new string[] { "Startup", "Hypergrid" }, String.Empty);
2200
2201 if (!string.IsNullOrEmpty(gatekeeperURI))
2202 return gatekeeperURI;
2158 2203
2204 // Legacy. Remove soon!
2159 if (config.Configs["GridService"] != null) 2205 if (config.Configs["GridService"] != null)
2160 gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI); 2206 gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI);
2161 2207
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 4dd795d..d3ef378 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -42,6 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
42 { 42 {
43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 /// <summary>
46 /// Used by one-off and repeated sensors
47 /// </summary>
48 public class SensorInfo
49 {
50 public uint localID;
51 public UUID itemID;
52 public double interval;
53 public DateTime next;
54
55 public string name;
56 public UUID keyID;
57 public int type;
58 public double range;
59 public double arc;
60 public SceneObjectPart host;
61
62 public SensorInfo Clone()
63 {
64 return (SensorInfo)this.MemberwiseClone();
65 }
66 }
67
45 public AsyncCommandManager m_CmdManager; 68 public AsyncCommandManager m_CmdManager;
46 69
47 /// <summary> 70 /// <summary>
@@ -78,24 +101,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
78 private int maximumToReturn = 16; 101 private int maximumToReturn = 16;
79 102
80 // 103 //
81 // SenseRepeater and Sensors
82 //
83 private class SenseRepeatClass
84 {
85 public uint localID;
86 public UUID itemID;
87 public double interval;
88 public DateTime next;
89
90 public string name;
91 public UUID keyID;
92 public int type;
93 public double range;
94 public double arc;
95 public SceneObjectPart host;
96 }
97
98 //
99 // Sensed entity 104 // Sensed entity
100 // 105 //
101 private class SensedEntity : IComparable 106 private class SensedEntity : IComparable
@@ -127,7 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
127 /// 132 ///
128 /// Always lock SenseRepeatListLock when updating this list. 133 /// Always lock SenseRepeatListLock when updating this list.
129 /// </remarks> 134 /// </remarks>
130 private List<SenseRepeatClass> SenseRepeaters = new List<SenseRepeatClass>(); 135 private List<SensorInfo> SenseRepeaters = new List<SensorInfo>();
131 private object SenseRepeatListLock = new object(); 136 private object SenseRepeatListLock = new object();
132 137
133 public void SetSenseRepeatEvent(uint m_localID, UUID m_itemID, 138 public void SetSenseRepeatEvent(uint m_localID, UUID m_itemID,
@@ -141,7 +146,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
141 return; 146 return;
142 147
143 // Add to timer 148 // Add to timer
144 SenseRepeatClass ts = new SenseRepeatClass(); 149 SensorInfo ts = new SensorInfo();
145 ts.localID = m_localID; 150 ts.localID = m_localID;
146 ts.itemID = m_itemID; 151 ts.itemID = m_itemID;
147 ts.interval = sec; 152 ts.interval = sec;
@@ -160,11 +165,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
160 AddSenseRepeater(ts); 165 AddSenseRepeater(ts);
161 } 166 }
162 167
163 private void AddSenseRepeater(SenseRepeatClass senseRepeater) 168 private void AddSenseRepeater(SensorInfo senseRepeater)
164 { 169 {
165 lock (SenseRepeatListLock) 170 lock (SenseRepeatListLock)
166 { 171 {
167 List<SenseRepeatClass> newSenseRepeaters = new List<SenseRepeatClass>(SenseRepeaters); 172 List<SensorInfo> newSenseRepeaters = new List<SensorInfo>(SenseRepeaters);
168 newSenseRepeaters.Add(senseRepeater); 173 newSenseRepeaters.Add(senseRepeater);
169 SenseRepeaters = newSenseRepeaters; 174 SenseRepeaters = newSenseRepeaters;
170 } 175 }
@@ -175,8 +180,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
175 // Remove from timer 180 // Remove from timer
176 lock (SenseRepeatListLock) 181 lock (SenseRepeatListLock)
177 { 182 {
178 List<SenseRepeatClass> newSenseRepeaters = new List<SenseRepeatClass>(); 183 List<SensorInfo> newSenseRepeaters = new List<SensorInfo>();
179 foreach (SenseRepeatClass ts in SenseRepeaters) 184 foreach (SensorInfo ts in SenseRepeaters)
180 { 185 {
181 if (ts.localID != m_localID || ts.itemID != m_itemID) 186 if (ts.localID != m_localID || ts.itemID != m_itemID)
182 { 187 {
@@ -191,7 +196,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
191 public void CheckSenseRepeaterEvents() 196 public void CheckSenseRepeaterEvents()
192 { 197 {
193 // Go through all timers 198 // Go through all timers
194 foreach (SenseRepeatClass ts in SenseRepeaters) 199 foreach (SensorInfo ts in SenseRepeaters)
195 { 200 {
196 // Time has passed? 201 // Time has passed?
197 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) 202 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
@@ -208,7 +213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
208 double range, double arc, SceneObjectPart host) 213 double range, double arc, SceneObjectPart host)
209 { 214 {
210 // Add to timer 215 // Add to timer
211 SenseRepeatClass ts = new SenseRepeatClass(); 216 SensorInfo ts = new SensorInfo();
212 ts.localID = m_localID; 217 ts.localID = m_localID;
213 ts.itemID = m_itemID; 218 ts.itemID = m_itemID;
214 ts.interval = 0; 219 ts.interval = 0;
@@ -224,7 +229,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
224 SensorSweep(ts); 229 SensorSweep(ts);
225 } 230 }
226 231
227 private void SensorSweep(SenseRepeatClass ts) 232 private void SensorSweep(SensorInfo ts)
228 { 233 {
229 if (ts.host == null) 234 if (ts.host == null)
230 { 235 {
@@ -300,7 +305,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
300 } 305 }
301 } 306 }
302 307
303 private List<SensedEntity> doObjectSensor(SenseRepeatClass ts) 308 private List<SensedEntity> doObjectSensor(SensorInfo ts)
304 { 309 {
305 List<EntityBase> Entities; 310 List<EntityBase> Entities;
306 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 311 List<SensedEntity> sensedEntities = new List<SensedEntity>();
@@ -451,7 +456,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
451 return sensedEntities; 456 return sensedEntities;
452 } 457 }
453 458
454 private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) 459 private List<SensedEntity> doAgentSensor(SensorInfo ts)
455 { 460 {
456 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 461 List<SensedEntity> sensedEntities = new List<SensedEntity>();
457 462
@@ -630,7 +635,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
630 { 635 {
631 List<Object> data = new List<Object>(); 636 List<Object> data = new List<Object>();
632 637
633 foreach (SenseRepeatClass ts in SenseRepeaters) 638 foreach (SensorInfo ts in SenseRepeaters)
634 { 639 {
635 if (ts.itemID == itemID) 640 if (ts.itemID == itemID)
636 { 641 {
@@ -660,7 +665,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
660 665
661 while (idx < data.Length) 666 while (idx < data.Length)
662 { 667 {
663 SenseRepeatClass ts = new SenseRepeatClass(); 668 SensorInfo ts = new SensorInfo();
664 669
665 ts.localID = localID; 670 ts.localID = localID;
666 ts.itemID = itemID; 671 ts.itemID = itemID;
@@ -681,5 +686,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
681 idx += 6; 686 idx += 6;
682 } 687 }
683 } 688 }
689
690 public List<SensorInfo> GetSensorInfo()
691 {
692 List<SensorInfo> retList = new List<SensorInfo>();
693
694 lock (SenseRepeatListLock)
695 {
696 foreach (SensorInfo i in SenseRepeaters)
697 retList.Add(i.Clone());
698 }
699
700 return retList;
701 }
684 } 702 }
685} 703} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
index 9ee6946..68aacd2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
@@ -35,6 +35,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
35{ 35{
36 public class Timer 36 public class Timer
37 { 37 {
38 public class TimerInfo
39 {
40 public uint localID;
41 public UUID itemID;
42 //public double interval;
43 public long interval;
44 //public DateTime next;
45 public long next;
46
47 public TimerInfo Clone()
48 {
49 return (TimerInfo)this.MemberwiseClone();
50 }
51 }
52
38 public AsyncCommandManager m_CmdManager; 53 public AsyncCommandManager m_CmdManager;
39 54
40 public int TimersCount 55 public int TimersCount
@@ -59,17 +74,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
59 return localID.ToString() + itemID.ToString(); 74 return localID.ToString() + itemID.ToString();
60 } 75 }
61 76
62 private class TimerClass 77 private Dictionary<string,TimerInfo> Timers = new Dictionary<string,TimerInfo>();
63 {
64 public uint localID;
65 public UUID itemID;
66 //public double interval;
67 public long interval;
68 //public DateTime next;
69 public long next;
70 }
71
72 private Dictionary<string,TimerClass> Timers = new Dictionary<string,TimerClass>();
73 private object TimerListLock = new object(); 78 private object TimerListLock = new object();
74 79
75 public void SetTimerEvent(uint m_localID, UUID m_itemID, double sec) 80 public void SetTimerEvent(uint m_localID, UUID m_itemID, double sec)
@@ -81,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
81 } 86 }
82 87
83 // Add to timer 88 // Add to timer
84 TimerClass ts = new TimerClass(); 89 TimerInfo ts = new TimerInfo();
85 ts.localID = m_localID; 90 ts.localID = m_localID;
86 ts.itemID = m_itemID; 91 ts.itemID = m_itemID;
87 ts.interval = Convert.ToInt64(sec * 10000000); // How many 100 nanoseconds (ticks) should we wait 92 ts.interval = Convert.ToInt64(sec * 10000000); // How many 100 nanoseconds (ticks) should we wait
@@ -118,14 +123,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
118 if (Timers.Count == 0) 123 if (Timers.Count == 0)
119 return; 124 return;
120 125
121 Dictionary<string, TimerClass>.ValueCollection tvals; 126 Dictionary<string, TimerInfo>.ValueCollection tvals;
122 lock (TimerListLock) 127 lock (TimerListLock)
123 { 128 {
124 // Go through all timers 129 // Go through all timers
125 tvals = Timers.Values; 130 tvals = Timers.Values;
126 } 131 }
127 132
128 foreach (TimerClass ts in tvals) 133 foreach (TimerInfo ts in tvals)
129 { 134 {
130 // Time has passed? 135 // Time has passed?
131 if (ts.next < DateTime.Now.Ticks) 136 if (ts.next < DateTime.Now.Ticks)
@@ -149,8 +154,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
149 154
150 lock (TimerListLock) 155 lock (TimerListLock)
151 { 156 {
152 Dictionary<string, TimerClass>.ValueCollection tvals = Timers.Values; 157 Dictionary<string, TimerInfo>.ValueCollection tvals = Timers.Values;
153 foreach (TimerClass ts in tvals) 158 foreach (TimerInfo ts in tvals)
154 { 159 {
155 if (ts.itemID == itemID) 160 if (ts.itemID == itemID)
156 { 161 {
@@ -169,7 +174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
169 174
170 while (idx < data.Length) 175 while (idx < data.Length)
171 { 176 {
172 TimerClass ts = new TimerClass(); 177 TimerInfo ts = new TimerInfo();
173 178
174 ts.localID = localID; 179 ts.localID = localID;
175 ts.itemID = itemID; 180 ts.itemID = itemID;
@@ -183,5 +188,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
183 } 188 }
184 } 189 }
185 } 190 }
191
192 public List<TimerInfo> GetTimersInfo()
193 {
194 List<TimerInfo> retList = new List<TimerInfo>();
195
196 lock (TimerListLock)
197 {
198 foreach (TimerInfo i in Timers.Values)
199 retList.Add(i.Clone());
200 }
201
202 return retList;
203 }
186 } 204 }
187} 205}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
index d173db0..6d218a6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 8aa1249..a652cb8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -259,6 +259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
259 259
260 string osGetScriptEngineName(); 260 string osGetScriptEngineName();
261 string osGetSimulatorVersion(); 261 string osGetSimulatorVersion();
262 string osGetPhysicsEngineType();
262 Hashtable osParseJSON(string JSON); 263 Hashtable osParseJSON(string JSON);
263 264
264 void osMessageObject(key objectUUID,string message); 265 void osMessageObject(key objectUUID,string message);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 0dd5a57..da3b31f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -557,6 +557,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
557 public const int OBJECT_SERVER_COST = 14; 557 public const int OBJECT_SERVER_COST = 14;
558 public const int OBJECT_STREAMING_COST = 15; 558 public const int OBJECT_STREAMING_COST = 15;
559 public const int OBJECT_PHYSICS_COST = 16; 559 public const int OBJECT_PHYSICS_COST = 16;
560 public const int OBJECT_CHARACTER_TIME = 17;
561 public const int OBJECT_ROOT = 18;
562 public const int OBJECT_ATTACHED_POINT = 19;
563 public const int OBJECT_PATHFINDING_TYPE = 20;
564 public const int OBJECT_PHYSICS = 21;
565 public const int OBJECT_PHANTOM = 22;
566 public const int OBJECT_TEMP_ON_REZ = 23;
567
568 // Pathfinding types
569 public const int OPT_OTHER = -1;
570 public const int OPT_LEGACY_LINKSET = 0;
571 public const int OPT_AVATAR = 1;
572 public const int OPT_CHARACTER = 2;
573 public const int OPT_WALKABLE = 3;
574 public const int OPT_STATIC_OBSTACLE = 4;
575 public const int OPT_MATERIAL_VOLUME = 5;
576 public const int OPT_EXCLUSION_VOLUME = 6;
560 577
561 // for llGetAgentList 578 // for llGetAgentList
562 public const int AGENT_LIST_PARCEL = 1; 579 public const int AGENT_LIST_PARCEL = 1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 95dff18..b63773b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -420,6 +420,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
420 return m_OSSL_Functions.osGetScriptEngineName(); 420 return m_OSSL_Functions.osGetScriptEngineName();
421 } 421 }
422 422
423 public string osGetPhysicsEngineType()
424 {
425 return m_OSSL_Functions.osGetPhysicsEngineType();
426 }
427
423 public string osGetSimulatorVersion() 428 public string osGetSimulatorVersion()
424 { 429 {
425 return m_OSSL_Functions.osGetSimulatorVersion(); 430 return m_OSSL_Functions.osGetSimulatorVersion();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs
index 573a803..b1825ac 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs
index f6d5d41..342dbff 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]