aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs601
1 files changed, 370 insertions, 231 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ecfac6f..bf791a9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -303,35 +303,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
303 switch (linkType) 303 switch (linkType)
304 { 304 {
305 case ScriptBaseClass.LINK_SET: 305 case ScriptBaseClass.LINK_SET:
306 if (m_host.ParentGroup != null) 306 return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
307 {
308 return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
309 }
310 return ret;
311 307
312 case ScriptBaseClass.LINK_ROOT: 308 case ScriptBaseClass.LINK_ROOT:
313 if (m_host.ParentGroup != null) 309 ret = new List<SceneObjectPart>();
314 { 310 ret.Add(m_host.ParentGroup.RootPart);
315 ret = new List<SceneObjectPart>();
316 ret.Add(m_host.ParentGroup.RootPart);
317 return ret;
318 }
319 return ret; 311 return ret;
320 312
321 case ScriptBaseClass.LINK_ALL_OTHERS: 313 case ScriptBaseClass.LINK_ALL_OTHERS:
322 if (m_host.ParentGroup == null)
323 return new List<SceneObjectPart>();
324
325 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); 314 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
326 315
327 if (ret.Contains(m_host)) 316 if (ret.Contains(m_host))
328 ret.Remove(m_host); 317 ret.Remove(m_host);
318
329 return ret; 319 return ret;
330 320
331 case ScriptBaseClass.LINK_ALL_CHILDREN: 321 case ScriptBaseClass.LINK_ALL_CHILDREN:
332 if (m_host.ParentGroup == null)
333 return new List<SceneObjectPart>();
334
335 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); 322 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
336 323
337 if (ret.Contains(m_host.ParentGroup.RootPart)) 324 if (ret.Contains(m_host.ParentGroup.RootPart))
@@ -342,15 +329,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
342 return ret; 329 return ret;
343 330
344 default: 331 default:
345 if (linkType < 0 || m_host.ParentGroup == null) 332 if (linkType < 0)
346 return new List<SceneObjectPart>(); 333 return new List<SceneObjectPart>();
334
347 SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType); 335 SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType);
348 if (target == null) 336 if (target == null)
349 return new List<SceneObjectPart>(); 337 return new List<SceneObjectPart>();
350 ret = new List<SceneObjectPart>(); 338 ret = new List<SceneObjectPart>();
351 ret.Add(target); 339 ret.Add(target);
352 return ret; 340 return ret;
353
354 } 341 }
355 } 342 }
356 343
@@ -450,7 +437,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
450 } 437 }
451 438
452 // convert a LSL_Rotation to a Quaternion 439 // convert a LSL_Rotation to a Quaternion
453 protected Quaternion Rot2Quaternion(LSL_Rotation r) 440 public static Quaternion Rot2Quaternion(LSL_Rotation r)
454 { 441 {
455 Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); 442 Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
456 q.Normalize(); 443 q.Normalize();
@@ -957,6 +944,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
957 wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); 944 wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text);
958 } 945 }
959 946
947 public void llRegionSayTo(string target, int channel, string msg)
948 {
949 string error = String.Empty;
950
951 if (msg.Length > 1023)
952 msg = msg.Substring(0, 1023);
953
954 m_host.AddScriptLPS(1);
955
956 UUID TargetID;
957 UUID.TryParse(target, out TargetID);
958
959 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
960 if (wComm != null)
961 if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error))
962 LSLError(error);
963 }
964
960 public LSL_Integer llListen(int channelID, string name, string ID, string msg) 965 public LSL_Integer llListen(int channelID, string name, string ID, string msg)
961 { 966 {
962 m_host.AddScriptLPS(1); 967 m_host.AddScriptLPS(1);
@@ -1298,8 +1303,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1298 if (value != 0) 1303 if (value != 0)
1299 { 1304 {
1300 SceneObjectGroup group = m_host.ParentGroup; 1305 SceneObjectGroup group = m_host.ParentGroup;
1301 if (group == null)
1302 return;
1303 bool allow = true; 1306 bool allow = true;
1304 1307
1305 foreach (SceneObjectPart part in group.Parts) 1308 foreach (SceneObjectPart part in group.Parts)
@@ -1313,18 +1316,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1313 1316
1314 if (!allow) 1317 if (!allow)
1315 return; 1318 return;
1319
1316 m_host.ScriptSetPhysicsStatus(true); 1320 m_host.ScriptSetPhysicsStatus(true);
1317 } 1321 }
1318 else 1322 else
1323 {
1319 m_host.ScriptSetPhysicsStatus(false); 1324 m_host.ScriptSetPhysicsStatus(false);
1325 }
1320 } 1326 }
1321 1327
1322 if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) 1328 if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM)
1323 { 1329 {
1324 if (value != 0) 1330 m_host.ParentGroup.ScriptSetPhantomStatus(value != 0);
1325 m_host.ScriptSetPhantomStatus(true);
1326 else
1327 m_host.ScriptSetPhantomStatus(false);
1328 } 1331 }
1329 1332
1330 if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) 1333 if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS)
@@ -1466,8 +1469,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1466 protected void SetScale(SceneObjectPart part, LSL_Vector scale) 1469 protected void SetScale(SceneObjectPart part, LSL_Vector scale)
1467 { 1470 {
1468 // TODO: this needs to trigger a persistance save as well 1471 // TODO: this needs to trigger a persistance save as well
1469 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 1472 if (part == null || part.ParentGroup.IsDeleted)
1470 return; 1473 return;
1474
1471 if (scale.x < 0.01) 1475 if (scale.x < 0.01)
1472 scale.x = 0.01; 1476 scale.x = 0.01;
1473 if (scale.y < 0.01) 1477 if (scale.y < 0.01)
@@ -1510,7 +1514,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1510 { 1514 {
1511 m_host.AddScriptLPS(1); 1515 m_host.AddScriptLPS(1);
1512 m_host.ClickAction = (byte)action; 1516 m_host.ClickAction = (byte)action;
1513 if (m_host.ParentGroup != null) m_host.ParentGroup.HasGroupChanged = true; 1517 m_host.ParentGroup.HasGroupChanged = true;
1514 m_host.ScheduleFullUpdate(); 1518 m_host.ScheduleFullUpdate();
1515 return; 1519 return;
1516 } 1520 }
@@ -1786,9 +1790,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1786 tex.FaceTextures[i].RGBA = texcolor; 1790 tex.FaceTextures[i].RGBA = texcolor;
1787 } 1791 }
1788 } 1792 }
1789 texcolor = tex.DefaultTexture.RGBA; 1793
1790 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); 1794 // In some cases, the default texture can be null, eg when every face
1791 tex.DefaultTexture.RGBA = texcolor; 1795 // has a unique texture
1796 if (tex.DefaultTexture != null)
1797 {
1798 texcolor = tex.DefaultTexture.RGBA;
1799 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
1800 tex.DefaultTexture.RGBA = texcolor;
1801 }
1802
1792 part.UpdateTexture(tex); 1803 part.UpdateTexture(tex);
1793 return; 1804 return;
1794 } 1805 }
@@ -2149,7 +2160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2149 2160
2150 if (part.ParentGroup.RootPart == part) 2161 if (part.ParentGroup.RootPart == part)
2151 { 2162 {
2152 if ((targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0) 2163 if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0)
2153 targetPos.z = ground; 2164 targetPos.z = ground;
2154 } 2165 }
2155 LSL_Vector real_vec = SetPosAdjust(fromPos, targetPos); 2166 LSL_Vector real_vec = SetPosAdjust(fromPos, targetPos);
@@ -2236,14 +2247,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2236 else 2247 else
2237 { 2248 {
2238 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 2249 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
2239 SceneObjectGroup group = m_host.ParentGroup; 2250 SceneObjectPart rootPart = m_host.ParentGroup.RootPart;
2240 if (group != null) // a bit paranoid, maybe 2251 if (rootPart != null) // better safe than sorry
2241 { 2252 {
2242 SceneObjectPart rootPart = group.RootPart; 2253 SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
2243 if (rootPart != null) // again, better safe than sorry
2244 {
2245 SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
2246 }
2247 } 2254 }
2248 } 2255 }
2249 2256
@@ -2292,6 +2299,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2292 { 2299 {
2293 return llGetRootRotation(); 2300 return llGetRootRotation();
2294 } 2301 }
2302
2295 m_host.AddScriptLPS(1); 2303 m_host.AddScriptLPS(1);
2296 Quaternion q = m_host.GetWorldRotation(); 2304 Quaternion q = m_host.GetWorldRotation();
2297 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2305 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
@@ -2302,9 +2310,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2302 Quaternion q; 2310 Quaternion q;
2303 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim 2311 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
2304 { 2312 {
2305 if (part.ParentGroup.RootPart.AttachmentPoint != 0) 2313 if (part.ParentGroup.AttachmentPoint != 0)
2306 { 2314 {
2307 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); 2315 ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar);
2308 if (avatar != null) 2316 if (avatar != null)
2309 { 2317 {
2310 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 2318 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
@@ -2333,15 +2341,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2333 { 2341 {
2334 m_host.AddScriptLPS(1); 2342 m_host.AddScriptLPS(1);
2335 2343
2336 if (m_host.ParentGroup != null) 2344 if (!m_host.ParentGroup.IsDeleted)
2337 { 2345 {
2338 if (!m_host.ParentGroup.IsDeleted) 2346 if (local != 0)
2339 { 2347 force *= llGetRot();
2340 if (local != 0)
2341 force *= llGetRot();
2342 2348
2343 m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z)); 2349 m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
2344 }
2345 } 2350 }
2346 } 2351 }
2347 2352
@@ -2351,15 +2356,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2351 2356
2352 m_host.AddScriptLPS(1); 2357 m_host.AddScriptLPS(1);
2353 2358
2354 if (m_host.ParentGroup != null) 2359 if (!m_host.ParentGroup.IsDeleted)
2355 { 2360 {
2356 if (!m_host.ParentGroup.IsDeleted) 2361 Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
2357 { 2362 force.x = tmpForce.X;
2358 Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce(); 2363 force.y = tmpForce.Y;
2359 force.x = tmpForce.X; 2364 force.z = tmpForce.Z;
2360 force.y = tmpForce.Y;
2361 force.z = tmpForce.Z;
2362 }
2363 } 2365 }
2364 2366
2365 return force; 2367 return force;
@@ -2368,25 +2370,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2368 public LSL_Integer llTarget(LSL_Vector position, double range) 2370 public LSL_Integer llTarget(LSL_Vector position, double range)
2369 { 2371 {
2370 m_host.AddScriptLPS(1); 2372 m_host.AddScriptLPS(1);
2371 return m_host.registerTargetWaypoint(new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range); 2373 return m_host.ParentGroup.registerTargetWaypoint(
2374 new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range);
2372 } 2375 }
2373 2376
2374 public void llTargetRemove(int number) 2377 public void llTargetRemove(int number)
2375 { 2378 {
2376 m_host.AddScriptLPS(1); 2379 m_host.AddScriptLPS(1);
2377 m_host.unregisterTargetWaypoint(number); 2380 m_host.ParentGroup.unregisterTargetWaypoint(number);
2378 } 2381 }
2379 2382
2380 public LSL_Integer llRotTarget(LSL_Rotation rot, double error) 2383 public LSL_Integer llRotTarget(LSL_Rotation rot, double error)
2381 { 2384 {
2382 m_host.AddScriptLPS(1); 2385 m_host.AddScriptLPS(1);
2383 return m_host.registerRotTargetWaypoint(new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error); 2386 return m_host.ParentGroup.registerRotTargetWaypoint(
2387 new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error);
2384 } 2388 }
2385 2389
2386 public void llRotTargetRemove(int number) 2390 public void llRotTargetRemove(int number)
2387 { 2391 {
2388 m_host.AddScriptLPS(1); 2392 m_host.AddScriptLPS(1);
2389 m_host.unregisterRotTargetWaypoint(number); 2393 m_host.ParentGroup.unregisterRotTargetWaypoint(number);
2390 } 2394 }
2391 2395
2392 public void llMoveToTarget(LSL_Vector target, double tau) 2396 public void llMoveToTarget(LSL_Vector target, double tau)
@@ -2429,7 +2433,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2429 public LSL_Vector llGetTorque() 2433 public LSL_Vector llGetTorque()
2430 { 2434 {
2431 m_host.AddScriptLPS(1); 2435 m_host.AddScriptLPS(1);
2432 Vector3 torque = m_host.GetTorque(); 2436 Vector3 torque = m_host.ParentGroup.GetTorque();
2433 return new LSL_Vector(torque.X,torque.Y,torque.Z); 2437 return new LSL_Vector(torque.X,torque.Y,torque.Z);
2434 } 2438 }
2435 2439
@@ -2443,7 +2447,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2443 public LSL_Vector llGetVel() 2447 public LSL_Vector llGetVel()
2444 { 2448 {
2445 m_host.AddScriptLPS(1); 2449 m_host.AddScriptLPS(1);
2446 return new LSL_Vector(m_host.Velocity.X, m_host.Velocity.Y, m_host.Velocity.Z); 2450
2451 Vector3 vel;
2452
2453 if (m_host.ParentGroup.IsAttachment)
2454 {
2455 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
2456 vel = avatar.Velocity;
2457 }
2458 else
2459 {
2460 vel = m_host.Velocity;
2461 }
2462
2463 return new LSL_Vector(vel.X, vel.Y, vel.Z);
2447 } 2464 }
2448 2465
2449 public LSL_Vector llGetAccel() 2466 public LSL_Vector llGetAccel()
@@ -2739,10 +2756,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2739 /// negative (indicating end-relative) and may be inverted, 2756 /// negative (indicating end-relative) and may be inverted,
2740 /// i.e. end < start. 2757 /// i.e. end < start.
2741 /// </summary> 2758 /// </summary>
2742
2743 public LSL_String llDeleteSubString(string src, int start, int end) 2759 public LSL_String llDeleteSubString(string src, int start, int end)
2744 { 2760 {
2745
2746 m_host.AddScriptLPS(1); 2761 m_host.AddScriptLPS(1);
2747 2762
2748 // Normalize indices (if negative). 2763 // Normalize indices (if negative).
@@ -2822,10 +2837,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2822 /// which case it is end-relative. The index may exceed either 2837 /// which case it is end-relative. The index may exceed either
2823 /// string bound, with the result being a concatenation. 2838 /// string bound, with the result being a concatenation.
2824 /// </summary> 2839 /// </summary>
2825
2826 public LSL_String llInsertString(string dest, int index, string src) 2840 public LSL_String llInsertString(string dest, int index, string src)
2827 { 2841 {
2828
2829 m_host.AddScriptLPS(1); 2842 m_host.AddScriptLPS(1);
2830 2843
2831 // Normalize indices (if negative). 2844 // Normalize indices (if negative).
@@ -2983,8 +2996,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2983 // If either of these are null, then there was an unknown error. 2996 // If either of these are null, then there was an unknown error.
2984 if (new_group == null) 2997 if (new_group == null)
2985 continue; 2998 continue;
2986 if (new_group.RootPart == null)
2987 continue;
2988 2999
2989 // objects rezzed with this method are die_at_edge by default. 3000 // objects rezzed with this method are die_at_edge by default.
2990 new_group.RootPart.SetDieAtEdge(true); 3001 new_group.RootPart.SetDieAtEdge(true);
@@ -3248,7 +3259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3248 { 3259 {
3249 m_host.AddScriptLPS(1); 3260 m_host.AddScriptLPS(1);
3250 3261
3251 if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) 3262 if (m_host.ParentGroup.AttachmentPoint == 0)
3252 return; 3263 return;
3253 3264
3254 TaskInventoryItem item; 3265 TaskInventoryItem item;
@@ -3288,7 +3299,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3288 3299
3289 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 3300 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3290 if (attachmentsModule != null) 3301 if (attachmentsModule != null)
3291 attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); 3302 attachmentsModule.DetachSingleAttachmentToInv(itemID, presence.ControllingClient);
3292 } 3303 }
3293 3304
3294 public void llTakeCamera(string avatar) 3305 public void llTakeCamera(string avatar)
@@ -3449,12 +3460,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3449 public void llSetBuoyancy(double buoyancy) 3460 public void llSetBuoyancy(double buoyancy)
3450 { 3461 {
3451 m_host.AddScriptLPS(1); 3462 m_host.AddScriptLPS(1);
3452 if (m_host.ParentGroup != null) 3463
3464 if (!m_host.ParentGroup.IsDeleted)
3453 { 3465 {
3454 if (!m_host.ParentGroup.IsDeleted) 3466 m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy);
3455 {
3456 m_host.ParentGroup.RootPart.Buoyancy = (float)buoyancy;
3457 }
3458 } 3467 }
3459 } 3468 }
3460 3469
@@ -3683,7 +3692,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3683 3692
3684 m_host.AddScriptLPS(1); 3693 m_host.AddScriptLPS(1);
3685 3694
3686 if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.RootPart.AttachedAvatar) 3695 if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar)
3687 { 3696 {
3688 // When attached, certain permissions are implicit if requested from owner 3697 // When attached, certain permissions are implicit if requested from owner
3689 int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | 3698 int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS |
@@ -3909,7 +3918,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3909 3918
3910 SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); 3919 SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID);
3911 3920
3912 if (targetPart.ParentGroup.RootPart.AttachmentPoint != 0) 3921 if (targetPart.ParentGroup.AttachmentPoint != 0)
3913 return; // Fail silently if attached 3922 return; // Fail silently if attached
3914 3923
3915 if (targetPart.ParentGroup.RootPart.OwnerID != m_host.ParentGroup.RootPart.OwnerID) 3924 if (targetPart.ParentGroup.RootPart.OwnerID != m_host.ParentGroup.RootPart.OwnerID)
@@ -3967,7 +3976,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3967 3976
3968 SceneObjectGroup parentPrim = m_host.ParentGroup; 3977 SceneObjectGroup parentPrim = m_host.ParentGroup;
3969 3978
3970 if (parentPrim.RootPart.AttachmentPoint != 0) 3979 if (parentPrim.AttachmentPoint != 0)
3971 return; // Fail silently if attached 3980 return; // Fail silently if attached
3972 SceneObjectPart childPrim = null; 3981 SceneObjectPart childPrim = null;
3973 3982
@@ -4075,7 +4084,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4075 } 4084 }
4076 4085
4077 SceneObjectGroup parentPrim = m_host.ParentGroup; 4086 SceneObjectGroup parentPrim = m_host.ParentGroup;
4078 if (parentPrim.RootPart.AttachmentPoint != 0) 4087 if (parentPrim.AttachmentPoint != 0)
4079 return; // Fail silently if attached 4088 return; // Fail silently if attached
4080 4089
4081 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts); 4090 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts);
@@ -4311,7 +4320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4311 GridInstantMessage msg = new GridInstantMessage(World, 4320 GridInstantMessage msg = new GridInstantMessage(World,
4312 m_host.UUID, m_host.Name+", an object owned by "+ 4321 m_host.UUID, m_host.Name+", an object owned by "+
4313 resolveName(m_host.OwnerID)+",", destId, 4322 resolveName(m_host.OwnerID)+",", destId,
4314 (byte)InstantMessageDialog.InventoryOffered, 4323 (byte)InstantMessageDialog.TaskInventoryOffered,
4315 false, objName+"\n"+m_host.Name+" is located at "+ 4324 false, objName+"\n"+m_host.Name+" is located at "+
4316 World.RegionInfo.RegionName+" "+ 4325 World.RegionInfo.RegionName+" "+
4317 m_host.AbsolutePosition.ToString(), 4326 m_host.AbsolutePosition.ToString(),
@@ -4749,7 +4758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4749 return; 4758 return;
4750 4759
4751 // Object not pushable. Not an attachment and has no physics component 4760 // Object not pushable. Not an attachment and has no physics component
4752 if (!pusheeob.IsAttachment && pusheeob.PhysActor == null) 4761 if (!pusheeob.ParentGroup.IsAttachment && pusheeob.PhysActor == null)
4753 return; 4762 return;
4754 4763
4755 PusheePos = pusheeob.AbsolutePosition; 4764 PusheePos = pusheeob.AbsolutePosition;
@@ -6279,7 +6288,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6279 public LSL_Integer llGetAttached() 6288 public LSL_Integer llGetAttached()
6280 { 6289 {
6281 m_host.AddScriptLPS(1); 6290 m_host.AddScriptLPS(1);
6282 return m_host.ParentGroup.RootPart.AttachmentPoint; 6291 return m_host.ParentGroup.AttachmentPoint;
6283 } 6292 }
6284 6293
6285 public virtual LSL_Integer llGetFreeMemory() 6294 public virtual LSL_Integer llGetFreeMemory()
@@ -6663,12 +6672,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6663 public void llSetVehicleType(int type) 6672 public void llSetVehicleType(int type)
6664 { 6673 {
6665 m_host.AddScriptLPS(1); 6674 m_host.AddScriptLPS(1);
6666 if (m_host.ParentGroup != null) 6675
6676 if (!m_host.ParentGroup.IsDeleted)
6667 { 6677 {
6668 if (!m_host.ParentGroup.IsDeleted) 6678 m_host.ParentGroup.RootPart.SetVehicleType(type);
6669 {
6670 m_host.ParentGroup.RootPart.SetVehicleType(type);
6671 }
6672 } 6679 }
6673 } 6680 }
6674 6681
@@ -6678,12 +6685,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6678 { 6685 {
6679 m_host.AddScriptLPS(1); 6686 m_host.AddScriptLPS(1);
6680 6687
6681 if (m_host.ParentGroup != null) 6688 if (!m_host.ParentGroup.IsDeleted)
6682 { 6689 {
6683 if (!m_host.ParentGroup.IsDeleted) 6690 m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value);
6684 {
6685 m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value);
6686 }
6687 } 6691 }
6688 } 6692 }
6689 6693
@@ -6692,13 +6696,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6692 public void llSetVehicleVectorParam(int param, LSL_Vector vec) 6696 public void llSetVehicleVectorParam(int param, LSL_Vector vec)
6693 { 6697 {
6694 m_host.AddScriptLPS(1); 6698 m_host.AddScriptLPS(1);
6695 if (m_host.ParentGroup != null) 6699
6700 if (!m_host.ParentGroup.IsDeleted)
6696 { 6701 {
6697 if (!m_host.ParentGroup.IsDeleted) 6702 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
6698 { 6703 new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
6699 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
6700 new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
6701 }
6702 } 6704 }
6703 } 6705 }
6704 6706
@@ -6707,37 +6709,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6707 public void llSetVehicleRotationParam(int param, LSL_Rotation rot) 6709 public void llSetVehicleRotationParam(int param, LSL_Rotation rot)
6708 { 6710 {
6709 m_host.AddScriptLPS(1); 6711 m_host.AddScriptLPS(1);
6710 if (m_host.ParentGroup != null) 6712
6713 if (!m_host.ParentGroup.IsDeleted)
6711 { 6714 {
6712 if (!m_host.ParentGroup.IsDeleted) 6715 m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, Rot2Quaternion(rot));
6713 {
6714 m_host.ParentGroup.RootPart.SetVehicleRotationParam(param,
6715 Rot2Quaternion(rot));
6716 }
6717 } 6716 }
6718 } 6717 }
6719 6718
6720 public void llSetVehicleFlags(int flags) 6719 public void llSetVehicleFlags(int flags)
6721 { 6720 {
6722 m_host.AddScriptLPS(1); 6721 m_host.AddScriptLPS(1);
6723 if (m_host.ParentGroup != null) 6722
6723 if (!m_host.ParentGroup.IsDeleted)
6724 { 6724 {
6725 if (!m_host.ParentGroup.IsDeleted) 6725 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false);
6726 {
6727 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false);
6728 }
6729 } 6726 }
6730 } 6727 }
6731 6728
6732 public void llRemoveVehicleFlags(int flags) 6729 public void llRemoveVehicleFlags(int flags)
6733 { 6730 {
6734 m_host.AddScriptLPS(1); 6731 m_host.AddScriptLPS(1);
6735 if (m_host.ParentGroup != null) 6732
6733 if (!m_host.ParentGroup.IsDeleted)
6736 { 6734 {
6737 if (!m_host.ParentGroup.IsDeleted) 6735 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true);
6738 {
6739 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true);
6740 }
6741 } 6736 }
6742 } 6737 }
6743 6738
@@ -6891,20 +6886,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6891 public void llVolumeDetect(int detect) 6886 public void llVolumeDetect(int detect)
6892 { 6887 {
6893 m_host.AddScriptLPS(1); 6888 m_host.AddScriptLPS(1);
6894 if (m_host.ParentGroup != null) 6889
6895 { 6890 if (!m_host.ParentGroup.IsDeleted)
6896 if (!m_host.ParentGroup.IsDeleted) 6891 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
6897 {
6898 m_host.ParentGroup.RootPart.ScriptSetVolumeDetect(detect!=0);
6899 }
6900 }
6901 } 6892 }
6902 6893
6903 /// <summary> 6894 /// <summary>
6904 /// This is a depecated function so this just replicates the result of 6895 /// This is a depecated function so this just replicates the result of
6905 /// invoking it in SL 6896 /// invoking it in SL
6906 /// </summary> 6897 /// </summary>
6907
6908 public void llRemoteLoadScript(string target, string name, int running, int start_param) 6898 public void llRemoteLoadScript(string target, string name, int running, int start_param)
6909 { 6899 {
6910 m_host.AddScriptLPS(1); 6900 m_host.AddScriptLPS(1);
@@ -7046,7 +7036,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7046 return Util.SHA1Hash(src, Encoding.UTF8).ToLower(); 7036 return Util.SHA1Hash(src, Encoding.UTF8).ToLower();
7047 } 7037 }
7048 7038
7049 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) 7039 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
7050 { 7040 {
7051 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 7041 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
7052 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 7042 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
@@ -7059,7 +7049,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7059 { 7049 {
7060 holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT; 7050 holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT;
7061 } 7051 }
7062 shapeBlock.ProfileCurve = (byte)holeshape; 7052 shapeBlock.PathCurve = pathcurve;
7053 shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape.
7054 shapeBlock.ProfileCurve += profileshape; // Add in the profile shape.
7063 if (cut.x < 0f) 7055 if (cut.x < 0f)
7064 { 7056 {
7065 cut.x = 0f; 7057 cut.x = 0f;
@@ -7091,9 +7083,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7091 { 7083 {
7092 hollow = 0f; 7084 hollow = 0f;
7093 } 7085 }
7094 if (hollow > 0.95) 7086 // If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a
7087 // Box or Tube) and the hole shape is a square, hollow is limited to
7088 // a max of 70%. The viewer performs its own check on this value but
7089 // we need to do it here also so llGetPrimitiveParams can have access
7090 // to the correct value.
7091 if (profileshape != (byte)ProfileCurve.Square &&
7092 holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE)
7095 { 7093 {
7096 hollow = 0.95f; 7094 if (hollow > 0.70f)
7095 {
7096 hollow = 0.70f;
7097 }
7098 }
7099 // Otherwise, hollow is limited to 95%.
7100 else
7101 {
7102 if (hollow > 0.95f)
7103 {
7104 hollow = 0.95f;
7105 }
7097 } 7106 }
7098 shapeBlock.ProfileHollow = (ushort)(50000 * hollow); 7107 shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
7099 if (twist.x < -1.0f) 7108 if (twist.x < -1.0f)
@@ -7117,23 +7126,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7117 7126
7118 shapeBlock.ObjectLocalID = part.LocalId; 7127 shapeBlock.ObjectLocalID = part.LocalId;
7119 7128
7120 // retain pathcurve
7121 shapeBlock.PathCurve = part.Shape.PathCurve;
7122
7123 part.Shape.SculptEntry = false; 7129 part.Shape.SculptEntry = false;
7124 return shapeBlock; 7130 return shapeBlock;
7125 } 7131 }
7126 7132
7127 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) 7133 // Prim type box, cylinder and prism.
7134 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte profileshape, byte pathcurve)
7128 { 7135 {
7129 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 7136 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
7130 return; 7137 return;
7131 7138
7132 ObjectShapePacket.ObjectDataBlock shapeBlock; 7139 ObjectShapePacket.ObjectDataBlock shapeBlock;
7133 7140
7134 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 7141 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
7135
7136 shapeBlock.ProfileCurve += fudge;
7137 7142
7138 if (taper_b.x < 0f) 7143 if (taper_b.x < 0f)
7139 { 7144 {
@@ -7176,21 +7181,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7176 part.UpdateShape(shapeBlock); 7181 part.UpdateShape(shapeBlock);
7177 } 7182 }
7178 7183
7179 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) 7184 // Prim type sphere.
7185 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte profileshape, byte pathcurve)
7180 { 7186 {
7181 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 7187 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
7182 return; 7188 return;
7183 7189
7184 ObjectShapePacket.ObjectDataBlock shapeBlock; 7190 ObjectShapePacket.ObjectDataBlock shapeBlock;
7185 7191
7186 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 7192 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
7187 7193
7188 // profile/path swapped for a sphere 7194 // profile/path swapped for a sphere
7189 shapeBlock.PathBegin = shapeBlock.ProfileBegin; 7195 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
7190 shapeBlock.PathEnd = shapeBlock.ProfileEnd; 7196 shapeBlock.PathEnd = shapeBlock.ProfileEnd;
7191 7197
7192 shapeBlock.ProfileCurve += fudge;
7193
7194 shapeBlock.PathScaleX = 100; 7198 shapeBlock.PathScaleX = 100;
7195 shapeBlock.PathScaleY = 100; 7199 shapeBlock.PathScaleY = 100;
7196 7200
@@ -7221,16 +7225,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7221 part.UpdateShape(shapeBlock); 7225 part.UpdateShape(shapeBlock);
7222 } 7226 }
7223 7227
7224 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge) 7228 // Prim type torus, tube and ring.
7229 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte profileshape, byte pathcurve)
7225 { 7230 {
7226 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 7231 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
7227 return; 7232 return;
7228 7233
7229 ObjectShapePacket.ObjectDataBlock shapeBlock; 7234 ObjectShapePacket.ObjectDataBlock shapeBlock;
7230 7235
7231 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 7236 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
7232
7233 shapeBlock.ProfileCurve += fudge;
7234 7237
7235 // profile/path swapped for a torrus, tube, ring 7238 // profile/path swapped for a torrus, tube, ring
7236 shapeBlock.PathBegin = shapeBlock.ProfileBegin; 7239 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
@@ -7350,7 +7353,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7350 part.UpdateShape(shapeBlock); 7353 part.UpdateShape(shapeBlock);
7351 } 7354 }
7352 7355
7353 protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) 7356 // Prim type sculpt.
7357 protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type, byte pathcurve)
7354 { 7358 {
7355 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 7359 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
7356 return; 7360 return;
@@ -7366,6 +7370,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7366 if (sculptId == UUID.Zero) 7370 if (sculptId == UUID.Zero)
7367 return; 7371 return;
7368 7372
7373 shapeBlock.PathCurve = pathcurve;
7369 shapeBlock.ObjectLocalID = part.LocalId; 7374 shapeBlock.ObjectLocalID = part.LocalId;
7370 shapeBlock.PathScaleX = 100; 7375 shapeBlock.PathScaleX = 100;
7371 shapeBlock.PathScaleY = 150; 7376 shapeBlock.PathScaleY = 150;
@@ -7379,9 +7384,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7379 type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; 7384 type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
7380 } 7385 }
7381 7386
7382 // retain pathcurve
7383 shapeBlock.PathCurve = part.Shape.PathCurve;
7384
7385 part.Shape.SetSculptProperties((byte)type, sculptId); 7387 part.Shape.SetSculptProperties((byte)type, sculptId);
7386 part.Shape.SculptEntry = true; 7388 part.Shape.SculptEntry = true;
7387 part.UpdateShape(shapeBlock); 7389 part.UpdateShape(shapeBlock);
@@ -7518,15 +7520,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7518 else 7520 else
7519 { 7521 {
7520 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 7522 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
7521 SceneObjectGroup group = part.ParentGroup; 7523 SceneObjectPart rootPart = part.ParentGroup.RootPart;
7522 if (group != null) // a bit paranoid, maybe 7524 SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
7523 {
7524 SceneObjectPart rootPart = group.RootPart;
7525 if (rootPart != null) // again, better safe than sorry
7526 {
7527 SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
7528 }
7529 }
7530 } 7525 }
7531 7526
7532 break; 7527 break;
@@ -7561,8 +7556,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7561 taper_b = rules.GetVector3Item(idx++); 7556 taper_b = rules.GetVector3Item(idx++);
7562 topshear = rules.GetVector3Item(idx++); 7557 topshear = rules.GetVector3Item(idx++);
7563 7558
7564 part.Shape.PathCurve = (byte)Extrusion.Straight; 7559 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7565 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1); 7560 (byte)ProfileShape.Square, (byte)Extrusion.Straight);
7566 break; 7561 break;
7567 7562
7568 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: 7563 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
@@ -7575,9 +7570,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7575 twist = rules.GetVector3Item(idx++); 7570 twist = rules.GetVector3Item(idx++);
7576 taper_b = rules.GetVector3Item(idx++); 7571 taper_b = rules.GetVector3Item(idx++);
7577 topshear = rules.GetVector3Item(idx++); 7572 topshear = rules.GetVector3Item(idx++);
7578 part.Shape.ProfileShape = ProfileShape.Circle; 7573 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7579 part.Shape.PathCurve = (byte)Extrusion.Straight; 7574 (byte)ProfileShape.Circle, (byte)Extrusion.Straight);
7580 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0);
7581 break; 7575 break;
7582 7576
7583 case (int)ScriptBaseClass.PRIM_TYPE_PRISM: 7577 case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
@@ -7590,8 +7584,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7590 twist = rules.GetVector3Item(idx++); 7584 twist = rules.GetVector3Item(idx++);
7591 taper_b = rules.GetVector3Item(idx++); 7585 taper_b = rules.GetVector3Item(idx++);
7592 topshear = rules.GetVector3Item(idx++); 7586 topshear = rules.GetVector3Item(idx++);
7593 part.Shape.PathCurve = (byte)Extrusion.Straight; 7587 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7594 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3); 7588 (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight);
7595 break; 7589 break;
7596 7590
7597 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: 7591 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
@@ -7603,8 +7597,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7603 hollow = (float)rules.GetLSLFloatItem(idx++); 7597 hollow = (float)rules.GetLSLFloatItem(idx++);
7604 twist = rules.GetVector3Item(idx++); 7598 twist = rules.GetVector3Item(idx++);
7605 taper_b = rules.GetVector3Item(idx++); // dimple 7599 taper_b = rules.GetVector3Item(idx++); // dimple
7606 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7600 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b,
7607 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5); 7601 (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1);
7608 break; 7602 break;
7609 7603
7610 case (int)ScriptBaseClass.PRIM_TYPE_TORUS: 7604 case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
@@ -7622,9 +7616,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7622 revolutions = (float)rules.GetLSLFloatItem(idx++); 7616 revolutions = (float)rules.GetLSLFloatItem(idx++);
7623 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7617 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7624 skew = (float)rules.GetLSLFloatItem(idx++); 7618 skew = (float)rules.GetLSLFloatItem(idx++);
7625 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7626 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7619 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7627 revolutions, radiusoffset, skew, 0); 7620 revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1);
7628 break; 7621 break;
7629 7622
7630 case (int)ScriptBaseClass.PRIM_TYPE_TUBE: 7623 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
@@ -7642,9 +7635,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7642 revolutions = (float)rules.GetLSLFloatItem(idx++); 7635 revolutions = (float)rules.GetLSLFloatItem(idx++);
7643 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7636 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7644 skew = (float)rules.GetLSLFloatItem(idx++); 7637 skew = (float)rules.GetLSLFloatItem(idx++);
7645 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7646 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7638 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7647 revolutions, radiusoffset, skew, 1); 7639 revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1);
7648 break; 7640 break;
7649 7641
7650 case (int)ScriptBaseClass.PRIM_TYPE_RING: 7642 case (int)ScriptBaseClass.PRIM_TYPE_RING:
@@ -7662,9 +7654,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7662 revolutions = (float)rules.GetLSLFloatItem(idx++); 7654 revolutions = (float)rules.GetLSLFloatItem(idx++);
7663 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7655 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7664 skew = (float)rules.GetLSLFloatItem(idx++); 7656 skew = (float)rules.GetLSLFloatItem(idx++);
7665 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7666 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7657 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7667 revolutions, radiusoffset, skew, 3); 7658 revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1);
7668 break; 7659 break;
7669 7660
7670 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: 7661 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
@@ -7673,8 +7664,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7673 7664
7674 string map = rules.Data[idx++].ToString(); 7665 string map = rules.Data[idx++].ToString();
7675 face = (int)rules.GetLSLIntegerItem(idx++); // type 7666 face = (int)rules.GetLSLIntegerItem(idx++); // type
7676 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7667 SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1);
7677 SetPrimitiveShapeParams(part, map, face);
7678 break; 7668 break;
7679 } 7669 }
7680 7670
@@ -7779,18 +7769,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7779 break; 7769 break;
7780 7770
7781 case (int)ScriptBaseClass.PRIM_PHANTOM: 7771 case (int)ScriptBaseClass.PRIM_PHANTOM:
7782 if (remain < 1) 7772 if (remain < 1)
7783 return; 7773 return;
7784 7774
7785 string ph = rules.Data[idx++].ToString(); 7775 string ph = rules.Data[idx++].ToString();
7786 bool phantom; 7776 m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
7787 7777
7788 if (ph.Equals("1"))
7789 phantom = true;
7790 else
7791 phantom = false;
7792
7793 part.ScriptSetPhantomStatus(phantom);
7794 break; 7778 break;
7795 7779
7796 case (int)ScriptBaseClass.PRIM_PHYSICS: 7780 case (int)ScriptBaseClass.PRIM_PHYSICS:
@@ -7811,14 +7795,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7811 if (remain < 1) 7795 if (remain < 1)
7812 return; 7796 return;
7813 string temp = rules.Data[idx++].ToString(); 7797 string temp = rules.Data[idx++].ToString();
7814 bool tempOnRez;
7815 7798
7816 if (temp.Equals("1")) 7799 m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
7817 tempOnRez = true;
7818 else
7819 tempOnRez = false;
7820 7800
7821 part.ScriptSetTemporaryStatus(tempOnRez);
7822 break; 7801 break;
7823 7802
7824 case (int)ScriptBaseClass.PRIM_TEXGEN: 7803 case (int)ScriptBaseClass.PRIM_TEXGEN:
@@ -7983,9 +7962,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7983 { 7962 {
7984 m_host.AddScriptLPS(1); 7963 m_host.AddScriptLPS(1);
7985 Quaternion q; 7964 Quaternion q;
7986 if (m_host.ParentGroup.RootPart.AttachmentPoint != 0) 7965 if (m_host.ParentGroup.AttachmentPoint != 0)
7987 { 7966 {
7988 ScenePresence avatar = World.GetScenePresence(m_host.AttachedAvatar); 7967 ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
7989 if (avatar != null) 7968 if (avatar != null)
7990 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 7969 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
7991 q = avatar.CameraRotation; // Mouselook 7970 q = avatar.CameraRotation; // Mouselook
@@ -8238,7 +8217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8238 case ScriptBaseClass.PRIM_TYPE_BOX: 8217 case ScriptBaseClass.PRIM_TYPE_BOX:
8239 case ScriptBaseClass.PRIM_TYPE_CYLINDER: 8218 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
8240 case ScriptBaseClass.PRIM_TYPE_PRISM: 8219 case ScriptBaseClass.PRIM_TYPE_PRISM:
8241 res.Add(new LSL_Integer(Shape.ProfileCurve)); 8220 res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
8242 res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 8221 res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
8243 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); 8222 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
8244 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 8223 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
@@ -8247,7 +8226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8247 break; 8226 break;
8248 8227
8249 case ScriptBaseClass.PRIM_TYPE_SPHERE: 8228 case ScriptBaseClass.PRIM_TYPE_SPHERE:
8250 res.Add(new LSL_Integer(Shape.ProfileCurve)); 8229 res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
8251 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); 8230 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
8252 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); 8231 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
8253 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 8232 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
@@ -8263,7 +8242,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8263 case ScriptBaseClass.PRIM_TYPE_TUBE: 8242 case ScriptBaseClass.PRIM_TYPE_TUBE:
8264 case ScriptBaseClass.PRIM_TYPE_TORUS: 8243 case ScriptBaseClass.PRIM_TYPE_TORUS:
8265 // holeshape 8244 // holeshape
8266 res.Add(new LSL_Integer(Shape.ProfileCurve)); 8245 res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
8267 8246
8268 // cut 8247 // cut
8269 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); 8248 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
@@ -10666,6 +10645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10666 public LSL_List llGetObjectDetails(string id, LSL_List args) 10645 public LSL_List llGetObjectDetails(string id, LSL_List args)
10667 { 10646 {
10668 m_host.AddScriptLPS(1); 10647 m_host.AddScriptLPS(1);
10648
10669 LSL_List ret = new LSL_List(); 10649 LSL_List ret = new LSL_List();
10670 UUID key = new UUID(); 10650 UUID key = new UUID();
10671 if (UUID.TryParse(id, out key)) 10651 if (UUID.TryParse(id, out key))
@@ -10676,72 +10656,76 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10676 { 10656 {
10677 foreach (object o in args.Data) 10657 foreach (object o in args.Data)
10678 { 10658 {
10679 switch (o.ToString()) 10659 switch (int.Parse(o.ToString()))
10680 { 10660 {
10681 case "1": 10661 case ScriptBaseClass.OBJECT_NAME:
10682 ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); 10662 ret.Add(new LSL_String(av.Firstname + " " + av.Lastname));
10683 break; 10663 break;
10684 case "2": 10664 case ScriptBaseClass.OBJECT_DESC:
10685 ret.Add(new LSL_String("")); 10665 ret.Add(new LSL_String(""));
10686 break; 10666 break;
10687 case "3": 10667 case ScriptBaseClass.OBJECT_POS:
10688 ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); 10668 ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z));
10689 break; 10669 break;
10690 case "4": 10670 case ScriptBaseClass.OBJECT_ROT:
10691 ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); 10671 ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W));
10692 break; 10672 break;
10693 case "5": 10673 case ScriptBaseClass.OBJECT_VELOCITY:
10694 ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); 10674 ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z));
10695 break; 10675 break;
10696 case "6": 10676 case ScriptBaseClass.OBJECT_OWNER:
10697 ret.Add(new LSL_String(id)); 10677 ret.Add(new LSL_String(id));
10698 break; 10678 break;
10699 case "7": 10679 case ScriptBaseClass.OBJECT_GROUP:
10700 ret.Add(new LSL_String(UUID.Zero.ToString())); 10680 ret.Add(new LSL_String(UUID.Zero.ToString()));
10701 break; 10681 break;
10702 case "8": 10682 case ScriptBaseClass.OBJECT_CREATOR:
10703 ret.Add(new LSL_String(UUID.Zero.ToString())); 10683 ret.Add(new LSL_String(UUID.Zero.ToString()));
10704 break; 10684 break;
10705 } 10685 }
10706 } 10686 }
10687
10707 return ret; 10688 return ret;
10708 } 10689 }
10690
10709 SceneObjectPart obj = World.GetSceneObjectPart(key); 10691 SceneObjectPart obj = World.GetSceneObjectPart(key);
10710 if (obj != null) 10692 if (obj != null)
10711 { 10693 {
10712 foreach (object o in args.Data) 10694 foreach (object o in args.Data)
10713 { 10695 {
10714 switch (o.ToString()) 10696 switch (int.Parse(o.ToString()))
10715 { 10697 {
10716 case "1": 10698 case ScriptBaseClass.OBJECT_NAME:
10717 ret.Add(new LSL_String(obj.Name)); 10699 ret.Add(new LSL_String(obj.Name));
10718 break; 10700 break;
10719 case "2": 10701 case ScriptBaseClass.OBJECT_DESC:
10720 ret.Add(new LSL_String(obj.Description)); 10702 ret.Add(new LSL_String(obj.Description));
10721 break; 10703 break;
10722 case "3": 10704 case ScriptBaseClass.OBJECT_POS:
10723 ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); 10705 ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z));
10724 break; 10706 break;
10725 case "4": 10707 case ScriptBaseClass.OBJECT_ROT:
10726 ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); 10708 ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W));
10727 break; 10709 break;
10728 case "5": 10710 case ScriptBaseClass.OBJECT_VELOCITY:
10729 ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); 10711 ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z));
10730 break; 10712 break;
10731 case "6": 10713 case ScriptBaseClass.OBJECT_OWNER:
10732 ret.Add(new LSL_String(obj.OwnerID.ToString())); 10714 ret.Add(new LSL_String(obj.OwnerID.ToString()));
10733 break; 10715 break;
10734 case "7": 10716 case ScriptBaseClass.OBJECT_GROUP:
10735 ret.Add(new LSL_String(obj.GroupID.ToString())); 10717 ret.Add(new LSL_String(obj.GroupID.ToString()));
10736 break; 10718 break;
10737 case "8": 10719 case ScriptBaseClass.OBJECT_CREATOR:
10738 ret.Add(new LSL_String(obj.CreatorID.ToString())); 10720 ret.Add(new LSL_String(obj.CreatorID.ToString()));
10739 break; 10721 break;
10740 } 10722 }
10741 } 10723 }
10724
10742 return ret; 10725 return ret;
10743 } 10726 }
10744 } 10727 }
10728
10745 return new LSL_List(); 10729 return new LSL_List();
10746 } 10730 }
10747 10731
@@ -11000,31 +10984,173 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11000 { 10984 {
11001 m_SayShoutCount = 0; 10985 m_SayShoutCount = 0;
11002 } 10986 }
10987 public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
10988 {
10989 m_host.AddScriptLPS(1);
10990
10991 Vector3 dir = new Vector3((float)(end-start).x, (float)(end-start).y, (float)(end-start).z);
10992 Vector3 startvector = new Vector3((float)start.x, (float)start.y, (float)start.z);
10993 Vector3 endvector = new Vector3((float)end.x, (float)end.y, (float)end.z);
10994
10995 int count = 0;
10996// int detectPhantom = 0;
10997 int dataFlags = 0;
10998 int rejectTypes = 0;
10999
11000 for (int i = 0; i < options.Length; i += 2)
11001 {
11002 if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
11003 {
11004 count = options.GetLSLIntegerItem(i + 1);
11005 }
11006// else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
11007// {
11008// detectPhantom = options.GetLSLIntegerItem(i + 1);
11009// }
11010 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DATA_FLAGS)
11011 {
11012 dataFlags = options.GetLSLIntegerItem(i + 1);
11013 }
11014 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
11015 {
11016 rejectTypes = options.GetLSLIntegerItem(i + 1);
11017 }
11018 }
11019
11020 LSL_List list = new LSL_List();
11021 List<ContactResult> results = World.PhysicsScene.RaycastWorld(startvector, dir, dir.Length(), count);
11022
11023 double distance = Util.GetDistanceTo(startvector, endvector);
11024
11025 if (distance == 0)
11026 distance = 0.001;
11027
11028 Vector3 posToCheck = startvector;
11029 ITerrainChannel channel = World.RequestModuleInterface<ITerrainChannel>();
11030
11031 bool checkTerrain = !((rejectTypes & ScriptBaseClass.RC_REJECT_LAND) == ScriptBaseClass.RC_REJECT_LAND);
11032 bool checkAgents = !((rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) == ScriptBaseClass.RC_REJECT_AGENTS);
11033 bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL);
11034 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
11035
11036 for (float i = 0; i <= distance; i += 0.1f)
11037 {
11038 posToCheck = startvector + (dir * (i / (float)distance));
11039
11040 if (checkTerrain && channel[(int)(posToCheck.X + startvector.X), (int)(posToCheck.Y + startvector.Y)] < posToCheck.Z)
11041 {
11042 ContactResult result = new ContactResult();
11043 result.ConsumerID = 0;
11044 result.Depth = 0;
11045 result.Normal = Vector3.Zero;
11046 result.Pos = posToCheck;
11047 results.Add(result);
11048 checkTerrain = false;
11049 }
11050
11051 if (checkAgents)
11052 {
11053 World.ForEachScenePresence(delegate(ScenePresence sp)
11054 {
11055 if (sp.AbsolutePosition.ApproxEquals(posToCheck, sp.PhysicsActor.Size.X))
11056 {
11057 ContactResult result = new ContactResult ();
11058 result.ConsumerID = sp.LocalId;
11059 result.Depth = 0;
11060 result.Normal = Vector3.Zero;
11061 result.Pos = posToCheck;
11062 results.Add(result);
11063 }
11064 });
11065 }
11066 }
11067
11068 int refcount = 0;
11069 foreach (ContactResult result in results)
11070 {
11071 if ((rejectTypes & ScriptBaseClass.RC_REJECT_LAND)
11072 == ScriptBaseClass.RC_REJECT_LAND && result.ConsumerID == 0)
11073 continue;
11074
11075 ISceneEntity entity = World.GetSceneObjectPart(result.ConsumerID);
11076
11077 if (entity == null && (rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) != ScriptBaseClass.RC_REJECT_AGENTS)
11078 entity = World.GetScenePresence(result.ConsumerID); //Only check if we should be looking for agents
11079
11080 if (entity == null)
11081 {
11082 list.Add(UUID.Zero);
11083
11084 if ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) == ScriptBaseClass.RC_GET_LINK_NUM)
11085 list.Add(0);
11086
11087 list.Add(result.Pos);
11088
11089 if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL)
11090 list.Add(result.Normal);
11091
11092 continue; //Can't find it, so add UUID.Zero
11093 }
11094
11095 /*if (detectPhantom == 0 && intersection.obj is ISceneChildEntity &&
11096 ((ISceneChildEntity)intersection.obj).PhysActor == null)
11097 continue;*/ //Can't do this ATM, physics engine knows only of non phantom objects
11098
11099 if (entity is SceneObjectPart)
11100 {
11101 if (((SceneObjectPart)entity).PhysActor != null && ((SceneObjectPart)entity).PhysActor.IsPhysical)
11102 {
11103 if (!checkPhysical)
11104 continue;
11105 }
11106 else
11107 {
11108 if (!checkNonPhysical)
11109 continue;
11110 }
11111 }
11112
11113 refcount++;
11114 if ((dataFlags & ScriptBaseClass.RC_GET_ROOT_KEY) == ScriptBaseClass.RC_GET_ROOT_KEY && entity is SceneObjectPart)
11115 list.Add(((SceneObjectPart)entity).ParentGroup.UUID);
11116 else
11117 list.Add(entity.UUID);
11118
11119 if ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) == ScriptBaseClass.RC_GET_LINK_NUM)
11120 {
11121 if (entity is SceneObjectPart)
11122 list.Add(((SceneObjectPart)entity).LinkNum);
11123 else
11124 list.Add(0);
11125 }
11126
11127 list.Add(result.Pos);
11128
11129 if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL)
11130 list.Add(result.Normal);
11131 }
11132
11133 list.Add(refcount); //The status code, either the # of contacts, RCERR_SIM_PERF_LOW, or RCERR_CAST_TIME_EXCEEDED
11134
11135 return list;
11136 }
11003 11137
11004 #region Not Implemented 11138 #region Not Implemented
11005 // 11139 //
11006 // Listing the unimplemented lsl functions here, please move 11140 // Listing the unimplemented lsl functions here, please move
11007 // them from this region as they are completed 11141 // them from this region as they are completed
11008 // 11142 //
11009 public void llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
11010 {
11011 m_host.AddScriptLPS(1);
11012 NotImplemented("llCastRay");
11013
11014 }
11015 11143
11016 public void llGetEnv(LSL_String name) 11144 public void llGetEnv(LSL_String name)
11017 { 11145 {
11018 m_host.AddScriptLPS(1); 11146 m_host.AddScriptLPS(1);
11019 NotImplemented("llGetEnv"); 11147 NotImplemented("llGetEnv");
11020
11021 } 11148 }
11022 11149
11023 public void llGetSPMaxMemory() 11150 public void llGetSPMaxMemory()
11024 { 11151 {
11025 m_host.AddScriptLPS(1); 11152 m_host.AddScriptLPS(1);
11026 NotImplemented("llGetSPMaxMemory"); 11153 NotImplemented("llGetSPMaxMemory");
11027
11028 } 11154 }
11029 11155
11030 public virtual LSL_Integer llGetUsedMemory() 11156 public virtual LSL_Integer llGetUsedMemory()
@@ -11034,18 +11160,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11034 return 0; 11160 return 0;
11035 } 11161 }
11036 11162
11037 public void llRegionSayTo( LSL_Key target, LSL_Integer channel, LSL_String msg ) 11163 public void llScriptProfiler(LSL_Integer flags)
11038 {
11039 m_host.AddScriptLPS(1);
11040 NotImplemented("llRegionSayTo");
11041
11042 }
11043
11044 public void llScriptProfiler( LSL_Integer flags )
11045 { 11164 {
11046 m_host.AddScriptLPS(1); 11165 m_host.AddScriptLPS(1);
11047 //NotImplemented("llScriptProfiler"); 11166 //NotImplemented("llScriptProfiler");
11048
11049 } 11167 }
11050 11168
11051 public void llSetSoundQueueing(int queue) 11169 public void llSetSoundQueueing(int queue)
@@ -11164,9 +11282,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11164 } 11282 }
11165 } 11283 }
11166 11284
11167 public static string GetLine(UUID assetID, int line, int maxLength) 11285 /// <summary>
11286 /// Get a notecard line.
11287 /// </summary>
11288 /// <param name="assetID"></param>
11289 /// <param name="line">Lines start at index 0</param>
11290 /// <returns></returns>
11291 public static string GetLine(UUID assetID, int lineNumber)
11168 { 11292 {
11169 if (line < 0) 11293 if (lineNumber < 0)
11170 return ""; 11294 return "";
11171 11295
11172 string data; 11296 string data;
@@ -11178,17 +11302,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11178 { 11302 {
11179 m_Notecards[assetID].lastRef = DateTime.Now; 11303 m_Notecards[assetID].lastRef = DateTime.Now;
11180 11304
11181 if (line >= m_Notecards[assetID].text.Length) 11305 if (lineNumber >= m_Notecards[assetID].text.Length)
11182 return "\n\n\n"; 11306 return "\n\n\n";
11183 11307
11184 data = m_Notecards[assetID].text[line]; 11308 data = m_Notecards[assetID].text[lineNumber];
11185 if (data.Length > maxLength)
11186 data = data.Substring(0, maxLength);
11187 11309
11188 return data; 11310 return data;
11189 } 11311 }
11190 } 11312 }
11191 11313
11314 /// <summary>
11315 /// Get a notecard line.
11316 /// </summary>
11317 /// <param name="assetID"></param>
11318 /// <param name="line">Lines start at index 0</param>
11319 /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para>
11320 /// <returns></returns>
11321 public static string GetLine(UUID assetID, int lineNumber, int maxLength)
11322 {
11323 string line = GetLine(assetID, lineNumber);
11324
11325 if (line.Length > maxLength)
11326 line = line.Substring(0, maxLength);
11327
11328 return line;
11329 }
11330
11192 public static void CacheCheck() 11331 public static void CacheCheck()
11193 { 11332 {
11194 foreach (UUID key in new List<UUID>(m_Notecards.Keys)) 11333 foreach (UUID key in new List<UUID>(m_Notecards.Keys))