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.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs148
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs4
3 files changed, 122 insertions, 34 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index ee32755..14edde4 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
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 61a6907..c5392b5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6376,16 +6376,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6376 } 6376 }
6377 } 6377 }
6378 6378
6379 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) 6379 protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
6380 { 6380 {
6381 m_host.AddScriptLPS(1);
6382 // LSL quaternions can normalize to 0, normal Quaternions can't. 6381 // LSL quaternions can normalize to 0, normal Quaternions can't.
6383 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) 6382 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
6384 rot.z = 1; // ZERO_ROTATION = 0,0,0,1 6383 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
6385 6384
6386 m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); 6385 part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
6387 m_host.SitTargetOrientation = Rot2Quaternion(rot); 6386 part.SitTargetOrientation = Rot2Quaternion(rot);
6388 m_host.ParentGroup.HasGroupChanged = true; 6387 part.ParentGroup.HasGroupChanged = true;
6388 }
6389
6390 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
6391 {
6392 m_host.AddScriptLPS(1);
6393 SitTarget(m_host, offset, rot);
6394 }
6395
6396 public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
6397 {
6398 m_host.AddScriptLPS(1);
6399 if (link == ScriptBaseClass.LINK_ROOT)
6400 SitTarget(m_host.ParentGroup.RootPart, offset, rot);
6401 else if (link == ScriptBaseClass.LINK_THIS)
6402 SitTarget(m_host, offset, rot);
6403 else
6404 {
6405 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
6406 if (null != part)
6407 {
6408 SitTarget(part, offset, rot);
6409 }
6410 }
6389 } 6411 }
6390 6412
6391 public LSL_String llAvatarOnSitTarget() 6413 public LSL_String llAvatarOnSitTarget()
@@ -7047,10 +7069,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7047 shapeBlock.PathScaleX = 100; 7069 shapeBlock.PathScaleX = 100;
7048 shapeBlock.PathScaleY = 150; 7070 shapeBlock.PathScaleY = 150;
7049 7071
7050 if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER && 7072 int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR);
7051 type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE && 7073
7052 type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE && 7074 if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) &&
7053 type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) 7075 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) &&
7076 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) &&
7077 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
7054 { 7078 {
7055 // default 7079 // default
7056 type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; 7080 type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
@@ -8151,23 +8175,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8151 { 8175 {
8152 m_host.AddScriptLPS(1); 8176 m_host.AddScriptLPS(1);
8153 ScriptSleep(1000); 8177 ScriptSleep(1000);
8178 return GetPrimMediaParams(m_host, face, rules);
8179 }
8154 8180
8181 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8182 {
8183 m_host.AddScriptLPS(1);
8184 ScriptSleep(1000);
8185 if (link == ScriptBaseClass.LINK_ROOT)
8186 return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
8187 else if (link == ScriptBaseClass.LINK_THIS)
8188 return GetPrimMediaParams(m_host, face, rules);
8189 else
8190 {
8191 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8192 if (null != part)
8193 return GetPrimMediaParams(part, face, rules);
8194 }
8195
8196 return new LSL_List();
8197 }
8198
8199 private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules)
8200 {
8155 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid 8201 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
8156 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). 8202 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
8157 // Assuming silently fail means give back an empty list. Ideally, need to check this. 8203 // Assuming silently fail means give back an empty list. Ideally, need to check this.
8158 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8204 if (face < 0 || face > part.GetNumberOfSides() - 1)
8159 return new LSL_List(); 8205 return new LSL_List();
8160 8206
8161 return GetPrimMediaParams(face, rules);
8162 }
8163
8164 private LSL_List GetPrimMediaParams(int face, LSL_List rules)
8165 {
8166 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8207 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8167 if (null == module) 8208 if (null == module)
8168 throw new Exception("Media on a prim functions not available"); 8209 return new LSL_List();
8169 8210
8170 MediaEntry me = module.GetMediaEntry(m_host, face); 8211 MediaEntry me = module.GetMediaEntry(part, face);
8171 8212
8172 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams 8213 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
8173 if (null == me) 8214 if (null == me)
@@ -8249,33 +8290,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8249 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8290 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8250 res.Add(new LSL_Integer((int)me.ControlPermissions)); 8291 res.Add(new LSL_Integer((int)me.ControlPermissions));
8251 break; 8292 break;
8293
8294 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
8252 } 8295 }
8253 } 8296 }
8254 8297
8255 return res; 8298 return res;
8256 } 8299 }
8257 8300
8258 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 8301 public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
8259 { 8302 {
8260 m_host.AddScriptLPS(1); 8303 m_host.AddScriptLPS(1);
8261 ScriptSleep(1000); 8304 ScriptSleep(1000);
8305 return SetPrimMediaParams(m_host, face, rules);
8306 }
8262 8307
8263 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid 8308 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8264 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 8309 {
8265 // Don't perform the media check directly 8310 m_host.AddScriptLPS(1);
8266 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8311 ScriptSleep(1000);
8267 return ScriptBaseClass.LSL_STATUS_OK; 8312 if (link == ScriptBaseClass.LINK_ROOT)
8313 return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
8314 else if (link == ScriptBaseClass.LINK_THIS)
8315 return SetPrimMediaParams(m_host, face, rules);
8316 else
8317 {
8318 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8319 if (null != part)
8320 return SetPrimMediaParams(part, face, rules);
8321 }
8268 8322
8269 return SetPrimMediaParams(face, rules); 8323 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8270 } 8324 }
8271 8325
8272 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) 8326 private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules)
8273 { 8327 {
8328 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
8329 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
8330 // Don't perform the media check directly
8331 if (face < 0 || face > part.GetNumberOfSides() - 1)
8332 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8333
8274 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8334 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8275 if (null == module) 8335 if (null == module)
8276 throw new Exception("Media on a prim functions not available"); 8336 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
8277 8337
8278 MediaEntry me = module.GetMediaEntry(m_host, face); 8338 MediaEntry me = module.GetMediaEntry(part, face);
8279 if (null == me) 8339 if (null == me)
8280 me = new MediaEntry(); 8340 me = new MediaEntry();
8281 8341
@@ -8354,10 +8414,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8354 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8414 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8355 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 8415 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8356 break; 8416 break;
8417
8418 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
8357 } 8419 }
8358 } 8420 }
8359 8421
8360 module.SetMediaEntry(m_host, face, me); 8422 module.SetMediaEntry(part, face, me);
8361 8423
8362 return ScriptBaseClass.LSL_STATUS_OK; 8424 return ScriptBaseClass.LSL_STATUS_OK;
8363 } 8425 }
@@ -8366,18 +8428,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8366 { 8428 {
8367 m_host.AddScriptLPS(1); 8429 m_host.AddScriptLPS(1);
8368 ScriptSleep(1000); 8430 ScriptSleep(1000);
8431 return ClearPrimMedia(m_host, face);
8432 }
8369 8433
8434 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
8435 {
8436 m_host.AddScriptLPS(1);
8437 ScriptSleep(1000);
8438 if (link == ScriptBaseClass.LINK_ROOT)
8439 return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
8440 else if (link == ScriptBaseClass.LINK_THIS)
8441 return ClearPrimMedia(m_host, face);
8442 else
8443 {
8444 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8445 if (null != part)
8446 return ClearPrimMedia(part, face);
8447 }
8448
8449 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8450 }
8451
8452 private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face)
8453 {
8370 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid 8454 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
8371 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 8455 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
8372 // FIXME: Don't perform the media check directly 8456 // FIXME: Don't perform the media check directly
8373 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8457 if (face < 0 || face > part.GetNumberOfSides() - 1)
8374 return ScriptBaseClass.LSL_STATUS_OK; 8458 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8375 8459
8376 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8460 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8377 if (null == module) 8461 if (null == module)
8378 throw new Exception("Media on a prim functions not available"); 8462 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
8379 8463
8380 module.ClearMediaEntry(m_host, face); 8464 module.ClearMediaEntry(part, face);
8381 8465
8382 return ScriptBaseClass.LSL_STATUS_OK; 8466 return ScriptBaseClass.LSL_STATUS_OK;
8383 } 8467 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c55e2ae..ff1f5fd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2740,7 +2740,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2740 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); 2740 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
2741 m_host.AddScriptLPS(1); 2741 m_host.AddScriptLPS(1);
2742 ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); 2742 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
2743 avatar.SpeedModifier = (float)SpeedModifier; 2743
2744 if (avatar != null)
2745 avatar.SpeedModifier = (float)SpeedModifier;
2744 } 2746 }
2745 2747
2746 public void osKickAvatar(string FirstName,string SurName,string alert) 2748 public void osKickAvatar(string FirstName,string SurName,string alert)