aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs53
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs117
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs249
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs37
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs9
8 files changed, 438 insertions, 73 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index 14edde4..993d10f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -247,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
247 247
248 // Remove Sensors 248 // Remove Sensors
249 m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); 249 m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
250 }
251
252 /// <summary>
253 /// Get the sensor repeat plugin for this script engine.
254 /// </summary>
255 /// <param name="engine"></param>
256 /// <returns></returns>
257 public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine)
258 {
259 if (m_SensorRepeat.ContainsKey(engine))
260 return m_SensorRepeat[engine];
261 else
262 return null;
263 }
250 264
265 /// <summary>
266 /// Get the dataserver plugin for this script engine.
267 /// </summary>
268 /// <param name="engine"></param>
269 /// <returns></returns>
270 public static Dataserver GetDataserverPlugin(IScriptEngine engine)
271 {
272 if (m_Dataserver.ContainsKey(engine))
273 return m_Dataserver[engine];
274 else
275 return null;
276 }
277
278 /// <summary>
279 /// Get the timer plugin for this script engine.
280 /// </summary>
281 /// <param name="engine"></param>
282 /// <returns></returns>
283 public static Timer GetTimerPlugin(IScriptEngine engine)
284 {
285 if (m_Timer.ContainsKey(engine))
286 return m_Timer[engine];
287 else
288 return null;
289 }
290
291 /// <summary>
292 /// Get the listener plugin for this script engine.
293 /// </summary>
294 /// <param name="engine"></param>
295 /// <returns></returns>
296 public static Listener GetListenerPlugin(IScriptEngine engine)
297 {
298 if (m_Listener.ContainsKey(engine))
299 return m_Listener[engine];
300 else
301 return null;
251 } 302 }
252 303
253 public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) 304 public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID)
@@ -270,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
270 data.AddRange(timers); 321 data.AddRange(timers);
271 } 322 }
272 323
273 Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID); 324 Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID);
274 if (sensors.Length > 0) 325 if (sensors.Length > 0)
275 { 326 {
276 data.Add("sensor"); 327 data.Add("sensor");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0003515..d7a629b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2771,64 +2771,69 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2771 { 2771 {
2772 m_host.AddScriptLPS(1); 2772 m_host.AddScriptLPS(1);
2773 2773
2774 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s)) 2774 Util.FireAndForget(delegate (object x)
2775 return; 2775 {
2776 float dist = (float)llVecDist(llGetPos(), pos); 2776 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
2777 return;
2778 float dist = (float)llVecDist(llGetPos(), pos);
2777 2779
2778 if (dist > m_ScriptDistanceFactor * 10.0f) 2780 if (dist > m_ScriptDistanceFactor * 10.0f)
2779 return; 2781 return;
2780 2782
2781 TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 2783 //Clone is thread-safe
2784 TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
2782 2785
2783 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) 2786 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
2784 {
2785 if (inv.Value.Name == inventory)
2786 { 2787 {
2787 // make sure we're an object. 2788 if (inv.Value.Name == inventory)
2788 if (inv.Value.InvType != (int)InventoryType.Object)
2789 { 2789 {
2790 llSay(0, "Unable to create requested object. Object is missing from database."); 2790 // make sure we're an object.
2791 return; 2791 if (inv.Value.InvType != (int)InventoryType.Object)
2792 } 2792 {
2793 llSay(0, "Unable to create requested object. Object is missing from database.");
2794 return;
2795 }
2793 2796
2794 Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); 2797 Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
2795 Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); 2798 Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
2796 2799
2797 // need the magnitude later 2800 // need the magnitude later
2798 float velmag = (float)Util.GetMagnitude(llvel); 2801 // float velmag = (float)Util.GetMagnitude(llvel);
2799 2802
2800 SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param); 2803 SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param);
2801 2804
2802 // If either of these are null, then there was an unknown error. 2805 // If either of these are null, then there was an unknown error.
2803 if (new_group == null) 2806 if (new_group == null)
2804 continue; 2807 continue;
2805 2808
2806 // objects rezzed with this method are die_at_edge by default. 2809 // objects rezzed with this method are die_at_edge by default.
2807 new_group.RootPart.SetDieAtEdge(true); 2810 new_group.RootPart.SetDieAtEdge(true);
2808 2811
2809 new_group.ResumeScripts(); 2812 new_group.ResumeScripts();
2810 2813
2811 m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( 2814 m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
2812 "object_rez", new Object[] { 2815 "object_rez", new Object[] {
2813 new LSL_String( 2816 new LSL_String(
2814 new_group.RootPart.UUID.ToString()) }, 2817 new_group.RootPart.UUID.ToString()) },
2815 new DetectParams[0])); 2818 new DetectParams[0]));
2816 2819
2817 float groupmass = new_group.GetMass(); 2820 float groupmass = new_group.GetMass();
2818 2821
2819 if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero) 2822 if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero)
2820 { 2823 {
2821 //Recoil. 2824 //Recoil.
2822 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); 2825 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
2826 }
2827 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2828 return;
2823 } 2829 }
2824 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2825 ScriptSleep((int)((groupmass * velmag) / 10));
2826 ScriptSleep(100);
2827 return;
2828 } 2830 }
2829 }
2830 2831
2831 llSay(0, "Could not find object " + inventory); 2832 llSay(0, "Could not find object " + inventory);
2833 });
2834
2835 //ScriptSleep((int)((groupmass * velmag) / 10));
2836 ScriptSleep(100);
2832 } 2837 }
2833 2838
2834 public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) 2839 public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
@@ -3820,7 +3825,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3820 List<String> nametable = new List<String>(); 3825 List<String> nametable = new List<String>();
3821 World.ForEachRootScenePresence(delegate(ScenePresence presence) 3826 World.ForEachRootScenePresence(delegate(ScenePresence presence)
3822 { 3827 {
3823 if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) 3828 SceneObjectPart sitPart = presence.ParentPart;
3829 if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId))
3824 nametable.Add(presence.ControllingClient.Name); 3830 nametable.Add(presence.ControllingClient.Name);
3825 }); 3831 });
3826 3832
@@ -4308,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4308 4314
4309 if (m_host.RegionHandle == presence.RegionHandle) 4315 if (m_host.RegionHandle == presence.RegionHandle)
4310 { 4316 {
4311 Dictionary<UUID, string> animationstateNames = AnimationSet.Animations.AnimStateNames; 4317 Dictionary<UUID, string> animationstateNames = DefaultAvatarAnimations.AnimStateNames;
4312 4318
4313 if (presence != null) 4319 if (presence != null)
4314 { 4320 {
@@ -4388,22 +4394,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4388 4394
4389 // Find pushee position 4395 // Find pushee position
4390 // Pushee Linked? 4396 // Pushee Linked?
4391 if (pusheeav.ParentID != 0) 4397 SceneObjectPart sitPart = pusheeav.ParentPart;
4392 { 4398 if (sitPart != null)
4393 SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID); 4399 PusheePos = sitPart.AbsolutePosition;
4394 if (parentobj != null)
4395 {
4396 PusheePos = parentobj.AbsolutePosition;
4397 }
4398 else
4399 {
4400 PusheePos = pusheeav.AbsolutePosition;
4401 }
4402 }
4403 else 4400 else
4404 {
4405 PusheePos = pusheeav.AbsolutePosition; 4401 PusheePos = pusheeav.AbsolutePosition;
4406 }
4407 } 4402 }
4408 4403
4409 if (!pusheeIsAvatar) 4404 if (!pusheeIsAvatar)
@@ -5598,14 +5593,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5598 flags |= ScriptBaseClass.AGENT_IN_AIR; 5593 flags |= ScriptBaseClass.AGENT_IN_AIR;
5599 } 5594 }
5600 5595
5601 if (agent.ParentID != 0) 5596 if (agent.ParentPart != null)
5602 { 5597 {
5603 flags |= ScriptBaseClass.AGENT_ON_OBJECT; 5598 flags |= ScriptBaseClass.AGENT_ON_OBJECT;
5604 flags |= ScriptBaseClass.AGENT_SITTING; 5599 flags |= ScriptBaseClass.AGENT_SITTING;
5605 } 5600 }
5606 5601
5607 if (agent.Animator.Animations.DefaultAnimation.AnimID 5602 if (agent.Animator.Animations.DefaultAnimation.AnimID
5608 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 5603 == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
5609 { 5604 {
5610 flags |= ScriptBaseClass.AGENT_SITTING; 5605 flags |= ScriptBaseClass.AGENT_SITTING;
5611 } 5606 }
@@ -7687,7 +7682,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7687 World.ForEachRootScenePresence(delegate(ScenePresence presence) 7682 World.ForEachRootScenePresence(delegate(ScenePresence presence)
7688 { 7683 {
7689 if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) 7684 if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
7690 avatarCount++; 7685 avatarCount++;
7691 }); 7686 });
7692 7687
7693 return m_host.ParentGroup.PrimCount + avatarCount; 7688 return m_host.ParentGroup.PrimCount + avatarCount;
@@ -7719,7 +7714,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7719 LSL_Vector lower; 7714 LSL_Vector lower;
7720 LSL_Vector upper; 7715 LSL_Vector upper;
7721 if (presence.Animator.Animations.DefaultAnimation.AnimID 7716 if (presence.Animator.Animations.DefaultAnimation.AnimID
7722 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 7717 == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
7723 { 7718 {
7724 // This is for ground sitting avatars 7719 // This is for ground sitting avatars
7725 float height = presence.Appearance.AvatarHeight / 2.66666667f; 7720 float height = presence.Appearance.AvatarHeight / 2.66666667f;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index d4facdd..7c07e15 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -116,6 +116,159 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
116 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); 116 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
117 } 117 }
118 118
119 /// <summary>
120 ///
121 /// </summary>
122 /// <param name="fname">The name of the function to invoke</param>
123 /// <param name="parms">List of parameters</param>
124 /// <returns>string result of the invocation</returns>
125 public void modInvokeN(string fname, params object[] parms)
126 {
127 Type returntype = m_comms.LookupReturnType(fname);
128 if (returntype != typeof(string))
129 MODError(String.Format("return type mismatch for {0}",fname));
130
131 modInvoke(fname,parms);
132 }
133
134 public LSL_String modInvokeS(string fname, params object[] parms)
135 {
136 Type returntype = m_comms.LookupReturnType(fname);
137 if (returntype != typeof(string))
138 MODError(String.Format("return type mismatch for {0}",fname));
139
140 string result = (string)modInvoke(fname,parms);
141 return new LSL_String(result);
142 }
143
144 public LSL_Integer modInvokeI(string fname, params object[] parms)
145 {
146 Type returntype = m_comms.LookupReturnType(fname);
147 if (returntype != typeof(int))
148 MODError(String.Format("return type mismatch for {0}",fname));
149
150 int result = (int)modInvoke(fname,parms);
151 return new LSL_Integer(result);
152 }
153
154 public LSL_Float modInvokeF(string fname, params object[] parms)
155 {
156 Type returntype = m_comms.LookupReturnType(fname);
157 if (returntype != typeof(float))
158 MODError(String.Format("return type mismatch for {0}",fname));
159
160 float result = (float)modInvoke(fname,parms);
161 return new LSL_Float(result);
162 }
163
164 public LSL_Key modInvokeK(string fname, params object[] parms)
165 {
166 Type returntype = m_comms.LookupReturnType(fname);
167 if (returntype != typeof(UUID))
168 MODError(String.Format("return type mismatch for {0}",fname));
169
170 UUID result = (UUID)modInvoke(fname,parms);
171 return new LSL_Key(result.ToString());
172 }
173
174 public LSL_Vector modInvokeV(string fname, params object[] parms)
175 {
176 Type returntype = m_comms.LookupReturnType(fname);
177 if (returntype != typeof(OpenMetaverse.Vector3))
178 MODError(String.Format("return type mismatch for {0}",fname));
179
180 OpenMetaverse.Vector3 result = (OpenMetaverse.Vector3)modInvoke(fname,parms);
181 return new LSL_Vector(result.X,result.Y,result.Z);
182 }
183
184 public LSL_Rotation modInvokeR(string fname, params object[] parms)
185 {
186 Type returntype = m_comms.LookupReturnType(fname);
187 if (returntype != typeof(OpenMetaverse.Quaternion))
188 MODError(String.Format("return type mismatch for {0}",fname));
189
190 OpenMetaverse.Quaternion result = (OpenMetaverse.Quaternion)modInvoke(fname,parms);
191 return new LSL_Rotation(result.X,result.Y,result.Z,result.W);
192 }
193
194 public LSL_List modInvokeL(string fname, params object[] parms)
195 {
196 Type returntype = m_comms.LookupReturnType(fname);
197 if (returntype != typeof(object[]))
198 MODError(String.Format("return type mismatch for {0}",fname));
199
200 object[] result = (object[])modInvoke(fname,parms);
201 object[] llist = new object[result.Length];
202 for (int i = 0; i < result.Length; i++)
203 {
204 if (result[i] is string)
205 llist[i] = new LSL_String((string)result[i]);
206 else if (result[i] is int)
207 llist[i] = new LSL_Integer((int)result[i]);
208 else if (result[i] is float)
209 llist[i] = new LSL_Float((float)result[i]);
210 else if (result[i] is OpenMetaverse.Vector3)
211 {
212 OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i];
213 llist[i] = new LSL_Vector(vresult.X,vresult.Y,vresult.Z);
214 }
215 else if (result[i] is OpenMetaverse.Quaternion)
216 {
217 OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i];
218 llist[i] = new LSL_Rotation(qresult.X,qresult.Y,qresult.Z,qresult.W);
219 }
220 else
221 {
222 MODError(String.Format("unknown list element returned by {0}",fname));
223 }
224 }
225
226 return new LSL_List(llist);
227 }
228
229 /// <summary>
230 /// Invokes a preregistered function through the ScriptModuleComms class
231 /// </summary>
232 /// <param name="fname">The name of the function to invoke</param>
233 /// <param name="fname">List of parameters</param>
234 /// <returns>string result of the invocation</returns>
235 protected object modInvoke(string fname, params object[] parms)
236 {
237 if (!m_MODFunctionsEnabled)
238 {
239 MODShoutError("Module command functions not enabled");
240 return "";
241 }
242
243 Type[] signature = m_comms.LookupTypeSignature(fname);
244 if (signature.Length != parms.Length)
245 MODError(String.Format("wrong number of parameters to function {0}",fname));
246
247 object[] convertedParms = new object[parms.Length];
248 for (int i = 0; i < parms.Length; i++)
249 convertedParms[i] = ConvertFromLSL(parms[i],signature[i]);
250
251 // now call the function, the contract with the function is that it will always return
252 // non-null but don't trust it completely
253 try
254 {
255 object result = m_comms.InvokeOperation(m_host.UUID, m_itemID, fname, convertedParms);
256 if (result != null)
257 return result;
258
259 MODError(String.Format("Invocation of {0} failed; null return value",fname));
260 }
261 catch (Exception e)
262 {
263 MODError(String.Format("Invocation of {0} failed; {1}",fname,e.Message));
264 }
265
266 return null;
267 }
268
269 /// <summary>
270 /// Send a command to functions registered on an event
271 /// </summary>
119 public string modSendCommand(string module, string command, string k) 272 public string modSendCommand(string module, string command, string k)
120 { 273 {
121 if (!m_MODFunctionsEnabled) 274 if (!m_MODFunctionsEnabled)
@@ -130,5 +283,101 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
130 283
131 return req.ToString(); 284 return req.ToString();
132 } 285 }
286
287 /// <summary>
288 /// </summary>
289 protected object ConvertFromLSL(object lslparm, Type type)
290 {
291 // ---------- String ----------
292 if (lslparm is LSL_String)
293 {
294 if (type == typeof(string))
295 return (string)(LSL_String)lslparm;
296
297 // Need to check for UUID since keys are often treated as strings
298 if (type == typeof(UUID))
299 return new UUID((string)(LSL_String)lslparm);
300 }
301
302 // ---------- Integer ----------
303 else if (lslparm is LSL_Integer)
304 {
305 if (type == typeof(int))
306 return (int)(LSL_Integer)lslparm;
307 }
308
309 // ---------- Float ----------
310 else if (lslparm is LSL_Float)
311 {
312 if (type == typeof(float))
313 return (float)(LSL_Float)lslparm;
314 }
315
316 // ---------- Key ----------
317 else if (lslparm is LSL_Key)
318 {
319 if (type == typeof(UUID))
320 return new UUID((LSL_Key)lslparm);
321 }
322
323 // ---------- Rotation ----------
324 else if (lslparm is LSL_Rotation)
325 {
326 if (type == typeof(OpenMetaverse.Quaternion))
327 {
328 LSL_Rotation rot = (LSL_Rotation)lslparm;
329 return new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s);
330 }
331 }
332
333 // ---------- Vector ----------
334 else if (lslparm is LSL_Vector)
335 {
336 if (type == typeof(OpenMetaverse.Vector3))
337 {
338 LSL_Vector vect = (LSL_Vector)lslparm;
339 return new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z);
340 }
341 }
342
343 // ---------- List ----------
344 else if (lslparm is LSL_List)
345 {
346 if (type == typeof(object[]))
347 {
348 object[] plist = (lslparm as LSL_List).Data;
349 object[] result = new object[plist.Length];
350 for (int i = 0; i < plist.Length; i++)
351 {
352 if (plist[i] is LSL_String)
353 result[i] = (string)(LSL_String)plist[i];
354 else if (plist[i] is LSL_Integer)
355 result[i] = (int)(LSL_Integer)plist[i];
356 else if (plist[i] is LSL_Float)
357 result[i] = (float)(LSL_Float)plist[i];
358 else if (plist[i] is LSL_Key)
359 result[i] = new UUID((LSL_Key)plist[i]);
360 else if (plist[i] is LSL_Rotation)
361 {
362 LSL_Rotation rot = (LSL_Rotation)plist[i];
363 result[i] = new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s);
364 }
365 else if (plist[i] is LSL_Vector)
366 {
367 LSL_Vector vect = (LSL_Vector)plist[i];
368 result[i] = new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z);
369 }
370 else
371 MODError("unknown LSL list element type");
372 }
373
374 return result;
375 }
376 }
377
378 MODError(String.Format("parameter type mismatch; expecting {0}",type.Name));
379 return null;
380 }
381
133 } 382 }
134} 383}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8edd146..2ecd890 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2093,6 +2093,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2093 return HomeURI; 2093 return HomeURI;
2094 } 2094 }
2095 2095
2096 public string osGetGridGatekeeperURI()
2097 {
2098 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI");
2099 m_host.AddScriptLPS(1);
2100
2101 string gatekeeperURI = String.Empty;
2102 IConfigSource config = m_ScriptEngine.ConfigSource;
2103
2104 if (config.Configs["GridService"] != null)
2105 gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI);
2106
2107 return gatekeeperURI;
2108 }
2109
2096 public string osGetGridCustom(string key) 2110 public string osGetGridCustom(string key)
2097 { 2111 {
2098 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); 2112 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom");
@@ -2943,5 +2957,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2943 2957
2944 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); 2958 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
2945 } 2959 }
2960
2961 /// <summary>
2962 /// Get the description from an inventory item
2963 /// </summary>
2964 /// <param name="inventoryName"></param>
2965 /// <returns>Item description</returns>
2966 public LSL_String osGetInventoryDesc(string item)
2967 {
2968 m_host.AddScriptLPS(1);
2969
2970 lock (m_host.TaskInventory)
2971 {
2972 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
2973 {
2974 if (inv.Value.Name == item)
2975 {
2976 return inv.Value.Description.ToString();
2977 }
2978 }
2979 }
2980
2981 return String.Empty;
2982 }
2946 } 2983 }
2947} \ No newline at end of file 2984} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs
index 7fa19b1..9f78a49 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs
@@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
38 { 38 {
39 public AsyncCommandManager m_CmdManager; 39 public AsyncCommandManager m_CmdManager;
40 40
41 public int DataserverRequestsCount
42 {
43 get
44 {
45 lock (DataserverRequests)
46 return DataserverRequests.Count;
47 }
48 }
49
41 private Dictionary<string, DataserverRequest> DataserverRequests = 50 private Dictionary<string, DataserverRequest> DataserverRequests =
42 new Dictionary<string, DataserverRequest>(); 51 new Dictionary<string, DataserverRequest>();
43 52
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
index 740816f..93e0261 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
@@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
42 42
43 public AsyncCommandManager m_CmdManager; 43 public AsyncCommandManager m_CmdManager;
44 44
45 private IWorldComm m_commsPlugin;
46
47 public int ListenerCount
48 {
49 get { return m_commsPlugin.ListenerCount; }
50 }
51
45 public Listener(AsyncCommandManager CmdManager) 52 public Listener(AsyncCommandManager CmdManager)
46 { 53 {
47 m_CmdManager = CmdManager; 54 m_CmdManager = CmdManager;
55 m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
48 } 56 }
49 57
50 public void CheckListeners() 58 public void CheckListeners()
51 { 59 {
52 if (m_CmdManager.m_ScriptEngine.World == null) 60 if (m_CmdManager.m_ScriptEngine.World == null)
53 return; 61 return;
54 IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
55 62
56 if (comms != null) 63 if (m_commsPlugin != null)
57 { 64 {
58 while (comms.HasMessages()) 65 while (m_commsPlugin.HasMessages())
59 { 66 {
60 ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage(); 67 ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage();
61 68
62 //Deliver data to prim's listen handler 69 //Deliver data to prim's listen handler
63 object[] resobj = new object[] 70 object[] resobj = new object[]
@@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
81 88
82 public Object[] GetSerializationData(UUID itemID) 89 public Object[] GetSerializationData(UUID itemID)
83 { 90 {
84 IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 91 return m_commsPlugin.GetSerializationData(itemID);
85
86 return comms.GetSerializationData(itemID);
87 } 92 }
88 93
89 public void CreateFromData(uint localID, UUID itemID, UUID hostID, 94 public void CreateFromData(uint localID, UUID itemID, UUID hostID,
90 Object[] data) 95 Object[] data)
91 { 96 {
92 IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 97 m_commsPlugin.CreateFromData(localID, itemID, hostID, data);
93
94 comms.CreateFromData(localID, itemID, hostID, data);
95 } 98 }
96 } 99 }
97} 100} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index fbb7c39..1c272f8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
44 44
45 public AsyncCommandManager m_CmdManager; 45 public AsyncCommandManager m_CmdManager;
46 46
47 /// <summary>
48 /// Number of sensors active.
49 /// </summary>
50 public int SensorsCount
51 {
52 get
53 {
54 lock (SenseRepeatListLock)
55 return SenseRepeaters.Count;
56 }
57 }
58
47 public SensorRepeat(AsyncCommandManager CmdManager) 59 public SensorRepeat(AsyncCommandManager CmdManager)
48 { 60 {
49 m_CmdManager = CmdManager; 61 m_CmdManager = CmdManager;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
index eeb59d9..bc63030 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
@@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
37 { 37 {
38 public AsyncCommandManager m_CmdManager; 38 public AsyncCommandManager m_CmdManager;
39 39
40 public int TimersCount
41 {
42 get
43 {
44 lock (TimerListLock)
45 return Timers.Count;
46 }
47 }
48
40 public Timer(AsyncCommandManager CmdManager) 49 public Timer(AsyncCommandManager CmdManager)
41 { 50 {
42 m_CmdManager = CmdManager; 51 m_CmdManager = CmdManager;