aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs194
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs77
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs24
10 files changed, 215 insertions, 192 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d6aafaf..717cc07 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -426,14 +426,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
426 return key; 426 return key;
427 } 427 }
428 428
429 // convert a LSL_Rotation to a Quaternion
430 public static Quaternion Rot2Quaternion(LSL_Rotation r)
431 {
432 Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
433 q.Normalize();
434 return q;
435 }
436
437 //These are the implementations of the various ll-functions used by the LSL scripts. 429 //These are the implementations of the various ll-functions used by the LSL scripts.
438 public LSL_Float llSin(double f) 430 public LSL_Float llSin(double f)
439 { 431 {
@@ -1240,9 +1232,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1240 public LSL_Float llGround(LSL_Vector offset) 1232 public LSL_Float llGround(LSL_Vector offset)
1241 { 1233 {
1242 m_host.AddScriptLPS(1); 1234 m_host.AddScriptLPS(1);
1243 Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x, 1235 Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
1244 (float)offset.y,
1245 (float)offset.z);
1246 1236
1247 //Get the slope normal. This gives us the equation of the plane tangent to the slope. 1237 //Get the slope normal. This gives us the equation of the plane tangent to the slope.
1248 LSL_Vector vsn = llGroundNormal(offset); 1238 LSL_Vector vsn = llGroundNormal(offset);
@@ -1492,31 +1482,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1492 if (part == null || part.ParentGroup.IsDeleted) 1482 if (part == null || part.ParentGroup.IsDeleted)
1493 return; 1483 return;
1494 1484
1495 if (scale.x < 0.01) 1485 // First we need to check whether or not we need to clamp the size of a physics-enabled prim
1496 scale.x = 0.01;
1497 if (scale.y < 0.01)
1498 scale.y = 0.01;
1499 if (scale.z < 0.01)
1500 scale.z = 0.01;
1501
1502 PhysicsActor pa = part.ParentGroup.RootPart.PhysActor; 1486 PhysicsActor pa = part.ParentGroup.RootPart.PhysActor;
1503
1504 if (pa != null && pa.IsPhysical) 1487 if (pa != null && pa.IsPhysical)
1505 { 1488 {
1506 if (scale.x > World.m_maxPhys) 1489 scale.x = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.x));
1507 scale.x = World.m_maxPhys; 1490 scale.y = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.y));
1508 if (scale.y > World.m_maxPhys) 1491 scale.z = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.z));
1509 scale.y = World.m_maxPhys;
1510 if (scale.z > World.m_maxPhys)
1511 scale.z = World.m_maxPhys;
1512 } 1492 }
1513 1493
1514 if (scale.x > World.m_maxNonphys) 1494 // Next we clamp the scale to the non-physical min/max
1515 scale.x = World.m_maxNonphys; 1495 scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x));
1516 if (scale.y > World.m_maxNonphys) 1496 scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y));
1517 scale.y = World.m_maxNonphys; 1497 scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z));
1518 if (scale.z > World.m_maxNonphys)
1519 scale.z = World.m_maxNonphys;
1520 1498
1521 Vector3 tmp = part.Scale; 1499 Vector3 tmp = part.Scale;
1522 tmp.X = (float)scale.x; 1500 tmp.X = (float)scale.x;
@@ -1590,7 +1568,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1590 if (face == ScriptBaseClass.ALL_SIDES) 1568 if (face == ScriptBaseClass.ALL_SIDES)
1591 face = SceneObjectPart.ALL_SIDES; 1569 face = SceneObjectPart.ALL_SIDES;
1592 1570
1593 m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 1571 m_host.SetFaceColor(color, face);
1594 } 1572 }
1595 1573
1596 public void SetTexGen(SceneObjectPart part, int face,int style) 1574 public void SetTexGen(SceneObjectPart part, int face,int style)
@@ -2220,7 +2198,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2220 2198
2221 bool sameParcel = here.GlobalID == there.GlobalID; 2199 bool sameParcel = here.GlobalID == there.GlobalID;
2222 2200
2223 if (!sameParcel && !World.Permissions.CanObjectEntry(m_host.UUID, false, new Vector3((float)pos.x, (float)pos.y, (float)pos.z))) 2201 if (!sameParcel && !World.Permissions.CanRezObject(
2202 m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, pos))
2224 { 2203 {
2225 return 0; 2204 return 0;
2226 } 2205 }
@@ -2279,16 +2258,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2279 if (part.ParentGroup.RootPart == part) 2258 if (part.ParentGroup.RootPart == part)
2280 { 2259 {
2281 SceneObjectGroup parent = part.ParentGroup; 2260 SceneObjectGroup parent = part.ParentGroup;
2282 Vector3 dest = new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z); 2261 if (!World.Permissions.CanObjectEntry(parent.UUID, false, (Vector3)toPos))
2283 if (!World.Permissions.CanObjectEntry(parent.UUID, false, dest))
2284 return; 2262 return;
2285 Util.FireAndForget(delegate(object x) { 2263 Util.FireAndForget(delegate(object x) {
2286 parent.UpdateGroupPosition(dest); 2264 parent.UpdateGroupPosition((Vector3)toPos);
2287 }); 2265 });
2288 } 2266 }
2289 else 2267 else
2290 { 2268 {
2291 part.OffsetPosition = new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z); 2269 part.OffsetPosition = (Vector3)toPos;
2292 SceneObjectGroup parent = part.ParentGroup; 2270 SceneObjectGroup parent = part.ParentGroup;
2293 parent.HasGroupChanged = true; 2271 parent.HasGroupChanged = true;
2294 parent.ScheduleGroupForTerseUpdate(); 2272 parent.ScheduleGroupForTerseUpdate();
@@ -2326,7 +2304,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2326 pos = part.AbsolutePosition; 2304 pos = part.AbsolutePosition;
2327 } 2305 }
2328 2306
2329 return new LSL_Vector(pos.X, pos.Y, pos.Z); 2307// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
2308
2309 return new LSL_Vector(pos);
2330 } 2310 }
2331 2311
2332 public void llSetRot(LSL_Rotation rot) 2312 public void llSetRot(LSL_Rotation rot)
@@ -2343,7 +2323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2343 // using it would cause attachments and HUDs to rotate 2323 // using it would cause attachments and HUDs to rotate
2344 // to the wrong positions. 2324 // to the wrong positions.
2345 2325
2346 SetRot(m_host, Rot2Quaternion(rot)); 2326 SetRot(m_host, rot);
2347 } 2327 }
2348 else 2328 else
2349 { 2329 {
@@ -2353,7 +2333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2353 { 2333 {
2354 rootPart = m_host.ParentGroup.RootPart; 2334 rootPart = m_host.ParentGroup.RootPart;
2355 if (rootPart != null) 2335 if (rootPart != null)
2356 SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot)); 2336 SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot);
2357 } 2337 }
2358 } 2338 }
2359 2339
@@ -2363,8 +2343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2363 public void llSetLocalRot(LSL_Rotation rot) 2343 public void llSetLocalRot(LSL_Rotation rot)
2364 { 2344 {
2365 m_host.AddScriptLPS(1); 2345 m_host.AddScriptLPS(1);
2366 2346 SetRot(m_host, rot);
2367 SetRot(m_host, Rot2Quaternion(rot));
2368 ScriptSleep(200); 2347 ScriptSleep(200);
2369 } 2348 }
2370 2349
@@ -2476,7 +2455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2476 if (local != 0) 2455 if (local != 0)
2477 force *= llGetRot(); 2456 force *= llGetRot();
2478 2457
2479 m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z)); 2458 m_host.ParentGroup.RootPart.SetForce(force);
2480 } 2459 }
2481 } 2460 }
2482 2461
@@ -2488,10 +2467,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2488 2467
2489 if (!m_host.ParentGroup.IsDeleted) 2468 if (!m_host.ParentGroup.IsDeleted)
2490 { 2469 {
2491 Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce(); 2470 force = m_host.ParentGroup.RootPart.GetForce();
2492 force.x = tmpForce.X;
2493 force.y = tmpForce.Y;
2494 force.z = tmpForce.Z;
2495 } 2471 }
2496 2472
2497 return force; 2473 return force;
@@ -2500,8 +2476,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2500 public LSL_Integer llTarget(LSL_Vector position, double range) 2476 public LSL_Integer llTarget(LSL_Vector position, double range)
2501 { 2477 {
2502 m_host.AddScriptLPS(1); 2478 m_host.AddScriptLPS(1);
2503 return m_host.ParentGroup.registerTargetWaypoint( 2479 return m_host.ParentGroup.registerTargetWaypoint(position,
2504 new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range); 2480 (float)range);
2505 } 2481 }
2506 2482
2507 public void llTargetRemove(int number) 2483 public void llTargetRemove(int number)
@@ -2513,8 +2489,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2513 public LSL_Integer llRotTarget(LSL_Rotation rot, double error) 2489 public LSL_Integer llRotTarget(LSL_Rotation rot, double error)
2514 { 2490 {
2515 m_host.AddScriptLPS(1); 2491 m_host.AddScriptLPS(1);
2516 return m_host.ParentGroup.registerRotTargetWaypoint( 2492 return m_host.ParentGroup.registerRotTargetWaypoint(rot, (float)error);
2517 new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error);
2518 } 2493 }
2519 2494
2520 public void llRotTargetRemove(int number) 2495 public void llRotTargetRemove(int number)
@@ -2526,7 +2501,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2526 public void llMoveToTarget(LSL_Vector target, double tau) 2501 public void llMoveToTarget(LSL_Vector target, double tau)
2527 { 2502 {
2528 m_host.AddScriptLPS(1); 2503 m_host.AddScriptLPS(1);
2529 m_host.MoveToTarget(new Vector3((float)target.x, (float)target.y, (float)target.z), (float)tau); 2504 m_host.MoveToTarget(target, (float)tau);
2530 } 2505 }
2531 2506
2532 public void llStopMoveToTarget() 2507 public void llStopMoveToTarget()
@@ -2539,7 +2514,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2539 { 2514 {
2540 m_host.AddScriptLPS(1); 2515 m_host.AddScriptLPS(1);
2541 //No energy force yet 2516 //No energy force yet
2542 Vector3 v = new Vector3((float)force.x, (float)force.y, (float)force.z); 2517 Vector3 v = force;
2543 if (v.Length() > 20000.0f) 2518 if (v.Length() > 20000.0f)
2544 { 2519 {
2545 v.Normalize(); 2520 v.Normalize();
@@ -2552,13 +2527,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2552 public void llApplyRotationalImpulse(LSL_Vector force, int local) 2527 public void llApplyRotationalImpulse(LSL_Vector force, int local)
2553 { 2528 {
2554 m_host.AddScriptLPS(1); 2529 m_host.AddScriptLPS(1);
2555 m_host.ParentGroup.RootPart.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); 2530 m_host.ParentGroup.RootPart.ApplyAngularImpulse(force, local != 0);
2556 } 2531 }
2557 2532
2558 public void llSetTorque(LSL_Vector torque, int local) 2533 public void llSetTorque(LSL_Vector torque, int local)
2559 { 2534 {
2560 m_host.AddScriptLPS(1); 2535 m_host.AddScriptLPS(1);
2561 m_host.ParentGroup.RootPart.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0); 2536 m_host.ParentGroup.RootPart.SetAngularImpulse(torque, local != 0);
2562 } 2537 }
2563 2538
2564 public LSL_Vector llGetTorque() 2539 public LSL_Vector llGetTorque()
@@ -3123,13 +3098,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3123 return; 3098 return;
3124 } 3099 }
3125 3100
3126 Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
3127 Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
3128
3129 // need the magnitude later 3101 // need the magnitude later
3130 // float velmag = (float)Util.GetMagnitude(llvel); 3102 // float velmag = (float)Util.GetMagnitude(llvel);
3131 3103
3132 SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param); 3104 SceneObjectGroup new_group = World.RezObject(m_host, item, pos, rot, vel, param);
3133 3105
3134 // If either of these are null, then there was an unknown error. 3106 // If either of these are null, then there was an unknown error.
3135 if (new_group == null) 3107 if (new_group == null)
@@ -3156,11 +3128,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3156 3128
3157 PhysicsActor pa = new_group.RootPart.PhysActor; 3129 PhysicsActor pa = new_group.RootPart.PhysActor;
3158 3130
3159 if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) 3131 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
3160 { 3132 {
3161 float groupmass = new_group.GetMass(); 3133 float groupmass = new_group.GetMass();
3162 llvel *= -groupmass; 3134 vel *= -groupmass;
3163 llApplyImpulse(new LSL_Vector(llvel.X, llvel.Y,llvel.Z), 0); 3135 llApplyImpulse(vel, 0);
3164 } 3136 }
3165 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 3137 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
3166 return; 3138 return;
@@ -3211,7 +3183,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3211 return; 3183 return;
3212 } 3184 }
3213 3185
3214 m_host.StartLookAt(Rot2Quaternion(r3 * r2 * r1), (float)strength, (float)damping); 3186 m_host.StartLookAt((Quaternion)(r3 * r2 * r1), (float)strength, (float)damping);
3215 } 3187 }
3216 } 3188 }
3217 3189
@@ -3637,7 +3609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3637 } 3609 }
3638 else 3610 else
3639 { 3611 {
3640 m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); 3612 m_host.RotLookAt(target, (float)strength, (float)damping);
3641 } 3613 }
3642 } 3614 }
3643 3615
@@ -3718,7 +3690,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3718 3690
3719 protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) 3691 protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain)
3720 { 3692 {
3721 part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); 3693 part.UpdateAngularVelocity(axis * spinrate);
3722 } 3694 }
3723 3695
3724 public LSL_Integer llGetStartParameter() 3696 public LSL_Integer llGetStartParameter()
@@ -3928,7 +3900,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3928 try 3900 try
3929 { 3901 {
3930 foreach (SceneObjectPart part in parts) 3902 foreach (SceneObjectPart part in parts)
3931 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 3903 part.SetFaceColor(color, face);
3932 } 3904 }
3933 finally 3905 finally
3934 { 3906 {
@@ -4398,9 +4370,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4398 public void llSetText(string text, LSL_Vector color, double alpha) 4370 public void llSetText(string text, LSL_Vector color, double alpha)
4399 { 4371 {
4400 m_host.AddScriptLPS(1); 4372 m_host.AddScriptLPS(1);
4401 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), 4373 Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
4402 Util.Clip((float)color.y, 0.0f, 1.0f),
4403 Util.Clip((float)color.z, 0.0f, 1.0f));
4404 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); 4374 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
4405 //m_host.ParentGroup.HasGroupChanged = true; 4375 //m_host.ParentGroup.HasGroupChanged = true;
4406 //m_host.ParentGroup.ScheduleGroupForFullUpdate(); 4376 //m_host.ParentGroup.ScheduleGroupForFullUpdate();
@@ -4616,14 +4586,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4616 ScriptSleep(5000); 4586 ScriptSleep(5000);
4617 } 4587 }
4618 4588
4619 public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt) 4589 public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
4620 { 4590 {
4621 m_host.AddScriptLPS(1); 4591 m_host.AddScriptLPS(1);
4622 UUID agentId = new UUID(); 4592 UUID agentId = new UUID();
4623 4593
4624 Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
4625 Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
4626
4627 if (UUID.TryParse(agent, out agentId)) 4594 if (UUID.TryParse(agent, out agentId))
4628 { 4595 {
4629 ScenePresence presence = World.GetScenePresence(agentId); 4596 ScenePresence presence = World.GetScenePresence(agentId);
@@ -4652,15 +4619,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4652 } 4619 }
4653 } 4620 }
4654 4621
4655 public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt) 4622 public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt)
4656 { 4623 {
4657 m_host.AddScriptLPS(1); 4624 m_host.AddScriptLPS(1);
4658 UUID agentId = new UUID(); 4625 UUID agentId = new UUID();
4659 4626
4660 ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); 4627 ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y);
4661 4628
4662 Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
4663 Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
4664 if (UUID.TryParse(agent, out agentId)) 4629 if (UUID.TryParse(agent, out agentId))
4665 { 4630 {
4666 ScenePresence presence = World.GetScenePresence(agentId); 4631 ScenePresence presence = World.GetScenePresence(agentId);
@@ -4957,7 +4922,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4957 distance_attenuation = 1f / normalized_units; 4922 distance_attenuation = 1f / normalized_units;
4958 } 4923 }
4959 4924
4960 Vector3 applied_linear_impulse = new Vector3((float)impulse.x, (float)impulse.y, (float)impulse.z); 4925 Vector3 applied_linear_impulse = impulse;
4961 { 4926 {
4962 float impulse_length = applied_linear_impulse.Length(); 4927 float impulse_length = applied_linear_impulse.Length();
4963 4928
@@ -6518,9 +6483,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6518 6483
6519 //Plug the x,y coordinates of the slope normal into the equation of the plane to get 6484 //Plug the x,y coordinates of the slope normal into the equation of the plane to get
6520 //the height of that point on the plane. The resulting vector gives the slope. 6485 //the height of that point on the plane. The resulting vector gives the slope.
6521 Vector3 vsl = new Vector3(); 6486 Vector3 vsl = vsn;
6522 vsl.X = (float)vsn.x;
6523 vsl.Y = (float)vsn.y;
6524 vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z)); 6487 vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z));
6525 vsl.Normalize(); 6488 vsl.Normalize();
6526 //Normalization might be overkill here 6489 //Normalization might be overkill here
@@ -6531,9 +6494,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6531 public LSL_Vector llGroundNormal(LSL_Vector offset) 6494 public LSL_Vector llGroundNormal(LSL_Vector offset)
6532 { 6495 {
6533 m_host.AddScriptLPS(1); 6496 m_host.AddScriptLPS(1);
6534 Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x, 6497 Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
6535 (float)offset.y,
6536 (float)offset.z);
6537 // Clamp to valid position 6498 // Clamp to valid position
6538 if (pos.X < 0) 6499 if (pos.X < 0)
6539 pos.X = 0; 6500 pos.X = 0;
@@ -6987,8 +6948,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6987 6948
6988 if (!m_host.ParentGroup.IsDeleted) 6949 if (!m_host.ParentGroup.IsDeleted)
6989 { 6950 {
6990 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, 6951 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, vec);
6991 new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
6992 } 6952 }
6993 } 6953 }
6994 6954
@@ -7000,7 +6960,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7000 6960
7001 if (!m_host.ParentGroup.IsDeleted) 6961 if (!m_host.ParentGroup.IsDeleted)
7002 { 6962 {
7003 m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, Rot2Quaternion(rot)); 6963 m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, rot);
7004 } 6964 }
7005 } 6965 }
7006 6966
@@ -7030,8 +6990,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7030 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) 6990 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
7031 rot.s = 1; // ZERO_ROTATION = 0,0,0,1 6991 rot.s = 1; // ZERO_ROTATION = 0,0,0,1
7032 6992
7033 part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); 6993 part.SitTargetPosition = offset;
7034 part.SitTargetOrientation = Rot2Quaternion(rot); 6994 part.SitTargetOrientation = rot;
7035 part.ParentGroup.HasGroupChanged = true; 6995 part.ParentGroup.HasGroupChanged = true;
7036 } 6996 }
7037 6997
@@ -7134,13 +7094,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7134 public void llSetCameraEyeOffset(LSL_Vector offset) 7094 public void llSetCameraEyeOffset(LSL_Vector offset)
7135 { 7095 {
7136 m_host.AddScriptLPS(1); 7096 m_host.AddScriptLPS(1);
7137 m_host.SetCameraEyeOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); 7097 m_host.SetCameraEyeOffset(offset);
7138 } 7098 }
7139 7099
7140 public void llSetCameraAtOffset(LSL_Vector offset) 7100 public void llSetCameraAtOffset(LSL_Vector offset)
7141 { 7101 {
7142 m_host.AddScriptLPS(1); 7102 m_host.AddScriptLPS(1);
7143 m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); 7103 m_host.SetCameraAtOffset(offset);
7144 } 7104 }
7145 7105
7146 public LSL_String llDumpList2String(LSL_List src, string seperator) 7106 public LSL_String llDumpList2String(LSL_List src, string seperator)
@@ -7162,7 +7122,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7162 public LSL_Integer llScriptDanger(LSL_Vector pos) 7122 public LSL_Integer llScriptDanger(LSL_Vector pos)
7163 { 7123 {
7164 m_host.AddScriptLPS(1); 7124 m_host.AddScriptLPS(1);
7165 bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z)); 7125 bool result = World.ScriptDanger(m_host.LocalId, pos);
7166 if (result) 7126 if (result)
7167 { 7127 {
7168 return 1; 7128 return 1;
@@ -8096,13 +8056,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8096 if (rootPart == part) 8056 if (rootPart == part)
8097 { 8057 {
8098 // special case: If we are root, rotate complete SOG to new rotation 8058 // special case: If we are root, rotate complete SOG to new rotation
8099 SetRot(part, Rot2Quaternion(q)); 8059 SetRot(part, q);
8100 } 8060 }
8101 else 8061 else
8102 { 8062 {
8103 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 8063 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
8104 // sounds like sl bug that we need to replicate 8064 // sounds like sl bug that we need to replicate
8105 SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); 8065 SetRot(part, rootPart.RotationOffset * (Quaternion)q);
8106 } 8066 }
8107 8067
8108 break; 8068 break;
@@ -8276,7 +8236,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8276 LSL_Vector color=rules.GetVector3Item(idx++); 8236 LSL_Vector color=rules.GetVector3Item(idx++);
8277 double alpha=(double)rules.GetLSLFloatItem(idx++); 8237 double alpha=(double)rules.GetLSLFloatItem(idx++);
8278 8238
8279 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 8239 part.SetFaceColor(color, face);
8280 SetAlpha(part, alpha, face); 8240 SetAlpha(part, alpha, face);
8281 8241
8282 break; 8242 break;
@@ -8425,9 +8385,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8425 string primText = rules.GetLSLStringItem(idx++); 8385 string primText = rules.GetLSLStringItem(idx++);
8426 LSL_Vector primTextColor = rules.GetVector3Item(idx++); 8386 LSL_Vector primTextColor = rules.GetVector3Item(idx++);
8427 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); 8387 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
8428 Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), 8388 Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f);
8429 Util.Clip((float)primTextColor.y, 0.0f, 1.0f),
8430 Util.Clip((float)primTextColor.z, 0.0f, 1.0f));
8431 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); 8389 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
8432 8390
8433 break; 8391 break;
@@ -8446,8 +8404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8446 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8404 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8447 if (remain < 1) 8405 if (remain < 1)
8448 return null; 8406 return null;
8449 LSL_Rotation lr = rules.GetQuaternionItem(idx++); 8407 SetRot(part, rules.GetQuaternionItem(idx++));
8450 SetRot(part, Rot2Quaternion(lr));
8451 break; 8408 break;
8452 case (int)ScriptBaseClass.PRIM_OMEGA: 8409 case (int)ScriptBaseClass.PRIM_OMEGA:
8453 if (remain < 3) 8410 if (remain < 3)
@@ -8457,7 +8414,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8457 LSL_Float gain = rules.GetLSLFloatItem(idx++); 8414 LSL_Float gain = rules.GetLSLFloatItem(idx++);
8458 TargetOmega(part, axis, (double)spinrate, (double)gain); 8415 TargetOmega(part, axis, (double)spinrate, (double)gain);
8459 break; 8416 break;
8460 8417 case (int)ScriptBaseClass.PRIM_SLICE:
8418 if (remain < 1)
8419 return null;
8420 LSL_Vector slice = rules.GetVector3Item(idx++);
8421 part.UpdateSlice((float)slice.x, (float)slice.y);
8422 break;
8461 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 8423 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
8462 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 8424 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
8463 return null; 8425 return null;
@@ -8466,6 +8428,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8466 } 8428 }
8467 } 8429 }
8468 } 8430 }
8431 catch (InvalidCastException e)
8432 {
8433 ShoutError(e.Message);
8434 }
8469 finally 8435 finally
8470 { 8436 {
8471 if (positionChanged) 8437 if (positionChanged)
@@ -8474,12 +8440,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8474 { 8440 {
8475 SceneObjectGroup parent = part.ParentGroup; 8441 SceneObjectGroup parent = part.ParentGroup;
8476 Util.FireAndForget(delegate(object x) { 8442 Util.FireAndForget(delegate(object x) {
8477 parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); 8443 parent.UpdateGroupPosition(currentPosition);
8478 }); 8444 });
8479 } 8445 }
8480 else 8446 else
8481 { 8447 {
8482 part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); 8448 part.OffsetPosition = currentPosition;
8483 SceneObjectGroup parent = part.ParentGroup; 8449 SceneObjectGroup parent = part.ParentGroup;
8484 parent.HasGroupChanged = true; 8450 parent.HasGroupChanged = true;
8485 parent.ScheduleGroupForTerseUpdate(); 8451 parent.ScheduleGroupForTerseUpdate();
@@ -9563,7 +9529,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9563 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 9529 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
9564 res.Add(new LSL_Vector(GetPartLocalPos(part))); 9530 res.Add(new LSL_Vector(GetPartLocalPos(part)));
9565 break; 9531 break;
9566
9567 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 9532 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
9568 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 9533 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
9569 return res; 9534 return res;
@@ -9572,6 +9537,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9572 LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); 9537 LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules);
9573 res += tres; 9538 res += tres;
9574 return res; 9539 return res;
9540 case (int)ScriptBaseClass.PRIM_SLICE:
9541 PrimType prim_type = part.GetPrimType();
9542 bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING);
9543 res.Add(new LSL_Vector(
9544 (useProfileBeginEnd ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0,
9545 1 - (useProfileBeginEnd ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0,
9546 0
9547 ));
9548 break;
9575 } 9549 }
9576 } 9550 }
9577 return res; 9551 return res;
@@ -11157,9 +11131,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11157 ScenePresence avatar = World.GetScenePresence(detectedParams.Key); 11131 ScenePresence avatar = World.GetScenePresence(detectedParams.Key);
11158 if (avatar != null) 11132 if (avatar != null)
11159 { 11133 {
11160 avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname, 11134 avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name,
11161 new Vector3((float)pos.x, (float)pos.y, (float)pos.z), 11135 simname, pos, lookAt);
11162 new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z));
11163 } 11136 }
11164 11137
11165 ScriptSleep(1000); 11138 ScriptSleep(1000);
@@ -11894,13 +11867,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11894 else 11867 else
11895 rot = obj.GetWorldRotation(); 11868 rot = obj.GetWorldRotation();
11896 11869
11897 LSL_Rotation objrot = new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); 11870 LSL_Rotation objrot = new LSL_Rotation(rot);
11898 ret.Add(objrot); 11871 ret.Add(objrot);
11899 } 11872 }
11900 break; 11873 break;
11901 case ScriptBaseClass.OBJECT_VELOCITY: 11874 case ScriptBaseClass.OBJECT_VELOCITY:
11902 Vector3 ovel = obj.Velocity; 11875 ret.Add(new LSL_Vector(obj.Velocity));
11903 ret.Add(new LSL_Vector(ovel.X, ovel.Y, ovel.Z));
11904 break; 11876 break;
11905 case ScriptBaseClass.OBJECT_OWNER: 11877 case ScriptBaseClass.OBJECT_OWNER:
11906 ret.Add(new LSL_String(obj.OwnerID.ToString())); 11878 ret.Add(new LSL_String(obj.OwnerID.ToString()));
@@ -12506,8 +12478,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12506 12478
12507 m_host.AddScriptLPS(1); 12479 m_host.AddScriptLPS(1);
12508 12480
12509 Vector3 rayStart = new Vector3((float)start.x, (float)start.y, (float)start.z); 12481 Vector3 rayStart = start;
12510 Vector3 rayEnd = new Vector3((float)end.x, (float)end.y, (float)end.z); 12482 Vector3 rayEnd = end;
12511 Vector3 dir = rayEnd - rayStart; 12483 Vector3 dir = rayEnd - rayStart;
12512 12484
12513 float dist = Vector3.Mag(dir); 12485 float dist = Vector3.Mag(dir);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 795de80..ceb4660 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -304,7 +304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
304 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: 304 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
305 idx++; 305 idx++;
306 iV = rules.GetVector3Item(idx); 306 iV = rules.GetVector3Item(idx);
307 wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); 307 wl.cloudDetailXYDensity = iV;
308 break; 308 break;
309 case (int)ScriptBaseClass.WL_CLOUD_SCALE: 309 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
310 idx++; 310 idx++;
@@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
329 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: 329 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
330 idx++; 330 idx++;
331 iV = rules.GetVector3Item(idx); 331 iV = rules.GetVector3Item(idx);
332 wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); 332 wl.cloudXYDensity = iV;
333 break; 333 break;
334 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: 334 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
335 idx++; 335 idx++;
@@ -384,7 +384,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
384 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: 384 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
385 idx++; 385 idx++;
386 iV = rules.GetVector3Item(idx); 386 iV = rules.GetVector3Item(idx);
387 wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); 387 wl.reflectionWaveletScale = iV;
388 break; 388 break;
389 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: 389 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
390 idx++; 390 idx++;
@@ -422,7 +422,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
422 case (int)ScriptBaseClass.WL_WATER_COLOR: 422 case (int)ScriptBaseClass.WL_WATER_COLOR:
423 idx++; 423 idx++;
424 iV = rules.GetVector3Item(idx); 424 iV = rules.GetVector3Item(idx);
425 wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); 425 wl.waterColor = iV;
426 break; 426 break;
427 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: 427 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
428 idx++; 428 idx++;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 7844c75..84cf6ca 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -333,8 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
333 { 333 {
334 if (type == typeof(OpenMetaverse.Quaternion)) 334 if (type == typeof(OpenMetaverse.Quaternion))
335 { 335 {
336 LSL_Rotation rot = (LSL_Rotation)lslparm; 336 return (OpenMetaverse.Quaternion)((LSL_Rotation)lslparm);
337 return new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s);
338 } 337 }
339 } 338 }
340 339
@@ -343,8 +342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
343 { 342 {
344 if (type == typeof(OpenMetaverse.Vector3)) 343 if (type == typeof(OpenMetaverse.Vector3))
345 { 344 {
346 LSL_Vector vect = (LSL_Vector)lslparm; 345 return (OpenMetaverse.Vector3)((LSL_Vector)lslparm);
347 return new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z);
348 } 346 }
349 } 347 }
350 348
@@ -367,13 +365,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
367 result[i] = new UUID((LSL_Key)plist[i]); 365 result[i] = new UUID((LSL_Key)plist[i]);
368 else if (plist[i] is LSL_Rotation) 366 else if (plist[i] is LSL_Rotation)
369 { 367 {
370 LSL_Rotation rot = (LSL_Rotation)plist[i]; 368 result[i] = (OpenMetaverse.Quaternion)(
371 result[i] = new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s); 369 (LSL_Rotation)plist[i]);
372 } 370 }
373 else if (plist[i] is LSL_Vector) 371 else if (plist[i] is LSL_Vector)
374 { 372 {
375 LSL_Vector vect = (LSL_Vector)plist[i]; 373 result[i] = (OpenMetaverse.Vector3)(
376 result[i] = new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z); 374 (LSL_Vector)plist[i]);
377 } 375 }
378 else 376 else
379 MODError("unknown LSL list element type"); 377 MODError("unknown LSL list element type");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 2f02f1f..37766fb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -782,10 +782,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
782 782
783 // We will launch the teleport on a new thread so that when the script threads are terminated 783 // We will launch the teleport on a new thread so that when the script threads are terminated
784 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. 784 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
785 Util.FireAndForget( 785 Util.FireAndForget(o => World.RequestTeleportLocation(
786 o => World.RequestTeleportLocation(presence.ControllingClient, regionName, 786 presence.ControllingClient, regionName, position,
787 new Vector3((float)position.x, (float)position.y, (float)position.z), 787 lookat, (uint)TPFlags.ViaLocation));
788 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
789 788
790 ScriptSleep(5000); 789 ScriptSleep(5000);
791 790
@@ -828,10 +827,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
828 827
829 // We will launch the teleport on a new thread so that when the script threads are terminated 828 // We will launch the teleport on a new thread so that when the script threads are terminated
830 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. 829 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
831 Util.FireAndForget( 830 Util.FireAndForget(o => World.RequestTeleportLocation(
832 o => World.RequestTeleportLocation(presence.ControllingClient, regionHandle, 831 presence.ControllingClient, regionHandle,
833 new Vector3((float)position.x, (float)position.y, (float)position.z), 832 position, lookat, (uint)TPFlags.ViaLocation));
834 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
835 833
836 ScriptSleep(5000); 834 ScriptSleep(5000);
837 835
@@ -2355,7 +2353,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2355 ownerID = m_host.OwnerID; 2353 ownerID = m_host.OwnerID;
2356 UUID x = module.CreateNPC(firstname, 2354 UUID x = module.CreateNPC(firstname,
2357 lastname, 2355 lastname,
2358 new Vector3((float) position.x, (float) position.y, (float) position.z), 2356 position,
2359 ownerID, 2357 ownerID,
2360 senseAsAgent, 2358 senseAsAgent,
2361 World, 2359 World,
@@ -2478,7 +2476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2478 return new LSL_Vector(0, 0, 0); 2476 return new LSL_Vector(0, 0, 0);
2479 } 2477 }
2480 2478
2481 public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) 2479 public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos)
2482 { 2480 {
2483 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); 2481 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
2484 m_host.AddScriptLPS(1); 2482 m_host.AddScriptLPS(1);
@@ -2493,7 +2491,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2493 if (!module.CheckPermissions(npcId, m_host.OwnerID)) 2491 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2494 return; 2492 return;
2495 2493
2496 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
2497 module.MoveToTarget(npcId, World, pos, false, true, false); 2494 module.MoveToTarget(npcId, World, pos, false, true, false);
2498 } 2495 }
2499 } 2496 }
@@ -2513,11 +2510,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2513 if (!module.CheckPermissions(npcId, m_host.OwnerID)) 2510 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2514 return; 2511 return;
2515 2512
2516 Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z);
2517 module.MoveToTarget( 2513 module.MoveToTarget(
2518 new UUID(npc.m_string), 2514 new UUID(npc.m_string),
2519 World, 2515 World,
2520 pos, 2516 target,
2521 (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, 2517 (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0,
2522 (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0, 2518 (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0,
2523 (options & ScriptBaseClass.OS_NPC_RUNNING) != 0); 2519 (options & ScriptBaseClass.OS_NPC_RUNNING) != 0);
@@ -2569,7 +2565,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2569 ScenePresence sp = World.GetScenePresence(npcId); 2565 ScenePresence sp = World.GetScenePresence(npcId);
2570 2566
2571 if (sp != null) 2567 if (sp != null)
2572 sp.Rotation = LSL_Api.Rot2Quaternion(rotation); 2568 sp.Rotation = rotation;
2573 } 2569 }
2574 } 2570 }
2575 2571
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 678f9d5..4dd795d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -352,7 +352,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
352 q = avatar.Rotation; 352 q = avatar.Rotation;
353 } 353 }
354 354
355 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 355 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);
356 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); 356 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
357 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); 357 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
358 358
@@ -429,9 +429,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
429 try 429 try
430 { 430 {
431 Vector3 diff = toRegionPos - fromRegionPos; 431 Vector3 diff = toRegionPos - fromRegionPos;
432 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z); 432 double dot = LSL_Types.Vector3.Dot(forward_dir, diff);
433 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir); 433 double mag_obj = LSL_Types.Vector3.Mag(diff);
434 double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
435 ang_obj = Math.Acos(dot / (mag_fwd * mag_obj)); 434 ang_obj = Math.Acos(dot / (mag_fwd * mag_obj));
436 } 435 }
437 catch 436 catch
@@ -483,7 +482,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
483 q = avatar.Rotation; 482 q = avatar.Rotation;
484 } 483 }
485 484
486 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 485 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);
487 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); 486 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
488 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); 487 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
489 bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0); 488 bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0);
@@ -564,8 +563,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
564 double ang_obj = 0; 563 double ang_obj = 0;
565 try 564 try
566 { 565 {
567 Vector3 diff = toRegionPos - fromRegionPos; 566 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(
568 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z); 567 toRegionPos - fromRegionPos);
569 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir); 568 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir);
570 double mag_obj = LSL_Types.Vector3.Mag(obj_dir); 569 double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
571 ang_obj = Math.Acos(dot / (mag_fwd * mag_obj)); 570 ang_obj = Math.Acos(dot / (mag_fwd * mag_obj));
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index f989cc6..05ba222 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -329,6 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
329 public const int PRIM_OMEGA = 32; 329 public const int PRIM_OMEGA = 32;
330 public const int PRIM_POS_LOCAL = 33; 330 public const int PRIM_POS_LOCAL = 33;
331 public const int PRIM_LINK_TARGET = 34; 331 public const int PRIM_LINK_TARGET = 34;
332 public const int PRIM_SLICE = 35;
332 public const int PRIM_TEXGEN_DEFAULT = 0; 333 public const int PRIM_TEXGEN_DEFAULT = 0;
333 public const int PRIM_TEXGEN_PLANAR = 1; 334 public const int PRIM_TEXGEN_PLANAR = 1;
334 335
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 9e5fb24..22804f5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -164,11 +164,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
164 else 164 else
165 { 165 {
166 // Set the values from the touch data provided by the client 166 // Set the values from the touch data provided by the client
167 touchST = new LSL_Types.Vector3(value.STCoord.X, value.STCoord.Y, value.STCoord.Z); 167 touchST = new LSL_Types.Vector3(value.STCoord);
168 touchUV = new LSL_Types.Vector3(value.UVCoord.X, value.UVCoord.Y, value.UVCoord.Z); 168 touchUV = new LSL_Types.Vector3(value.UVCoord);
169 touchNormal = new LSL_Types.Vector3(value.Normal.X, value.Normal.Y, value.Normal.Z); 169 touchNormal = new LSL_Types.Vector3(value.Normal);
170 touchBinormal = new LSL_Types.Vector3(value.Binormal.X, value.Binormal.Y, value.Binormal.Z); 170 touchBinormal = new LSL_Types.Vector3(value.Binormal);
171 touchPos = new LSL_Types.Vector3(value.Position.X, value.Position.Y, value.Position.Z); 171 touchPos = new LSL_Types.Vector3(value.Position);
172 touchFace = value.FaceIndex; 172 touchFace = value.FaceIndex;
173 } 173 }
174 } 174 }
@@ -189,19 +189,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
189 Country = account.UserCountry; 189 Country = account.UserCountry;
190 190
191 Owner = Key; 191 Owner = Key;
192 Position = new LSL_Types.Vector3( 192 Position = new LSL_Types.Vector3(presence.AbsolutePosition);
193 presence.AbsolutePosition.X,
194 presence.AbsolutePosition.Y,
195 presence.AbsolutePosition.Z);
196 Rotation = new LSL_Types.Quaternion( 193 Rotation = new LSL_Types.Quaternion(
197 presence.Rotation.X, 194 presence.Rotation.X,
198 presence.Rotation.Y, 195 presence.Rotation.Y,
199 presence.Rotation.Z, 196 presence.Rotation.Z,
200 presence.Rotation.W); 197 presence.Rotation.W);
201 Velocity = new LSL_Types.Vector3( 198 Velocity = new LSL_Types.Vector3(presence.Velocity);
202 presence.Velocity.X,
203 presence.Velocity.Y,
204 presence.Velocity.Z);
205 199
206 Type = 0x01; // Avatar 200 Type = 0x01; // Avatar
207 if (presence.PresenceType == PresenceType.Npc) 201 if (presence.PresenceType == PresenceType.Npc)
@@ -254,16 +248,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
254 } 248 }
255 } 249 }
256 250
257 Position = new LSL_Types.Vector3(part.AbsolutePosition.X, 251 Position = new LSL_Types.Vector3(part.AbsolutePosition);
258 part.AbsolutePosition.Y,
259 part.AbsolutePosition.Z);
260 252
261 Quaternion wr = part.ParentGroup.GroupRotation; 253 Quaternion wr = part.ParentGroup.GroupRotation;
262 Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W); 254 Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);
263 255
264 Velocity = new LSL_Types.Vector3(part.Velocity.X, 256 Velocity = new LSL_Types.Vector3(part.Velocity);
265 part.Velocity.Y,
266 part.Velocity.Z);
267 } 257 }
268 } 258 }
269 259
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 8adf4c5..c9c4753 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -31,6 +31,11 @@ using System.Globalization;
31using System.Text.RegularExpressions; 31using System.Text.RegularExpressions;
32using OpenSim.Framework; 32using OpenSim.Framework;
33 33
34using OpenMetaverse;
35using OMV_Vector3 = OpenMetaverse.Vector3;
36using OMV_Vector3d = OpenMetaverse.Vector3d;
37using OMV_Quaternion = OpenMetaverse.Quaternion;
38
34namespace OpenSim.Region.ScriptEngine.Shared 39namespace OpenSim.Region.ScriptEngine.Shared
35{ 40{
36 [Serializable] 41 [Serializable]
@@ -54,6 +59,20 @@ namespace OpenSim.Region.ScriptEngine.Shared
54 z = (float)vector.z; 59 z = (float)vector.z;
55 } 60 }
56 61
62 public Vector3(OMV_Vector3 vector)
63 {
64 x = vector.X;
65 y = vector.Y;
66 z = vector.Z;
67 }
68
69 public Vector3(OMV_Vector3d vector)
70 {
71 x = vector.X;
72 y = vector.Y;
73 z = vector.Z;
74 }
75
57 public Vector3(double X, double Y, double Z) 76 public Vector3(double X, double Y, double Z)
58 { 77 {
59 x = X; 78 x = X;
@@ -109,6 +128,26 @@ namespace OpenSim.Region.ScriptEngine.Shared
109 return new list(new object[] { vec }); 128 return new list(new object[] { vec });
110 } 129 }
111 130
131 public static implicit operator OMV_Vector3(Vector3 vec)
132 {
133 return new OMV_Vector3((float)vec.x, (float)vec.y, (float)vec.z);
134 }
135
136 public static implicit operator Vector3(OMV_Vector3 vec)
137 {
138 return new Vector3(vec);
139 }
140
141 public static implicit operator OMV_Vector3d(Vector3 vec)
142 {
143 return new OMV_Vector3d(vec.x, vec.y, vec.z);
144 }
145
146 public static implicit operator Vector3(OMV_Vector3d vec)
147 {
148 return new Vector3(vec);
149 }
150
112 public static bool operator ==(Vector3 lhs, Vector3 rhs) 151 public static bool operator ==(Vector3 lhs, Vector3 rhs)
113 { 152 {
114 return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z); 153 return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z);
@@ -322,6 +361,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
322 s = 1; 361 s = 1;
323 } 362 }
324 363
364 public Quaternion(OMV_Quaternion rot)
365 {
366 x = rot.X;
367 y = rot.Y;
368 z = rot.Z;
369 s = rot.W;
370 }
371
325 #endregion 372 #endregion
326 373
327 #region Overriders 374 #region Overriders
@@ -368,6 +415,21 @@ namespace OpenSim.Region.ScriptEngine.Shared
368 return new list(new object[] { r }); 415 return new list(new object[] { r });
369 } 416 }
370 417
418 public static implicit operator OMV_Quaternion(Quaternion rot)
419 {
420 // LSL quaternions can normalize to 0, normal Quaternions can't.
421 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
422 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
423 OMV_Quaternion omvrot = new OMV_Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
424 omvrot.Normalize();
425 return omvrot;
426 }
427
428 public static implicit operator Quaternion(OMV_Quaternion rot)
429 {
430 return new Quaternion(rot);
431 }
432
371 public static bool operator ==(Quaternion lhs, Quaternion rhs) 433 public static bool operator ==(Quaternion lhs, Quaternion rhs)
372 { 434 {
373 // Return true if the fields match: 435 // Return true if the fields match:
@@ -562,12 +624,23 @@ namespace OpenSim.Region.ScriptEngine.Shared
562 else if (m_data[itemIndex] is LSL_Types.LSLString) 624 else if (m_data[itemIndex] is LSL_Types.LSLString)
563 return new LSLInteger(m_data[itemIndex].ToString()); 625 return new LSLInteger(m_data[itemIndex].ToString());
564 else 626 else
565 throw new InvalidCastException(); 627 throw new InvalidCastException(string.Format(
628 "{0} expected but {1} given",
629 typeof(LSL_Types.LSLInteger).Name,
630 m_data[itemIndex] != null ?
631 m_data[itemIndex].GetType().Name : "null"));
566 } 632 }
567 633
568 public LSL_Types.Vector3 GetVector3Item(int itemIndex) 634 public LSL_Types.Vector3 GetVector3Item(int itemIndex)
569 { 635 {
570 return (LSL_Types.Vector3)m_data[itemIndex]; 636 if(m_data[itemIndex] is LSL_Types.Vector3)
637 return (LSL_Types.Vector3)m_data[itemIndex];
638 else
639 throw new InvalidCastException(string.Format(
640 "{0} expected but {1} given",
641 typeof(LSL_Types.Vector3).Name,
642 m_data[itemIndex] != null ?
643 m_data[itemIndex].GetType().Name : "null"));
571 } 644 }
572 645
573 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) 646 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 5c4174e..cee10df 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -152,9 +152,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
152 det[0] = new DetectParams(); 152 det[0] = new DetectParams();
153 det[0].Key = remoteClient.AgentId; 153 det[0].Key = remoteClient.AgentId;
154 det[0].Populate(myScriptEngine.World); 154 det[0].Populate(myScriptEngine.World);
155 det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X, 155 det[0].OffsetPos = offsetPos;
156 offsetPos.Y,
157 offsetPos.Z);
158 156
159 if (originalID == 0) 157 if (originalID == 0)
160 { 158 {
@@ -298,9 +296,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
298 foreach (DetectedObject detobj in col.Colliders) 296 foreach (DetectedObject detobj in col.Colliders)
299 { 297 {
300 DetectParams d = new DetectParams(); 298 DetectParams d = new DetectParams();
301 d.Position = new LSL_Types.Vector3(detobj.posVector.X, 299 d.Position = detobj.posVector;
302 detobj.posVector.Y,
303 detobj.posVector.Z);
304 d.Populate(myScriptEngine.World); 300 d.Populate(myScriptEngine.World);
305 det.Add(d); 301 det.Add(d);
306 myScriptEngine.PostObjectEvent(localID, new EventParams( 302 myScriptEngine.PostObjectEvent(localID, new EventParams(
@@ -318,9 +314,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
318 foreach (DetectedObject detobj in col.Colliders) 314 foreach (DetectedObject detobj in col.Colliders)
319 { 315 {
320 DetectParams d = new DetectParams(); 316 DetectParams d = new DetectParams();
321 d.Position = new LSL_Types.Vector3(detobj.posVector.X, 317 d.Position = detobj.posVector;
322 detobj.posVector.Y,
323 detobj.posVector.Z);
324 d.Populate(myScriptEngine.World); 318 d.Populate(myScriptEngine.World);
325 det.Add(d); 319 det.Add(d);
326 myScriptEngine.PostObjectEvent(localID, new EventParams( 320 myScriptEngine.PostObjectEvent(localID, new EventParams(
@@ -337,9 +331,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
337 foreach (DetectedObject detobj in col.Colliders) 331 foreach (DetectedObject detobj in col.Colliders)
338 { 332 {
339 DetectParams d = new DetectParams(); 333 DetectParams d = new DetectParams();
340 d.Position = new LSL_Types.Vector3(detobj.posVector.X, 334 d.Position = detobj.posVector;
341 detobj.posVector.Y,
342 detobj.posVector.Z);
343 d.Populate(myScriptEngine.World); 335 d.Populate(myScriptEngine.World);
344 det.Add(d); 336 det.Add(d);
345 myScriptEngine.PostObjectEvent(localID, new EventParams( 337 myScriptEngine.PostObjectEvent(localID, new EventParams(
@@ -381,8 +373,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
381 myScriptEngine.PostObjectEvent(localID, new EventParams( 373 myScriptEngine.PostObjectEvent(localID, new EventParams(
382 "at_target", new object[] { 374 "at_target", new object[] {
383 new LSL_Types.LSLInteger(handle), 375 new LSL_Types.LSLInteger(handle),
384 new LSL_Types.Vector3(targetpos.X,targetpos.Y,targetpos.Z), 376 new LSL_Types.Vector3(targetpos),
385 new LSL_Types.Vector3(atpos.X,atpos.Y,atpos.Z) }, 377 new LSL_Types.Vector3(atpos) },
386 new DetectParams[0])); 378 new DetectParams[0]));
387 } 379 }
388 380
@@ -399,8 +391,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
399 myScriptEngine.PostObjectEvent(localID, new EventParams( 391 myScriptEngine.PostObjectEvent(localID, new EventParams(
400 "at_rot_target", new object[] { 392 "at_rot_target", new object[] {
401 new LSL_Types.LSLInteger(handle), 393 new LSL_Types.LSLInteger(handle),
402 new LSL_Types.Quaternion(targetrot.X,targetrot.Y,targetrot.Z,targetrot.W), 394 new LSL_Types.Quaternion(targetrot),
403 new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) }, 395 new LSL_Types.Quaternion(atrot) },
404 new DetectParams[0])); 396 new DetectParams[0]));
405 } 397 }
406 398
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index f6cb7df..f5ad990 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1053,10 +1053,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1053 return false; 1053 return false;
1054 } 1054 }
1055 1055
1056 UUID assetID = item.AssetID; 1056 m_log.DebugFormat(
1057 "[XEngine] Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
1058 part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
1059 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
1057 1060
1058 //m_log.DebugFormat("[XEngine] Compiling script {0} ({1} on object {2})", 1061 UUID assetID = item.AssetID;
1059 // item.Name, itemID.ToString(), part.ParentGroup.RootPart.Name);
1060 1062
1061 ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID); 1063 ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID);
1062 1064
@@ -1235,10 +1237,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1235 item.Name, startParam, postOnRez, 1237 item.Name, startParam, postOnRez,
1236 stateSource, m_MaxScriptQueue); 1238 stateSource, m_MaxScriptQueue);
1237 1239
1238 m_log.DebugFormat( 1240// m_log.DebugFormat(
1239 "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}", 1241// "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}",
1240 part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, 1242// part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID,
1241 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); 1243// part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
1242 1244
1243 if (presence != null) 1245 if (presence != null)
1244 { 1246 {
@@ -1554,9 +1556,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1554 else if (p[i] is string) 1556 else if (p[i] is string)
1555 lsl_p[i] = new LSL_Types.LSLString((string)p[i]); 1557 lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
1556 else if (p[i] is Vector3) 1558 else if (p[i] is Vector3)
1557 lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z); 1559 lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
1558 else if (p[i] is Quaternion) 1560 else if (p[i] is Quaternion)
1559 lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W); 1561 lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]);
1560 else if (p[i] is float) 1562 else if (p[i] is float)
1561 lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); 1563 lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
1562 else 1564 else
@@ -1580,9 +1582,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1580 else if (p[i] is string) 1582 else if (p[i] is string)
1581 lsl_p[i] = new LSL_Types.LSLString((string)p[i]); 1583 lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
1582 else if (p[i] is Vector3) 1584 else if (p[i] is Vector3)
1583 lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z); 1585 lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
1584 else if (p[i] is Quaternion) 1586 else if (p[i] is Quaternion)
1585 lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W); 1587 lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]);
1586 else if (p[i] is float) 1588 else if (p[i] is float)
1587 lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); 1589 lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
1588 else 1590 else