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.cs275
-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, 362 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..d03955b 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, EventWaitHandle 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 0562c7f..9df04df 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 EventWaitHandle 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, EventWaitHandle 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,16 @@ 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 if (m_coopSleepHandle.WaitOne(delay))
231 throw new ScriptCoopStopException();
211 } 232 }
212 233
213 public Scene World 234 public Scene World
@@ -1483,19 +1504,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1483 return 0; 1504 return 0;
1484 1505
1485 case ScriptBaseClass.STATUS_ROTATE_X: 1506 case ScriptBaseClass.STATUS_ROTATE_X:
1486 if (m_host.GetAxisRotation(2) == 2) 1507 // if (m_host.GetAxisRotation(2) != 0)
1508 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0)
1487 return 1; 1509 return 1;
1488 else 1510 else
1489 return 0; 1511 return 0;
1490 1512
1491 case ScriptBaseClass.STATUS_ROTATE_Y: 1513 case ScriptBaseClass.STATUS_ROTATE_Y:
1492 if (m_host.GetAxisRotation(4) == 4) 1514 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0)
1493 return 1; 1515 return 1;
1494 else 1516 else
1495 return 0; 1517 return 0;
1496 1518
1497 case ScriptBaseClass.STATUS_ROTATE_Z: 1519 case ScriptBaseClass.STATUS_ROTATE_Z:
1498 if (m_host.GetAxisRotation(8) == 8) 1520 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0)
1499 return 1; 1521 return 1;
1500 else 1522 else
1501 return 0; 1523 return 0;
@@ -3139,11 +3161,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3139 3161
3140 PhysicsActor pa = new_group.RootPart.PhysActor; 3162 PhysicsActor pa = new_group.RootPart.PhysActor;
3141 3163
3164 //Recoil.
3142 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) 3165 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
3143 { 3166 {
3144 float groupmass = new_group.GetMass(); 3167 float groupmass = new_group.GetMass();
3145 vel *= -groupmass; 3168 Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
3146 llApplyImpulse(vel, 0); 3169 if (recoil != Vector3.Zero)
3170 {
3171 llApplyImpulse(recoil, 0);
3172 }
3147 } 3173 }
3148 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 3174 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
3149 return; 3175 return;
@@ -3218,7 +3244,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3218 { 3244 {
3219// m_log.Info("llSleep snoozing " + sec + "s."); 3245// m_log.Info("llSleep snoozing " + sec + "s.");
3220 m_host.AddScriptLPS(1); 3246 m_host.AddScriptLPS(1);
3221 Thread.Sleep((int)(sec * 1000)); 3247
3248 Sleep((int)(sec * 1000));
3222 } 3249 }
3223 3250
3224 public LSL_Float llGetMass() 3251 public LSL_Float llGetMass()
@@ -3320,7 +3347,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3320 /// <summary> 3347 /// <summary>
3321 /// Attach the object containing this script to the avatar that owns it. 3348 /// Attach the object containing this script to the avatar that owns it.
3322 /// </summary> 3349 /// </summary>
3323 /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> 3350 /// <param name='attachmentPoint'>
3351 /// The attachment point (e.g. <see cref="OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.ATTACH_CHEST">ATTACH_CHEST</see>)
3352 /// </param>
3324 /// <returns>true if the attach suceeded, false if it did not</returns> 3353 /// <returns>true if the attach suceeded, false if it did not</returns>
3325 public bool AttachToAvatar(int attachmentPoint) 3354 public bool AttachToAvatar(int attachmentPoint)
3326 { 3355 {
@@ -3678,7 +3707,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3678 if (animID == UUID.Zero) 3707 if (animID == UUID.Zero)
3679 presence.Animator.RemoveAnimation(anim); 3708 presence.Animator.RemoveAnimation(anim);
3680 else 3709 else
3681 presence.Animator.RemoveAnimation(animID); 3710 presence.Animator.RemoveAnimation(animID, true);
3682 } 3711 }
3683 } 3712 }
3684 } 3713 }
@@ -3751,21 +3780,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3751 } 3780 }
3752 else 3781 else
3753 { 3782 {
3754 bool sitting = false; 3783 if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID))
3755 if (m_host.SitTargetAvatar == agentID)
3756 {
3757 sitting = true;
3758 }
3759 else
3760 {
3761 foreach (SceneObjectPart p in m_host.ParentGroup.Parts)
3762 {
3763 if (p.SitTargetAvatar == agentID)
3764 sitting = true;
3765 }
3766 }
3767
3768 if (sitting)
3769 { 3784 {
3770 // When agent is sitting, certain permissions are implicit if requested from sitting agent 3785 // When agent is sitting, certain permissions are implicit if requested from sitting agent
3771 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 3786 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@@ -3807,7 +3822,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3807 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3822 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3808 if (npcModule != null && npcModule.IsNPC(agentID, World)) 3823 if (npcModule != null && npcModule.IsNPC(agentID, World))
3809 { 3824 {
3810 if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) 3825 if (npcModule.CheckPermissions(agentID, m_host.OwnerID))
3811 { 3826 {
3812 lock (m_host.TaskInventory) 3827 lock (m_host.TaskInventory)
3813 { 3828 {
@@ -4182,62 +4197,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4182 public LSL_String llGetLinkName(int linknum) 4197 public LSL_String llGetLinkName(int linknum)
4183 { 4198 {
4184 m_host.AddScriptLPS(1); 4199 m_host.AddScriptLPS(1);
4185 // simplest case, this prims link number
4186 if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS)
4187 return m_host.Name;
4188
4189 // parse for sitting avatare-names
4190 List<String> nametable = new List<String>();
4191 World.ForEachRootScenePresence(delegate(ScenePresence presence)
4192 {
4193 SceneObjectPart sitPart = presence.ParentPart;
4194 if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId))
4195 nametable.Add(presence.ControllingClient.Name);
4196 });
4197 4200
4198 int totalprims = m_host.ParentGroup.PrimCount + nametable.Count; 4201 if (linknum < 0)
4199 if (totalprims > m_host.ParentGroup.PrimCount)
4200 { 4202 {
4201 // sitting Avatar-Name with negativ linknum / SinglePrim 4203 if (linknum == ScriptBaseClass.LINK_THIS)
4202 if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4203 return nametable[0];
4204 // Prim-Name / SinglePrim Sitting Avatar
4205 if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4206 return m_host.Name; 4204 return m_host.Name;
4207 // LinkNumber > of Real PrimSet = AvatarName 4205 else
4208 if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) 4206 return ScriptBaseClass.NULL_KEY;
4209 return nametable[totalprims - linknum];
4210 } 4207 }
4211 4208
4212 // Single prim 4209 int actualPrimCount = m_host.ParentGroup.PrimCount;
4213 if (m_host.LinkNum == 0) 4210 List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
4211 int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
4212
4213 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
4214 // prim that has any avatars sat upon it (in which case the root prim is link 1).
4215 if (linknum == 0)
4214 { 4216 {
4215 if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT) 4217 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
4216 return m_host.Name; 4218 return m_host.Name;
4217 else
4218 return UUID.Zero.ToString();
4219 }
4220 4219
4221 // Link set 4220 return ScriptBaseClass.NULL_KEY;
4222 SceneObjectPart part = null; 4221 }
4223 if (m_host.LinkNum == 1) // this is the Root prim 4222 // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
4223 // here we must match 1 (ScriptBaseClass.LINK_ROOT).
4224 else if (linknum == 1 && actualPrimCount == 1)
4224 { 4225 {
4225 if (linknum < 0) 4226 if (sittingAvatarIds.Count > 0)
4226 part = m_host.ParentGroup.GetLinkNumPart(2); 4227 return m_host.ParentGroup.RootPart.Name;
4227 else 4228 else
4228 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4229 return ScriptBaseClass.NULL_KEY;
4229 } 4230 }
4230 else // this is a child prim 4231 else if (linknum <= adjustedPrimCount)
4231 { 4232 {
4232 if (linknum < 2) 4233 if (linknum <= actualPrimCount)
4233 part = m_host.ParentGroup.GetLinkNumPart(1); 4234 {
4235 return m_host.ParentGroup.GetLinkNumPart(linknum).Name;
4236 }
4234 else 4237 else
4235 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4238 {
4239 ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]);
4240 if (sp != null)
4241 return sp.Name;
4242 else
4243 return ScriptBaseClass.NULL_KEY;
4244 }
4236 } 4245 }
4237 if (part != null)
4238 return part.Name;
4239 else 4246 else
4240 return UUID.Zero.ToString(); 4247 {
4248 return ScriptBaseClass.NULL_KEY;
4249 }
4241 } 4250 }
4242 4251
4243 public LSL_Integer llGetInventoryNumber(int type) 4252 public LSL_Integer llGetInventoryNumber(int type)
@@ -5850,9 +5859,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5850 } 5859 }
5851 5860
5852 /// <summary> 5861 /// <summary>
5853 /// Insert the list identified by <src> into the 5862 /// Insert the list identified by <paramref name="src"/> into the
5854 /// list designated by <dest> such that the first 5863 /// list designated by <paramref name="dest"/> such that the first
5855 /// new element has the index specified by <index> 5864 /// new element has the index specified by <paramref name="index"/>
5856 /// </summary> 5865 /// </summary>
5857 5866
5858 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index) 5867 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
@@ -6218,13 +6227,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6218 if (parcelOwned && land.LandData.OwnerID == id || 6227 if (parcelOwned && land.LandData.OwnerID == id ||
6219 parcel && land.LandData.GlobalID == id) 6228 parcel && land.LandData.GlobalID == id)
6220 { 6229 {
6221 result.Add(ssp.UUID.ToString()); 6230 result.Add(new LSL_Key(ssp.UUID.ToString()));
6222 } 6231 }
6223 } 6232 }
6224 } 6233 }
6225 else 6234 else
6226 { 6235 {
6227 result.Add(ssp.UUID.ToString()); 6236 result.Add(new LSL_Key(ssp.UUID.ToString()));
6228 } 6237 }
6229 } 6238 }
6230 // Maximum of 100 results 6239 // Maximum of 100 results
@@ -6685,6 +6694,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6685 ps.BurstSpeedMax = 1.0f; 6694 ps.BurstSpeedMax = 1.0f;
6686 ps.BurstRate = 0.1f; 6695 ps.BurstRate = 0.1f;
6687 ps.PartMaxAge = 10.0f; 6696 ps.PartMaxAge = 10.0f;
6697 ps.BurstPartCount = 1;
6688 return ps; 6698 return ps;
6689 } 6699 }
6690 6700
@@ -6706,10 +6716,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6706 SetParticleSystem(m_host, rules); 6716 SetParticleSystem(m_host, rules);
6707 } 6717 }
6708 6718
6709 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) 6719 private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
6710 { 6720 {
6711
6712
6713 if (rules.Length == 0) 6721 if (rules.Length == 0)
6714 { 6722 {
6715 part.RemoveParticleSystem(); 6723 part.RemoveParticleSystem();
@@ -7369,6 +7377,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7369 public void llCloseRemoteDataChannel(string channel) 7377 public void llCloseRemoteDataChannel(string channel)
7370 { 7378 {
7371 m_host.AddScriptLPS(1); 7379 m_host.AddScriptLPS(1);
7380
7381 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
7382 if (xmlRpcRouter != null)
7383 {
7384 xmlRpcRouter.UnRegisterReceiver(channel, m_item.ItemID);
7385 }
7386
7372 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 7387 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7373 if (xmlrpcMod != null) 7388 if (xmlrpcMod != null)
7374 xmlrpcMod.CloseXMLRPCChannel((UUID)channel); 7389 xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
@@ -11515,6 +11530,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11515 case ScriptBaseClass.OBJECT_PHYSICS_COST: 11530 case ScriptBaseClass.OBJECT_PHYSICS_COST:
11516 ret.Add(new LSL_Float(0)); 11531 ret.Add(new LSL_Float(0));
11517 break; 11532 break;
11533 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
11534 ret.Add(new LSL_Float(0));
11535 break;
11536 case ScriptBaseClass.OBJECT_ROOT:
11537 SceneObjectPart p = av.ParentPart;
11538 if (p != null)
11539 {
11540 ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString()));
11541 }
11542 else
11543 {
11544 ret.Add(new LSL_String(id));
11545 }
11546 break;
11547 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
11548 ret.Add(new LSL_Integer(0));
11549 break;
11550 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding
11551 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR));
11552 break;
11553 case ScriptBaseClass.OBJECT_PHYSICS:
11554 ret.Add(new LSL_Integer(0));
11555 break;
11556 case ScriptBaseClass.OBJECT_PHANTOM:
11557 ret.Add(new LSL_Integer(0));
11558 break;
11559 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11560 ret.Add(new LSL_Integer(0));
11561 break;
11518 default: 11562 default:
11519 // Invalid or unhandled constant. 11563 // Invalid or unhandled constant.
11520 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 11564 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -11606,6 +11650,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11606 // The value returned in SL for normal prims is prim count 11650 // The value returned in SL for normal prims is prim count
11607 ret.Add(new LSL_Float(obj.PhysicsCost)); 11651 ret.Add(new LSL_Float(obj.PhysicsCost));
11608 break; 11652 break;
11653 case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
11654 ret.Add(new LSL_Float(0));
11655 break;
11656 case ScriptBaseClass.OBJECT_ROOT:
11657 ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString()));
11658 break;
11659 case ScriptBaseClass.OBJECT_ATTACHED_POINT:
11660 ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint));
11661 break;
11662 case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
11663 byte pcode = obj.Shape.PCode;
11664 if (obj.ParentGroup.AttachmentPoint != 0
11665 || pcode == (byte)PCode.Grass
11666 || pcode == (byte)PCode.Tree
11667 || pcode == (byte)PCode.NewTree)
11668 {
11669 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER));
11670 }
11671 else
11672 {
11673 ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET));
11674 }
11675 break;
11676 case ScriptBaseClass.OBJECT_PHYSICS:
11677 if (obj.ParentGroup.AttachmentPoint != 0)
11678 {
11679 ret.Add(new LSL_Integer(0)); // Always false if attached
11680 }
11681 else
11682 {
11683 ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
11684 }
11685 break;
11686 case ScriptBaseClass.OBJECT_PHANTOM:
11687 if (obj.ParentGroup.AttachmentPoint != 0)
11688 {
11689 ret.Add(new LSL_Integer(0)); // Always false if attached
11690 }
11691 else
11692 {
11693 ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
11694 }
11695 break;
11696 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11697 ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
11698 break;
11609 default: 11699 default:
11610 // Invalid or unhandled constant. 11700 // Invalid or unhandled constant.
11611 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 11701 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -13257,7 +13347,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13257 /// Get a notecard line. 13347 /// Get a notecard line.
13258 /// </summary> 13348 /// </summary>
13259 /// <param name="assetID"></param> 13349 /// <param name="assetID"></param>
13260 /// <param name="line">Lines start at index 0</param> 13350 /// <param name="lineNumber">Lines start at index 0</param>
13261 /// <returns></returns> 13351 /// <returns></returns>
13262 public static string GetLine(UUID assetID, int lineNumber) 13352 public static string GetLine(UUID assetID, int lineNumber)
13263 { 13353 {
@@ -13286,9 +13376,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13286 /// Get a notecard line. 13376 /// Get a notecard line.
13287 /// </summary> 13377 /// </summary>
13288 /// <param name="assetID"></param> 13378 /// <param name="assetID"></param>
13289 /// <param name="line">Lines start at index 0</param> 13379 /// <param name="lineNumber">Lines start at index 0</param>
13290 /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> 13380 /// <param name="maxLength">
13291 /// <returns></returns> 13381 /// Maximum length of the returned line.
13382 /// </param>
13383 /// <returns>
13384 /// If the line length is longer than <paramref name="maxLength"/>,
13385 /// the return string will be truncated.
13386 /// </returns>
13292 public static string GetLine(UUID assetID, int lineNumber, int maxLength) 13387 public static string GetLine(UUID assetID, int lineNumber, int maxLength)
13293 { 13388 {
13294 string line = GetLine(assetID, lineNumber); 13389 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..a08ccc8 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, EventWaitHandle 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..981499e 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, EventWaitHandle 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..10ec34d 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, EventWaitHandle 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();