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.cs285
-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, 372 insertions, 168 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..667cc09 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;
@@ -3141,11 +3173,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3141 3173
3142 PhysicsActor pa = new_group.RootPart.PhysActor; 3174 PhysicsActor pa = new_group.RootPart.PhysActor;
3143 3175
3176 //Recoil.
3144 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) 3177 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
3145 { 3178 {
3146 float groupmass = new_group.GetMass(); 3179 float groupmass = new_group.GetMass();
3147 vel *= -groupmass; 3180 Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
3148 llApplyImpulse(vel, 0); 3181 if (recoil != Vector3.Zero)
3182 {
3183 llApplyImpulse(recoil, 0);
3184 }
3149 } 3185 }
3150 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 3186 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
3151 return; 3187 return;
@@ -3220,7 +3256,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3220 { 3256 {
3221// m_log.Info("llSleep snoozing " + sec + "s."); 3257// m_log.Info("llSleep snoozing " + sec + "s.");
3222 m_host.AddScriptLPS(1); 3258 m_host.AddScriptLPS(1);
3223 Thread.Sleep((int)(sec * 1000)); 3259
3260 Sleep((int)(sec * 1000));
3224 } 3261 }
3225 3262
3226 public LSL_Float llGetMass() 3263 public LSL_Float llGetMass()
@@ -3322,7 +3359,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3322 /// <summary> 3359 /// <summary>
3323 /// Attach the object containing this script to the avatar that owns it. 3360 /// Attach the object containing this script to the avatar that owns it.
3324 /// </summary> 3361 /// </summary>
3325 /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> 3362 /// <param name='attachmentPoint'>
3363 /// The attachment point (e.g. <see cref="OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.ATTACH_CHEST">ATTACH_CHEST</see>)
3364 /// </param>
3326 /// <returns>true if the attach suceeded, false if it did not</returns> 3365 /// <returns>true if the attach suceeded, false if it did not</returns>
3327 public bool AttachToAvatar(int attachmentPoint) 3366 public bool AttachToAvatar(int attachmentPoint)
3328 { 3367 {
@@ -3680,7 +3719,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3680 if (animID == UUID.Zero) 3719 if (animID == UUID.Zero)
3681 presence.Animator.RemoveAnimation(anim); 3720 presence.Animator.RemoveAnimation(anim);
3682 else 3721 else
3683 presence.Animator.RemoveAnimation(animID); 3722 presence.Animator.RemoveAnimation(animID, true);
3684 } 3723 }
3685 } 3724 }
3686 } 3725 }
@@ -3753,21 +3792,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3753 } 3792 }
3754 else 3793 else
3755 { 3794 {
3756 bool sitting = false; 3795 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 { 3796 {
3772 // When agent is sitting, certain permissions are implicit if requested from sitting agent 3797 // When agent is sitting, certain permissions are implicit if requested from sitting agent
3773 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 3798 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@@ -3809,7 +3834,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3809 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3834 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3810 if (npcModule != null && npcModule.IsNPC(agentID, World)) 3835 if (npcModule != null && npcModule.IsNPC(agentID, World))
3811 { 3836 {
3812 if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) 3837 if (npcModule.CheckPermissions(agentID, m_host.OwnerID))
3813 { 3838 {
3814 lock (m_host.TaskInventory) 3839 lock (m_host.TaskInventory)
3815 { 3840 {
@@ -4184,62 +4209,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4184 public LSL_String llGetLinkName(int linknum) 4209 public LSL_String llGetLinkName(int linknum)
4185 { 4210 {
4186 m_host.AddScriptLPS(1); 4211 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
4191 // parse for sitting avatare-names
4192 List<String> nametable = new List<String>();
4193 World.ForEachRootScenePresence(delegate(ScenePresence presence)
4194 {
4195 SceneObjectPart sitPart = presence.ParentPart;
4196 if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId))
4197 nametable.Add(presence.ControllingClient.Name);
4198 });
4199 4212
4200 int totalprims = m_host.ParentGroup.PrimCount + nametable.Count; 4213 if (linknum < 0)
4201 if (totalprims > m_host.ParentGroup.PrimCount)
4202 { 4214 {
4203 // sitting Avatar-Name with negativ linknum / SinglePrim 4215 if (linknum == ScriptBaseClass.LINK_THIS)
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; 4216 return m_host.Name;
4209 // LinkNumber > of Real PrimSet = AvatarName 4217 else
4210 if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) 4218 return ScriptBaseClass.NULL_KEY;
4211 return nametable[totalprims - linknum];
4212 } 4219 }
4213 4220
4214 // Single prim 4221 int actualPrimCount = m_host.ParentGroup.PrimCount;
4215 if (m_host.LinkNum == 0) 4222 List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
4223 int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
4224
4225 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
4226 // prim that has any avatars sat upon it (in which case the root prim is link 1).
4227 if (linknum == 0)
4216 { 4228 {
4217 if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT) 4229 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
4218 return m_host.Name; 4230 return m_host.Name;
4219 else
4220 return UUID.Zero.ToString();
4221 }
4222 4231
4223 // Link set 4232 return ScriptBaseClass.NULL_KEY;
4224 SceneObjectPart part = null; 4233 }
4225 if (m_host.LinkNum == 1) // this is the Root prim 4234 // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
4235 // here we must match 1 (ScriptBaseClass.LINK_ROOT).
4236 else if (linknum == 1 && actualPrimCount == 1)
4226 { 4237 {
4227 if (linknum < 0) 4238 if (sittingAvatarIds.Count > 0)
4228 part = m_host.ParentGroup.GetLinkNumPart(2); 4239 return m_host.ParentGroup.RootPart.Name;
4229 else 4240 else
4230 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4241 return ScriptBaseClass.NULL_KEY;
4231 } 4242 }
4232 else // this is a child prim 4243 else if (linknum <= adjustedPrimCount)
4233 { 4244 {
4234 if (linknum < 2) 4245 if (linknum <= actualPrimCount)
4235 part = m_host.ParentGroup.GetLinkNumPart(1); 4246 {
4247 return m_host.ParentGroup.GetLinkNumPart(linknum).Name;
4248 }
4236 else 4249 else
4237 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4250 {
4251 ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]);
4252 if (sp != null)
4253 return sp.Name;
4254 else
4255 return ScriptBaseClass.NULL_KEY;
4256 }
4238 } 4257 }
4239 if (part != null)
4240 return part.Name;
4241 else 4258 else
4242 return UUID.Zero.ToString(); 4259 {
4260 return ScriptBaseClass.NULL_KEY;
4261 }
4243 } 4262 }
4244 4263
4245 public LSL_Integer llGetInventoryNumber(int type) 4264 public LSL_Integer llGetInventoryNumber(int type)
@@ -5852,9 +5871,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5852 } 5871 }
5853 5872
5854 /// <summary> 5873 /// <summary>
5855 /// Insert the list identified by <src> into the 5874 /// Insert the list identified by <paramref name="src"/> into the
5856 /// list designated by <dest> such that the first 5875 /// list designated by <paramref name="dest"/> such that the first
5857 /// new element has the index specified by <index> 5876 /// new element has the index specified by <paramref name="index"/>
5858 /// </summary> 5877 /// </summary>
5859 5878
5860 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index) 5879 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
@@ -6220,13 +6239,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6220 if (parcelOwned && land.LandData.OwnerID == id || 6239 if (parcelOwned && land.LandData.OwnerID == id ||
6221 parcel && land.LandData.GlobalID == id) 6240 parcel && land.LandData.GlobalID == id)
6222 { 6241 {
6223 result.Add(ssp.UUID.ToString()); 6242 result.Add(new LSL_Key(ssp.UUID.ToString()));
6224 } 6243 }
6225 } 6244 }
6226 } 6245 }
6227 else 6246 else
6228 { 6247 {
6229 result.Add(ssp.UUID.ToString()); 6248 result.Add(new LSL_Key(ssp.UUID.ToString()));
6230 } 6249 }
6231 } 6250 }
6232 // Maximum of 100 results 6251 // Maximum of 100 results
@@ -6687,6 +6706,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6687 ps.BurstSpeedMax = 1.0f; 6706 ps.BurstSpeedMax = 1.0f;
6688 ps.BurstRate = 0.1f; 6707 ps.BurstRate = 0.1f;
6689 ps.PartMaxAge = 10.0f; 6708 ps.PartMaxAge = 10.0f;
6709 ps.BurstPartCount = 1;
6690 return ps; 6710 return ps;
6691 } 6711 }
6692 6712
@@ -6708,10 +6728,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6708 SetParticleSystem(m_host, rules); 6728 SetParticleSystem(m_host, rules);
6709 } 6729 }
6710 6730
6711 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) 6731 private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
6712 { 6732 {
6713
6714
6715 if (rules.Length == 0) 6733 if (rules.Length == 0)
6716 { 6734 {
6717 part.RemoveParticleSystem(); 6735 part.RemoveParticleSystem();
@@ -7371,6 +7389,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7371 public void llCloseRemoteDataChannel(string channel) 7389 public void llCloseRemoteDataChannel(string channel)
7372 { 7390 {
7373 m_host.AddScriptLPS(1); 7391 m_host.AddScriptLPS(1);
7392
7393 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
7394 if (xmlRpcRouter != null)
7395 {
7396 xmlRpcRouter.UnRegisterReceiver(channel, m_item.ItemID);
7397 }
7398
7374 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 7399 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7375 if (xmlrpcMod != null) 7400 if (xmlrpcMod != null)
7376 xmlrpcMod.CloseXMLRPCChannel((UUID)channel); 7401 xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
@@ -11517,6 +11542,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11517 case ScriptBaseClass.OBJECT_PHYSICS_COST: 11542 case ScriptBaseClass.OBJECT_PHYSICS_COST:
11518 ret.Add(new LSL_Float(0)); 11543 ret.Add(new LSL_Float(0));
11519 break; 11544 break;
11545 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
11546 ret.Add(new LSL_Float(0));
11547 break;
11548 case ScriptBaseClass.OBJECT_ROOT:
11549 SceneObjectPart p = av.ParentPart;
11550 if (p != null)
11551 {
11552 ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString()));
11553 }
11554 else
11555 {
11556 ret.Add(new LSL_String(id));
11557 }
11558 break;
11559 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
11560 ret.Add(new LSL_Integer(0));
11561 break;
11562 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding
11563 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR));
11564 break;
11565 case ScriptBaseClass.OBJECT_PHYSICS:
11566 ret.Add(new LSL_Integer(0));
11567 break;
11568 case ScriptBaseClass.OBJECT_PHANTOM:
11569 ret.Add(new LSL_Integer(0));
11570 break;
11571 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11572 ret.Add(new LSL_Integer(0));
11573 break;
11520 default: 11574 default:
11521 // Invalid or unhandled constant. 11575 // Invalid or unhandled constant.
11522 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 11576 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -11608,6 +11662,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11608 // The value returned in SL for normal prims is prim count 11662 // The value returned in SL for normal prims is prim count
11609 ret.Add(new LSL_Float(obj.PhysicsCost)); 11663 ret.Add(new LSL_Float(obj.PhysicsCost));
11610 break; 11664 break;
11665 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
11666 ret.Add(new LSL_Float(0));
11667 break;
11668 case ScriptBaseClass.OBJECT_ROOT:
11669 ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString()));
11670 break;
11671 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
11672 ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint));
11673 break;
11674 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
11675 byte pcode = obj.Shape.PCode;
11676 if (obj.ParentGroup.AttachmentPoint != 0
11677 || pcode == (byte)PCode.Grass
11678 || pcode == (byte)PCode.Tree
11679 || pcode == (byte)PCode.NewTree)
11680 {
11681 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER));
11682 }
11683 else
11684 {
11685 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET));
11686 }
11687 break;
11688 case ScriptBaseClass.OBJECT_PHYSICS:
11689 if (obj.ParentGroup.AttachmentPoint != 0)
11690 {
11691 ret.Add(new LSL_Integer(0)); // Always false if attached
11692 }
11693 else
11694 {
11695 ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
11696 }
11697 break;
11698 case ScriptBaseClass.OBJECT_PHANTOM:
11699 if (obj.ParentGroup.AttachmentPoint != 0)
11700 {
11701 ret.Add(new LSL_Integer(0)); // Always false if attached
11702 }
11703 else
11704 {
11705 ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
11706 }
11707 break;
11708 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11709 ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
11710 break;
11611 default: 11711 default:
11612 // Invalid or unhandled constant. 11712 // Invalid or unhandled constant.
11613 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 11713 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -13271,7 +13371,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13271 /// Get a notecard line. 13371 /// Get a notecard line.
13272 /// </summary> 13372 /// </summary>
13273 /// <param name="assetID"></param> 13373 /// <param name="assetID"></param>
13274 /// <param name="line">Lines start at index 0</param> 13374 /// <param name="lineNumber">Lines start at index 0</param>
13275 /// <returns></returns> 13375 /// <returns></returns>
13276 public static string GetLine(UUID assetID, int lineNumber) 13376 public static string GetLine(UUID assetID, int lineNumber)
13277 { 13377 {
@@ -13300,9 +13400,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13300 /// Get a notecard line. 13400 /// Get a notecard line.
13301 /// </summary> 13401 /// </summary>
13302 /// <param name="assetID"></param> 13402 /// <param name="assetID"></param>
13303 /// <param name="line">Lines start at index 0</param> 13403 /// <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> 13404 /// <param name="maxLength">
13305 /// <returns></returns> 13405 /// Maximum length of the returned line.
13406 /// </param>
13407 /// <returns>
13408 /// If the line length is longer than <paramref name="maxLength"/>,
13409 /// the return string will be truncated.
13410 /// </returns>
13306 public static string GetLine(UUID assetID, int lineNumber, int maxLength) 13411 public static string GetLine(UUID assetID, int lineNumber, int maxLength)
13307 { 13412 {
13308 string line = GetLine(assetID, lineNumber); 13413 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();