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.cs319
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs76
-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/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
10 files changed, 399 insertions, 175 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 53c6e5c..38a9cb0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -87,10 +87,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
87 public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi 87 public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi
88 { 88 {
89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
90
90 protected IScriptEngine m_ScriptEngine; 91 protected IScriptEngine m_ScriptEngine;
91 protected SceneObjectPart m_host; 92 protected SceneObjectPart m_host;
92 93
93 /// <summary> 94 /// <summary>
95 /// Used for script sleeps when we are using co-operative script termination.
96 /// </summary>
97 /// <remarks>null if co-operative script termination is not active</remarks>
98 WaitHandle m_coopSleepHandle;
99
100 /// <summary>
94 /// The item that hosts this script 101 /// The item that hosts this script
95 /// </summary> 102 /// </summary>
96 protected TaskInventoryItem m_item; 103 protected TaskInventoryItem m_item;
@@ -100,6 +107,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
100 protected float m_ScriptDelayFactor = 1.0f; 107 protected float m_ScriptDelayFactor = 1.0f;
101 protected float m_ScriptDistanceFactor = 1.0f; 108 protected float m_ScriptDistanceFactor = 1.0f;
102 protected float m_MinTimerInterval = 0.5f; 109 protected float m_MinTimerInterval = 0.5f;
110 protected float m_recoilScaleFactor = 0.0f;
103 111
104 protected DateTime m_timer = DateTime.Now; 112 protected DateTime m_timer = DateTime.Now;
105 protected bool m_waitingForScriptAnswer = false; 113 protected bool m_waitingForScriptAnswer = false;
@@ -141,33 +149,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
141 {"TURNRIGHT", "Turning Right"} 149 {"TURNRIGHT", "Turning Right"}
142 }; 150 };
143 151
144 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 152 public void Initialize(
153 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
145 { 154 {
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; 155 m_lastSayShoutCheck = DateTime.UtcNow;
153 156
154 m_ScriptEngine = ScriptEngine; 157 m_ScriptEngine = scriptEngine;
155 m_host = host; 158 m_host = host;
156 m_item = item; 159 m_item = item;
157 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); 160 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
161 m_coopSleepHandle = coopSleepHandle;
158 162
159 LoadLimits(); // read script limits from config. 163 LoadConfig();
160 164
161 m_TransferModule = 165 m_TransferModule =
162 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); 166 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
163 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 167 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
164 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); 168 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();
165 169
166 AsyncCommands = new AsyncCommandManager(ScriptEngine); 170 AsyncCommands = new AsyncCommandManager(m_ScriptEngine);
167 } 171 }
168 172
169 /* load configuration items that affect script, object and run-time behavior. */ 173 /// <summary>
170 private void LoadLimits() 174 /// Load configuration items that affect script, object and run-time behavior. */
175 /// </summary>
176 private void LoadConfig()
171 { 177 {
172 m_ScriptDelayFactor = 178 m_ScriptDelayFactor =
173 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 179 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
@@ -181,12 +187,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
181 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); 187 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
182 if (m_notecardLineReadCharsMax > 65535) 188 if (m_notecardLineReadCharsMax > 65535)
183 m_notecardLineReadCharsMax = 65535; 189 m_notecardLineReadCharsMax = 65535;
190
184 // load limits for particular subsystems. 191 // load limits for particular subsystems.
185 IConfig SMTPConfig; 192 IConfig SMTPConfig;
186 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { 193 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) {
187 // there's an smtp config, so load in the snooze time. 194 // there's an smtp config, so load in the snooze time.
188 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); 195 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
189 } 196 }
197
198 // Rezzing an object with a velocity can create recoil. This feature seems to have been
199 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales
200 // it by this factor. May be zero to turn off recoil all together.
201 m_recoilScaleFactor = m_ScriptEngine.Config.GetFloat("RecoilScaleFactor", m_recoilScaleFactor);
190 } 202 }
191 203
192 public override Object InitializeLifetimeService() 204 public override Object InitializeLifetimeService()
@@ -207,7 +219,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
207 delay = (int)((float)delay * m_ScriptDelayFactor); 219 delay = (int)((float)delay * m_ScriptDelayFactor);
208 if (delay == 0) 220 if (delay == 0)
209 return; 221 return;
210 System.Threading.Thread.Sleep(delay); 222
223 Sleep(delay);
224 }
225
226 protected virtual void Sleep(int delay)
227 {
228 if (m_coopSleepHandle == null)
229 System.Threading.Thread.Sleep(delay);
230 else
231 CheckForCoopTermination(delay);
232 }
233
234 /// <summary>
235 /// Check for co-operative termination.
236 /// </summary>
237 /// <param name='delay'>If called with 0, then just the check is performed with no wait.</param>
238 protected virtual void CheckForCoopTermination(int delay)
239 {
240 if (m_coopSleepHandle.WaitOne(delay))
241 throw new ScriptCoopStopException();
211 } 242 }
212 243
213 public Scene World 244 public Scene World
@@ -1483,19 +1514,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1483 return 0; 1514 return 0;
1484 1515
1485 case ScriptBaseClass.STATUS_ROTATE_X: 1516 case ScriptBaseClass.STATUS_ROTATE_X:
1486 if (m_host.GetAxisRotation(2) == 2) 1517 // if (m_host.GetAxisRotation(2) != 0)
1518 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0)
1487 return 1; 1519 return 1;
1488 else 1520 else
1489 return 0; 1521 return 0;
1490 1522
1491 case ScriptBaseClass.STATUS_ROTATE_Y: 1523 case ScriptBaseClass.STATUS_ROTATE_Y:
1492 if (m_host.GetAxisRotation(4) == 4) 1524 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0)
1493 return 1; 1525 return 1;
1494 else 1526 else
1495 return 0; 1527 return 0;
1496 1528
1497 case ScriptBaseClass.STATUS_ROTATE_Z: 1529 case ScriptBaseClass.STATUS_ROTATE_Z:
1498 if (m_host.GetAxisRotation(8) == 8) 1530 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0)
1499 return 1; 1531 return 1;
1500 else 1532 else
1501 return 0; 1533 return 0;
@@ -1875,10 +1907,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1875 part.Shape.FlexiForceX = (float)Force.x; 1907 part.Shape.FlexiForceX = (float)Force.x;
1876 part.Shape.FlexiForceY = (float)Force.y; 1908 part.Shape.FlexiForceY = (float)Force.y;
1877 part.Shape.FlexiForceZ = (float)Force.z; 1909 part.Shape.FlexiForceZ = (float)Force.z;
1878 part.Shape.PathCurve = 0x80; 1910 part.Shape.PathCurve = (byte)Extrusion.Flexible;
1879 part.ParentGroup.HasGroupChanged = true;
1880 part.ScheduleFullUpdate();
1881 } 1911 }
1912 else
1913 {
1914 // Other values not set, they do not seem to be sent to the viewer
1915 // Setting PathCurve appears to be what actually toggles the check box and turns Flexi on and off
1916 part.Shape.PathCurve = (byte)Extrusion.Straight;
1917 part.Shape.FlexiEntry = false;
1918 }
1919 part.ParentGroup.HasGroupChanged = true;
1920 part.ScheduleFullUpdate();
1882 } 1921 }
1883 1922
1884 /// <summary> 1923 /// <summary>
@@ -3141,11 +3180,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3141 3180
3142 PhysicsActor pa = new_group.RootPart.PhysActor; 3181 PhysicsActor pa = new_group.RootPart.PhysActor;
3143 3182
3183 //Recoil.
3144 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) 3184 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
3145 { 3185 {
3146 float groupmass = new_group.GetMass(); 3186 float groupmass = new_group.GetMass();
3147 vel *= -groupmass; 3187 Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
3148 llApplyImpulse(vel, 0); 3188 if (recoil != Vector3.Zero)
3189 {
3190 llApplyImpulse(recoil, 0);
3191 }
3149 } 3192 }
3150 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 3193 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
3151 return; 3194 return;
@@ -3220,7 +3263,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3220 { 3263 {
3221// m_log.Info("llSleep snoozing " + sec + "s."); 3264// m_log.Info("llSleep snoozing " + sec + "s.");
3222 m_host.AddScriptLPS(1); 3265 m_host.AddScriptLPS(1);
3223 Thread.Sleep((int)(sec * 1000)); 3266
3267 Sleep((int)(sec * 1000));
3224 } 3268 }
3225 3269
3226 public LSL_Float llGetMass() 3270 public LSL_Float llGetMass()
@@ -3322,7 +3366,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3322 /// <summary> 3366 /// <summary>
3323 /// Attach the object containing this script to the avatar that owns it. 3367 /// Attach the object containing this script to the avatar that owns it.
3324 /// </summary> 3368 /// </summary>
3325 /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> 3369 /// <param name='attachmentPoint'>
3370 /// The attachment point (e.g. <see cref="OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.ATTACH_CHEST">ATTACH_CHEST</see>)
3371 /// </param>
3326 /// <returns>true if the attach suceeded, false if it did not</returns> 3372 /// <returns>true if the attach suceeded, false if it did not</returns>
3327 public bool AttachToAvatar(int attachmentPoint) 3373 public bool AttachToAvatar(int attachmentPoint)
3328 { 3374 {
@@ -3680,7 +3726,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3680 if (animID == UUID.Zero) 3726 if (animID == UUID.Zero)
3681 presence.Animator.RemoveAnimation(anim); 3727 presence.Animator.RemoveAnimation(anim);
3682 else 3728 else
3683 presence.Animator.RemoveAnimation(animID); 3729 presence.Animator.RemoveAnimation(animID, true);
3684 } 3730 }
3685 } 3731 }
3686 } 3732 }
@@ -3753,21 +3799,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3753 } 3799 }
3754 else 3800 else
3755 { 3801 {
3756 bool sitting = false; 3802 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 { 3803 {
3772 // When agent is sitting, certain permissions are implicit if requested from sitting agent 3804 // When agent is sitting, certain permissions are implicit if requested from sitting agent
3773 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 3805 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@@ -3809,7 +3841,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3809 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3841 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3810 if (npcModule != null && npcModule.IsNPC(agentID, World)) 3842 if (npcModule != null && npcModule.IsNPC(agentID, World))
3811 { 3843 {
3812 if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) 3844 if (npcModule.CheckPermissions(agentID, m_host.OwnerID))
3813 { 3845 {
3814 lock (m_host.TaskInventory) 3846 lock (m_host.TaskInventory)
3815 { 3847 {
@@ -4184,62 +4216,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4184 public LSL_String llGetLinkName(int linknum) 4216 public LSL_String llGetLinkName(int linknum)
4185 { 4217 {
4186 m_host.AddScriptLPS(1); 4218 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 4219
4191 // parse for sitting avatare-names 4220 if (linknum < 0)
4192 List<String> nametable = new List<String>();
4193 World.ForEachRootScenePresence(delegate(ScenePresence presence)
4194 { 4221 {
4195 SceneObjectPart sitPart = presence.ParentPart; 4222 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; 4223 return m_host.Name;
4209 // LinkNumber > of Real PrimSet = AvatarName 4224 else
4210 if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) 4225 return ScriptBaseClass.NULL_KEY;
4211 return nametable[totalprims - linknum];
4212 } 4226 }
4213 4227
4214 // Single prim 4228 int actualPrimCount = m_host.ParentGroup.PrimCount;
4215 if (m_host.LinkNum == 0) 4229 List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
4230 int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
4231
4232 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
4233 // prim that has any avatars sat upon it (in which case the root prim is link 1).
4234 if (linknum == 0)
4216 { 4235 {
4217 if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT) 4236 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
4218 return m_host.Name; 4237 return m_host.Name;
4219 else
4220 return UUID.Zero.ToString();
4221 }
4222 4238
4223 // Link set 4239 return ScriptBaseClass.NULL_KEY;
4224 SceneObjectPart part = null; 4240 }
4225 if (m_host.LinkNum == 1) // this is the Root prim 4241 // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
4242 // here we must match 1 (ScriptBaseClass.LINK_ROOT).
4243 else if (linknum == 1 && actualPrimCount == 1)
4226 { 4244 {
4227 if (linknum < 0) 4245 if (sittingAvatarIds.Count > 0)
4228 part = m_host.ParentGroup.GetLinkNumPart(2); 4246 return m_host.ParentGroup.RootPart.Name;
4229 else 4247 else
4230 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4248 return ScriptBaseClass.NULL_KEY;
4231 } 4249 }
4232 else // this is a child prim 4250 else if (linknum <= adjustedPrimCount)
4233 { 4251 {
4234 if (linknum < 2) 4252 if (linknum <= actualPrimCount)
4235 part = m_host.ParentGroup.GetLinkNumPart(1); 4253 {
4254 return m_host.ParentGroup.GetLinkNumPart(linknum).Name;
4255 }
4236 else 4256 else
4237 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4257 {
4258 ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]);
4259 if (sp != null)
4260 return sp.Name;
4261 else
4262 return ScriptBaseClass.NULL_KEY;
4263 }
4238 } 4264 }
4239 if (part != null)
4240 return part.Name;
4241 else 4265 else
4242 return UUID.Zero.ToString(); 4266 {
4267 return ScriptBaseClass.NULL_KEY;
4268 }
4243 } 4269 }
4244 4270
4245 public LSL_Integer llGetInventoryNumber(int type) 4271 public LSL_Integer llGetInventoryNumber(int type)
@@ -5852,9 +5878,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5852 } 5878 }
5853 5879
5854 /// <summary> 5880 /// <summary>
5855 /// Insert the list identified by <src> into the 5881 /// Insert the list identified by <paramref name="src"/> into the
5856 /// list designated by <dest> such that the first 5882 /// list designated by <paramref name="dest"/> such that the first
5857 /// new element has the index specified by <index> 5883 /// new element has the index specified by <paramref name="index"/>
5858 /// </summary> 5884 /// </summary>
5859 5885
5860 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index) 5886 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
@@ -6220,13 +6246,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6220 if (parcelOwned && land.LandData.OwnerID == id || 6246 if (parcelOwned && land.LandData.OwnerID == id ||
6221 parcel && land.LandData.GlobalID == id) 6247 parcel && land.LandData.GlobalID == id)
6222 { 6248 {
6223 result.Add(ssp.UUID.ToString()); 6249 result.Add(new LSL_Key(ssp.UUID.ToString()));
6224 } 6250 }
6225 } 6251 }
6226 } 6252 }
6227 else 6253 else
6228 { 6254 {
6229 result.Add(ssp.UUID.ToString()); 6255 result.Add(new LSL_Key(ssp.UUID.ToString()));
6230 } 6256 }
6231 } 6257 }
6232 // Maximum of 100 results 6258 // Maximum of 100 results
@@ -6687,6 +6713,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6687 ps.BurstSpeedMax = 1.0f; 6713 ps.BurstSpeedMax = 1.0f;
6688 ps.BurstRate = 0.1f; 6714 ps.BurstRate = 0.1f;
6689 ps.PartMaxAge = 10.0f; 6715 ps.PartMaxAge = 10.0f;
6716 ps.BurstPartCount = 1;
6690 return ps; 6717 return ps;
6691 } 6718 }
6692 6719
@@ -6708,10 +6735,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6708 SetParticleSystem(m_host, rules); 6735 SetParticleSystem(m_host, rules);
6709 } 6736 }
6710 6737
6711 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) 6738 private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
6712 { 6739 {
6713
6714
6715 if (rules.Length == 0) 6740 if (rules.Length == 0)
6716 { 6741 {
6717 part.RemoveParticleSystem(); 6742 part.RemoveParticleSystem();
@@ -7371,6 +7396,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7371 public void llCloseRemoteDataChannel(string channel) 7396 public void llCloseRemoteDataChannel(string channel)
7372 { 7397 {
7373 m_host.AddScriptLPS(1); 7398 m_host.AddScriptLPS(1);
7399
7400 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
7401 if (xmlRpcRouter != null)
7402 {
7403 xmlRpcRouter.UnRegisterReceiver(channel, m_item.ItemID);
7404 }
7405
7374 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 7406 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7375 if (xmlrpcMod != null) 7407 if (xmlrpcMod != null)
7376 xmlrpcMod.CloseXMLRPCChannel((UUID)channel); 7408 xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
@@ -11517,6 +11549,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11517 case ScriptBaseClass.OBJECT_PHYSICS_COST: 11549 case ScriptBaseClass.OBJECT_PHYSICS_COST:
11518 ret.Add(new LSL_Float(0)); 11550 ret.Add(new LSL_Float(0));
11519 break; 11551 break;
11552 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
11553 ret.Add(new LSL_Float(0));
11554 break;
11555 case ScriptBaseClass.OBJECT_ROOT:
11556 SceneObjectPart p = av.ParentPart;
11557 if (p != null)
11558 {
11559 ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString()));
11560 }
11561 else
11562 {
11563 ret.Add(new LSL_String(id));
11564 }
11565 break;
11566 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
11567 ret.Add(new LSL_Integer(0));
11568 break;
11569 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding
11570 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR));
11571 break;
11572 case ScriptBaseClass.OBJECT_PHYSICS:
11573 ret.Add(new LSL_Integer(0));
11574 break;
11575 case ScriptBaseClass.OBJECT_PHANTOM:
11576 ret.Add(new LSL_Integer(0));
11577 break;
11578 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11579 ret.Add(new LSL_Integer(0));
11580 break;
11520 default: 11581 default:
11521 // Invalid or unhandled constant. 11582 // Invalid or unhandled constant.
11522 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 11583 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -11608,6 +11669,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11608 // The value returned in SL for normal prims is prim count 11669 // The value returned in SL for normal prims is prim count
11609 ret.Add(new LSL_Float(obj.PhysicsCost)); 11670 ret.Add(new LSL_Float(obj.PhysicsCost));
11610 break; 11671 break;
11672 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
11673 ret.Add(new LSL_Float(0));
11674 break;
11675 case ScriptBaseClass.OBJECT_ROOT:
11676 ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString()));
11677 break;
11678 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
11679 ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint));
11680 break;
11681 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
11682 byte pcode = obj.Shape.PCode;
11683 if (obj.ParentGroup.AttachmentPoint != 0
11684 || pcode == (byte)PCode.Grass
11685 || pcode == (byte)PCode.Tree
11686 || pcode == (byte)PCode.NewTree)
11687 {
11688 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER));
11689 }
11690 else
11691 {
11692 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET));
11693 }
11694 break;
11695 case ScriptBaseClass.OBJECT_PHYSICS:
11696 if (obj.ParentGroup.AttachmentPoint != 0)
11697 {
11698 ret.Add(new LSL_Integer(0)); // Always false if attached
11699 }
11700 else
11701 {
11702 ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
11703 }
11704 break;
11705 case ScriptBaseClass.OBJECT_PHANTOM:
11706 if (obj.ParentGroup.AttachmentPoint != 0)
11707 {
11708 ret.Add(new LSL_Integer(0)); // Always false if attached
11709 }
11710 else
11711 {
11712 ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
11713 }
11714 break;
11715 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11716 ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
11717 break;
11611 default: 11718 default:
11612 // Invalid or unhandled constant. 11719 // Invalid or unhandled constant.
11613 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 11720 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -11991,12 +12098,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11991 radius = Math.Abs(maxY); 12098 radius = Math.Abs(maxY);
11992 if (Math.Abs(maxZ) > radius) 12099 if (Math.Abs(maxZ) > radius)
11993 radius = Math.Abs(maxZ); 12100 radius = Math.Abs(maxZ);
11994 12101 radius = radius*1.413f;
11995 Vector3 ac = group.AbsolutePosition - rayStart; 12102 Vector3 ac = group.AbsolutePosition - rayStart;
11996 Vector3 bc = group.AbsolutePosition - rayEnd; 12103 Vector3 bc = group.AbsolutePosition - rayEnd;
11997 12104
11998 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); 12105 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
11999 12106
12000 // Too far off ray, don't bother 12107 // Too far off ray, don't bother
12001 if (d > radius) 12108 if (d > radius)
12002 return; 12109 return;
@@ -12006,11 +12113,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12006 if (d2 > 0) 12113 if (d2 > 0)
12007 return; 12114 return;
12008 12115
12116 ray = new Ray(rayStart, Vector3.Normalize(rayEnd - rayStart));
12009 EntityIntersection intersection = group.TestIntersection(ray, true, false); 12117 EntityIntersection intersection = group.TestIntersection(ray, true, false);
12010 // Miss. 12118 // Miss.
12011 if (!intersection.HitTF) 12119 if (!intersection.HitTF)
12012 return; 12120 return;
12013 12121
12122 Vector3 b1 = group.AbsolutePosition + new Vector3(minX, minY, minZ);
12123 Vector3 b2 = group.AbsolutePosition + new Vector3(maxX, maxY, maxZ);
12124 //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);
12125 if (!(intersection.ipoint.X >= b1.X && intersection.ipoint.X <= b2.X &&
12126 intersection.ipoint.Y >= b1.Y && intersection.ipoint.Y <= b2.Y &&
12127 intersection.ipoint.Z >= b1.Z && intersection.ipoint.Z <= b2.Z))
12128 return;
12129
12014 ContactResult result = new ContactResult (); 12130 ContactResult result = new ContactResult ();
12015 result.ConsumerID = group.LocalId; 12131 result.ConsumerID = group.LocalId;
12016// result.Depth = intersection.distance; 12132// result.Depth = intersection.distance;
@@ -12284,8 +12400,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12284 if (checkPhysical || checkNonPhysical || detectPhantom) 12400 if (checkPhysical || checkNonPhysical || detectPhantom)
12285 { 12401 {
12286 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom); 12402 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom);
12287 foreach (ContactResult r in objectHits) 12403 for (int iter = 0; iter < objectHits.Length; iter++)
12288 results.Add(r); 12404 {
12405 // Redistance the Depth because the Scene RayCaster returns distance from center to make the rezzing code simpler.
12406 objectHits[iter].Depth = Vector3.Distance(objectHits[iter].Pos, rayStart);
12407 results.Add(objectHits[iter]);
12408 }
12289 } 12409 }
12290 } 12410 }
12291 12411
@@ -13271,7 +13391,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13271 /// Get a notecard line. 13391 /// Get a notecard line.
13272 /// </summary> 13392 /// </summary>
13273 /// <param name="assetID"></param> 13393 /// <param name="assetID"></param>
13274 /// <param name="line">Lines start at index 0</param> 13394 /// <param name="lineNumber">Lines start at index 0</param>
13275 /// <returns></returns> 13395 /// <returns></returns>
13276 public static string GetLine(UUID assetID, int lineNumber) 13396 public static string GetLine(UUID assetID, int lineNumber)
13277 { 13397 {
@@ -13300,9 +13420,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13300 /// Get a notecard line. 13420 /// Get a notecard line.
13301 /// </summary> 13421 /// </summary>
13302 /// <param name="assetID"></param> 13422 /// <param name="assetID"></param>
13303 /// <param name="line">Lines start at index 0</param> 13423 /// <param name="lineNumber">Lines start at index 0</param>
13304 /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> 13424 /// <param name="maxLength">
13305 /// <returns></returns> 13425 /// Maximum length of the returned line.
13426 /// </param>
13427 /// <returns>
13428 /// If the line length is longer than <paramref name="maxLength"/>,
13429 /// the return string will be truncated.
13430 /// </returns>
13306 public static string GetLine(UUID assetID, int lineNumber, int maxLength) 13431 public static string GetLine(UUID assetID, int lineNumber, int maxLength)
13307 { 13432 {
13308 string line = GetLine(assetID, lineNumber); 13433 string line = GetLine(assetID, lineNumber);
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 8f34833..9045672 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_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_MODFunctionsEnabled = false; 62 internal bool m_MODFunctionsEnabled = 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 m_item = item; 70 m_item = item;
69 71
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7c2f8ed..6ff6b00 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
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/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index c447d1f..7eb347e 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 Object osParseJSONNew(string JSON); 263 Object osParseJSONNew(string JSON);
263 Hashtable osParseJSON(string JSON); 264 Hashtable osParseJSON(string JSON);
264 265
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 afa9ae0..c9902e4 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();