diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
7 files changed, 257 insertions, 68 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 61e4934..3cbdde5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | |||
@@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
137 | if (cmdHandlerThread == null) | 137 | if (cmdHandlerThread == null) |
138 | { | 138 | { |
139 | // Start the thread that will be doing the work | 139 | // Start the thread that will be doing the work |
140 | cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true); | 140 | cmdHandlerThread |
141 | = Watchdog.StartThread( | ||
142 | CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true); | ||
141 | } | 143 | } |
142 | } | 144 | } |
143 | 145 | ||
@@ -245,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
245 | 247 | ||
246 | // Remove Sensors | 248 | // Remove Sensors |
247 | 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 | } | ||
248 | 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; | ||
249 | } | 302 | } |
250 | 303 | ||
251 | public static void StateChange(IScriptEngine engine, uint localID, UUID itemID) | 304 | public static void StateChange(IScriptEngine engine, uint localID, UUID itemID) |
@@ -288,7 +341,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
288 | data.AddRange(timers); | 341 | data.AddRange(timers); |
289 | } | 342 | } |
290 | 343 | ||
291 | Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID); | 344 | Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID); |
292 | if (sensors.Length > 0) | 345 | if (sensors.Length > 0) |
293 | { | 346 | { |
294 | data.Add("sensor"); | 347 | 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 0cc8829..e2d17a7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4213,7 +4213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4213 | List<String> nametable = new List<String>(); | 4213 | List<String> nametable = new List<String>(); |
4214 | World.ForEachRootScenePresence(delegate(ScenePresence presence) | 4214 | World.ForEachRootScenePresence(delegate(ScenePresence presence) |
4215 | { | 4215 | { |
4216 | if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) | 4216 | SceneObjectPart sitPart = presence.ParentPart; |
4217 | if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId)) | ||
4217 | nametable.Add(presence.ControllingClient.Name); | 4218 | nametable.Add(presence.ControllingClient.Name); |
4218 | }); | 4219 | }); |
4219 | 4220 | ||
@@ -4450,7 +4451,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4450 | Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), | 4451 | Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), |
4451 | Util.Clip((float)color.y, 0.0f, 1.0f), | 4452 | Util.Clip((float)color.y, 0.0f, 1.0f), |
4452 | Util.Clip((float)color.z, 0.0f, 1.0f)); | 4453 | Util.Clip((float)color.z, 0.0f, 1.0f)); |
4453 | m_host.SetText(text.Length > 254 ? text.Remove(255) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); | 4454 | m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); |
4454 | //m_host.ParentGroup.HasGroupChanged = true; | 4455 | //m_host.ParentGroup.HasGroupChanged = true; |
4455 | //m_host.ParentGroup.ScheduleGroupForFullUpdate(); | 4456 | //m_host.ParentGroup.ScheduleGroupForFullUpdate(); |
4456 | } | 4457 | } |
@@ -4844,22 +4845,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4844 | 4845 | ||
4845 | // Find pushee position | 4846 | // Find pushee position |
4846 | // Pushee Linked? | 4847 | // Pushee Linked? |
4847 | if (pusheeav.ParentID != 0) | 4848 | SceneObjectPart sitPart = pusheeav.ParentPart; |
4848 | { | 4849 | if (sitPart != null) |
4849 | SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID); | 4850 | PusheePos = sitPart.AbsolutePosition; |
4850 | if (parentobj != null) | ||
4851 | { | ||
4852 | PusheePos = parentobj.AbsolutePosition; | ||
4853 | } | ||
4854 | else | ||
4855 | { | ||
4856 | PusheePos = pusheeav.AbsolutePosition; | ||
4857 | } | ||
4858 | } | ||
4859 | else | 4851 | else |
4860 | { | ||
4861 | PusheePos = pusheeav.AbsolutePosition; | 4852 | PusheePos = pusheeav.AbsolutePosition; |
4862 | } | ||
4863 | } | 4853 | } |
4864 | 4854 | ||
4865 | if (!pusheeIsAvatar) | 4855 | if (!pusheeIsAvatar) |
@@ -6067,7 +6057,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6067 | flags |= ScriptBaseClass.AGENT_IN_AIR; | 6057 | flags |= ScriptBaseClass.AGENT_IN_AIR; |
6068 | } | 6058 | } |
6069 | 6059 | ||
6070 | if (agent.ParentID != 0) | 6060 | if (agent.ParentPart != null) |
6071 | { | 6061 | { |
6072 | flags |= ScriptBaseClass.AGENT_ON_OBJECT; | 6062 | flags |= ScriptBaseClass.AGENT_ON_OBJECT; |
6073 | flags |= ScriptBaseClass.AGENT_SITTING; | 6063 | flags |= ScriptBaseClass.AGENT_SITTING; |
@@ -6866,16 +6856,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6866 | } | 6856 | } |
6867 | } | 6857 | } |
6868 | 6858 | ||
6869 | public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) | 6859 | protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot) |
6870 | { | 6860 | { |
6871 | m_host.AddScriptLPS(1); | ||
6872 | // LSL quaternions can normalize to 0, normal Quaternions can't. | 6861 | // LSL quaternions can normalize to 0, normal Quaternions can't. |
6873 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) | 6862 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) |
6874 | rot.z = 1; // ZERO_ROTATION = 0,0,0,1 | 6863 | rot.z = 1; // ZERO_ROTATION = 0,0,0,1 |
6875 | 6864 | ||
6876 | m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); | 6865 | part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); |
6877 | m_host.SitTargetOrientation = Rot2Quaternion(rot); | 6866 | part.SitTargetOrientation = Rot2Quaternion(rot); |
6878 | m_host.ParentGroup.HasGroupChanged = true; | 6867 | part.ParentGroup.HasGroupChanged = true; |
6868 | } | ||
6869 | |||
6870 | public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) | ||
6871 | { | ||
6872 | m_host.AddScriptLPS(1); | ||
6873 | SitTarget(m_host, offset, rot); | ||
6874 | } | ||
6875 | |||
6876 | public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) | ||
6877 | { | ||
6878 | m_host.AddScriptLPS(1); | ||
6879 | if (link == ScriptBaseClass.LINK_ROOT) | ||
6880 | SitTarget(m_host.ParentGroup.RootPart, offset, rot); | ||
6881 | else if (link == ScriptBaseClass.LINK_THIS) | ||
6882 | SitTarget(m_host, offset, rot); | ||
6883 | else | ||
6884 | { | ||
6885 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
6886 | if (null != part) | ||
6887 | { | ||
6888 | SitTarget(part, offset, rot); | ||
6889 | } | ||
6890 | } | ||
6879 | } | 6891 | } |
6880 | 6892 | ||
6881 | public LSL_String llAvatarOnSitTarget() | 6893 | public LSL_String llAvatarOnSitTarget() |
@@ -7560,10 +7572,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7560 | shapeBlock.PathScaleX = 100; | 7572 | shapeBlock.PathScaleX = 100; |
7561 | shapeBlock.PathScaleY = 150; | 7573 | shapeBlock.PathScaleY = 150; |
7562 | 7574 | ||
7563 | if ((type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER) == 0 && | 7575 | int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR); |
7564 | (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE) == 0 && | 7576 | |
7565 | (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE) == 0 && | 7577 | if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) && |
7566 | (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) == 0) | 7578 | type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) && |
7579 | type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) && | ||
7580 | type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag)) | ||
7567 | { | 7581 | { |
7568 | // default | 7582 | // default |
7569 | type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; | 7583 | type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; |
@@ -8851,23 +8865,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8851 | { | 8865 | { |
8852 | m_host.AddScriptLPS(1); | 8866 | m_host.AddScriptLPS(1); |
8853 | ScriptSleep(1000); | 8867 | ScriptSleep(1000); |
8868 | return GetPrimMediaParams(m_host, face, rules); | ||
8869 | } | ||
8870 | |||
8871 | public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) | ||
8872 | { | ||
8873 | m_host.AddScriptLPS(1); | ||
8874 | ScriptSleep(1000); | ||
8875 | if (link == ScriptBaseClass.LINK_ROOT) | ||
8876 | return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); | ||
8877 | else if (link == ScriptBaseClass.LINK_THIS) | ||
8878 | return GetPrimMediaParams(m_host, face, rules); | ||
8879 | else | ||
8880 | { | ||
8881 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
8882 | if (null != part) | ||
8883 | return GetPrimMediaParams(part, face, rules); | ||
8884 | } | ||
8854 | 8885 | ||
8886 | return new LSL_List(); | ||
8887 | } | ||
8888 | |||
8889 | private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules) | ||
8890 | { | ||
8855 | // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid | 8891 | // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid |
8856 | // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). | 8892 | // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). |
8857 | // Assuming silently fail means give back an empty list. Ideally, need to check this. | 8893 | // Assuming silently fail means give back an empty list. Ideally, need to check this. |
8858 | if (face < 0 || face > m_host.GetNumberOfSides() - 1) | 8894 | if (face < 0 || face > part.GetNumberOfSides() - 1) |
8859 | return new LSL_List(); | 8895 | return new LSL_List(); |
8860 | 8896 | ||
8861 | return GetPrimMediaParams(face, rules); | ||
8862 | } | ||
8863 | |||
8864 | private LSL_List GetPrimMediaParams(int face, LSL_List rules) | ||
8865 | { | ||
8866 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | 8897 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); |
8867 | if (null == module) | 8898 | if (null == module) |
8868 | throw new Exception("Media on a prim functions not available"); | 8899 | return new LSL_List(); |
8869 | 8900 | ||
8870 | MediaEntry me = module.GetMediaEntry(m_host, face); | 8901 | MediaEntry me = module.GetMediaEntry(part, face); |
8871 | 8902 | ||
8872 | // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams | 8903 | // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams |
8873 | if (null == me) | 8904 | if (null == me) |
@@ -8949,33 +8980,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8949 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: | 8980 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: |
8950 | res.Add(new LSL_Integer((int)me.ControlPermissions)); | 8981 | res.Add(new LSL_Integer((int)me.ControlPermissions)); |
8951 | break; | 8982 | break; |
8983 | |||
8984 | default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; | ||
8952 | } | 8985 | } |
8953 | } | 8986 | } |
8954 | 8987 | ||
8955 | return res; | 8988 | return res; |
8956 | } | 8989 | } |
8957 | 8990 | ||
8958 | public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) | 8991 | public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) |
8959 | { | 8992 | { |
8960 | m_host.AddScriptLPS(1); | 8993 | m_host.AddScriptLPS(1); |
8961 | ScriptSleep(1000); | 8994 | ScriptSleep(1000); |
8995 | return SetPrimMediaParams(m_host, face, rules); | ||
8996 | } | ||
8962 | 8997 | ||
8963 | // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid | 8998 | public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) |
8964 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. | 8999 | { |
8965 | // Don't perform the media check directly | 9000 | m_host.AddScriptLPS(1); |
8966 | if (face < 0 || face > m_host.GetNumberOfSides() - 1) | 9001 | ScriptSleep(1000); |
8967 | return ScriptBaseClass.LSL_STATUS_OK; | 9002 | if (link == ScriptBaseClass.LINK_ROOT) |
9003 | return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); | ||
9004 | else if (link == ScriptBaseClass.LINK_THIS) | ||
9005 | return SetPrimMediaParams(m_host, face, rules); | ||
9006 | else | ||
9007 | { | ||
9008 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
9009 | if (null != part) | ||
9010 | return SetPrimMediaParams(part, face, rules); | ||
9011 | } | ||
8968 | 9012 | ||
8969 | return SetPrimMediaParams(face, rules); | 9013 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; |
8970 | } | 9014 | } |
8971 | 9015 | ||
8972 | private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) | 9016 | private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules) |
8973 | { | 9017 | { |
9018 | // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid | ||
9019 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. | ||
9020 | // Don't perform the media check directly | ||
9021 | if (face < 0 || face > part.GetNumberOfSides() - 1) | ||
9022 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; | ||
9023 | |||
8974 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | 9024 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); |
8975 | if (null == module) | 9025 | if (null == module) |
8976 | throw new Exception("Media on a prim functions not available"); | 9026 | return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; |
8977 | 9027 | ||
8978 | MediaEntry me = module.GetMediaEntry(m_host, face); | 9028 | MediaEntry me = module.GetMediaEntry(part, face); |
8979 | if (null == me) | 9029 | if (null == me) |
8980 | me = new MediaEntry(); | 9030 | me = new MediaEntry(); |
8981 | 9031 | ||
@@ -9054,10 +9104,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9054 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: | 9104 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: |
9055 | me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); | 9105 | me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); |
9056 | break; | 9106 | break; |
9107 | |||
9108 | default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; | ||
9057 | } | 9109 | } |
9058 | } | 9110 | } |
9059 | 9111 | ||
9060 | module.SetMediaEntry(m_host, face, me); | 9112 | module.SetMediaEntry(part, face, me); |
9061 | 9113 | ||
9062 | return ScriptBaseClass.LSL_STATUS_OK; | 9114 | return ScriptBaseClass.LSL_STATUS_OK; |
9063 | } | 9115 | } |
@@ -9066,18 +9118,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9066 | { | 9118 | { |
9067 | m_host.AddScriptLPS(1); | 9119 | m_host.AddScriptLPS(1); |
9068 | ScriptSleep(1000); | 9120 | ScriptSleep(1000); |
9121 | return ClearPrimMedia(m_host, face); | ||
9122 | } | ||
9069 | 9123 | ||
9124 | public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) | ||
9125 | { | ||
9126 | m_host.AddScriptLPS(1); | ||
9127 | ScriptSleep(1000); | ||
9128 | if (link == ScriptBaseClass.LINK_ROOT) | ||
9129 | return ClearPrimMedia(m_host.ParentGroup.RootPart, face); | ||
9130 | else if (link == ScriptBaseClass.LINK_THIS) | ||
9131 | return ClearPrimMedia(m_host, face); | ||
9132 | else | ||
9133 | { | ||
9134 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
9135 | if (null != part) | ||
9136 | return ClearPrimMedia(part, face); | ||
9137 | } | ||
9138 | |||
9139 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; | ||
9140 | } | ||
9141 | |||
9142 | private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face) | ||
9143 | { | ||
9070 | // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid | 9144 | // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid |
9071 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. | 9145 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. |
9072 | // FIXME: Don't perform the media check directly | 9146 | // FIXME: Don't perform the media check directly |
9073 | if (face < 0 || face > m_host.GetNumberOfSides() - 1) | 9147 | if (face < 0 || face > part.GetNumberOfSides() - 1) |
9074 | return ScriptBaseClass.LSL_STATUS_OK; | 9148 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; |
9075 | 9149 | ||
9076 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | 9150 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); |
9077 | if (null == module) | 9151 | if (null == module) |
9078 | throw new Exception("Media on a prim functions not available"); | 9152 | return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; |
9079 | 9153 | ||
9080 | module.ClearMediaEntry(m_host, face); | 9154 | module.ClearMediaEntry(part, face); |
9081 | 9155 | ||
9082 | return ScriptBaseClass.LSL_STATUS_OK; | 9156 | return ScriptBaseClass.LSL_STATUS_OK; |
9083 | } | 9157 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a9b8e04..ecc5fb5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2169,6 +2169,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2169 | return result; | 2169 | return result; |
2170 | } | 2170 | } |
2171 | 2171 | ||
2172 | public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) | ||
2173 | { | ||
2174 | CheckThreatLevel(ThreatLevel.High, "osReplaceString"); | ||
2175 | m_host.AddScriptLPS(1); | ||
2176 | |||
2177 | // Normalize indices (if negative). | ||
2178 | // After normlaization they may still be | ||
2179 | // negative, but that is now relative to | ||
2180 | // the start, rather than the end, of the | ||
2181 | // sequence. | ||
2182 | if (start < 0) | ||
2183 | { | ||
2184 | start = src.Length + start; | ||
2185 | } | ||
2186 | |||
2187 | if (start < 0 || start >= src.Length) | ||
2188 | { | ||
2189 | return src; | ||
2190 | } | ||
2191 | |||
2192 | // Find matches beginning at start position | ||
2193 | Regex matcher = new Regex(pattern); | ||
2194 | return matcher.Replace(src,replace,count,start); | ||
2195 | } | ||
2196 | |||
2172 | public string osLoadedCreationDate() | 2197 | public string osLoadedCreationDate() |
2173 | { | 2198 | { |
2174 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); | 2199 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); |
@@ -2786,7 +2811,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2786 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); | 2811 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); |
2787 | m_host.AddScriptLPS(1); | 2812 | m_host.AddScriptLPS(1); |
2788 | ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); | 2813 | ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); |
2789 | avatar.SpeedModifier = (float)SpeedModifier; | 2814 | |
2815 | if (avatar != null) | ||
2816 | avatar.SpeedModifier = (float)SpeedModifier; | ||
2790 | } | 2817 | } |
2791 | 2818 | ||
2792 | public void osKickAvatar(string FirstName,string SurName,string alert) | 2819 | public void osKickAvatar(string FirstName,string SurName,string alert) |
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 83da204..1373971 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; |
@@ -157,12 +169,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
157 | 169 | ||
158 | public void CheckSenseRepeaterEvents() | 170 | public void CheckSenseRepeaterEvents() |
159 | { | 171 | { |
160 | // Nothing to do here? | ||
161 | if (SenseRepeaters.Count == 0) | ||
162 | return; | ||
163 | |||
164 | lock (SenseRepeatListLock) | 172 | lock (SenseRepeatListLock) |
165 | { | 173 | { |
174 | // Nothing to do here? | ||
175 | if (SenseRepeaters.Count == 0) | ||
176 | return; | ||
177 | |||
166 | // Go through all timers | 178 | // Go through all timers |
167 | foreach (SenseRepeatClass ts in SenseRepeaters) | 179 | foreach (SenseRepeatClass ts in SenseRepeaters) |
168 | { | 180 | { |
@@ -640,7 +652,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
640 | ts.next = | 652 | ts.next = |
641 | DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); | 653 | DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); |
642 | 654 | ||
643 | SenseRepeaters.Add(ts); | 655 | lock (SenseRepeatListLock) |
656 | SenseRepeaters.Add(ts); | ||
657 | |||
644 | idx += 6; | 658 | idx += 6; |
645 | } | 659 | } |
646 | } | 660 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index 2fd33fe..9ee6946 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; |