diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
6 files changed, 110 insertions, 144 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3e1b43e..434638d 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 | ||
@@ -6525,9 +6490,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6525 | 6490 | ||
6526 | //Plug the x,y coordinates of the slope normal into the equation of the plane to get | 6491 | //Plug the x,y coordinates of the slope normal into the equation of the plane to get |
6527 | //the height of that point on the plane. The resulting vector gives the slope. | 6492 | //the height of that point on the plane. The resulting vector gives the slope. |
6528 | Vector3 vsl = new Vector3(); | 6493 | Vector3 vsl = vsn; |
6529 | vsl.X = (float)vsn.x; | ||
6530 | vsl.Y = (float)vsn.y; | ||
6531 | vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z)); | 6494 | vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z)); |
6532 | vsl.Normalize(); | 6495 | vsl.Normalize(); |
6533 | //Normalization might be overkill here | 6496 | //Normalization might be overkill here |
@@ -6538,9 +6501,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6538 | public LSL_Vector llGroundNormal(LSL_Vector offset) | 6501 | public LSL_Vector llGroundNormal(LSL_Vector offset) |
6539 | { | 6502 | { |
6540 | m_host.AddScriptLPS(1); | 6503 | m_host.AddScriptLPS(1); |
6541 | Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x, | 6504 | Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset; |
6542 | (float)offset.y, | ||
6543 | (float)offset.z); | ||
6544 | // Clamp to valid position | 6505 | // Clamp to valid position |
6545 | if (pos.X < 0) | 6506 | if (pos.X < 0) |
6546 | pos.X = 0; | 6507 | pos.X = 0; |
@@ -6994,8 +6955,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6994 | 6955 | ||
6995 | if (!m_host.ParentGroup.IsDeleted) | 6956 | if (!m_host.ParentGroup.IsDeleted) |
6996 | { | 6957 | { |
6997 | m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, | 6958 | m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, vec); |
6998 | new Vector3((float)vec.x, (float)vec.y, (float)vec.z)); | ||
6999 | } | 6959 | } |
7000 | } | 6960 | } |
7001 | 6961 | ||
@@ -7007,7 +6967,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7007 | 6967 | ||
7008 | if (!m_host.ParentGroup.IsDeleted) | 6968 | if (!m_host.ParentGroup.IsDeleted) |
7009 | { | 6969 | { |
7010 | m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, Rot2Quaternion(rot)); | 6970 | m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, rot); |
7011 | } | 6971 | } |
7012 | } | 6972 | } |
7013 | 6973 | ||
@@ -7037,8 +6997,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7037 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) | 6997 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) |
7038 | rot.s = 1; // ZERO_ROTATION = 0,0,0,1 | 6998 | rot.s = 1; // ZERO_ROTATION = 0,0,0,1 |
7039 | 6999 | ||
7040 | part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); | 7000 | part.SitTargetPosition = offset; |
7041 | part.SitTargetOrientation = Rot2Quaternion(rot); | 7001 | part.SitTargetOrientation = rot; |
7042 | part.ParentGroup.HasGroupChanged = true; | 7002 | part.ParentGroup.HasGroupChanged = true; |
7043 | } | 7003 | } |
7044 | 7004 | ||
@@ -7141,13 +7101,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7141 | public void llSetCameraEyeOffset(LSL_Vector offset) | 7101 | public void llSetCameraEyeOffset(LSL_Vector offset) |
7142 | { | 7102 | { |
7143 | m_host.AddScriptLPS(1); | 7103 | m_host.AddScriptLPS(1); |
7144 | m_host.SetCameraEyeOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); | 7104 | m_host.SetCameraEyeOffset(offset); |
7145 | } | 7105 | } |
7146 | 7106 | ||
7147 | public void llSetCameraAtOffset(LSL_Vector offset) | 7107 | public void llSetCameraAtOffset(LSL_Vector offset) |
7148 | { | 7108 | { |
7149 | m_host.AddScriptLPS(1); | 7109 | m_host.AddScriptLPS(1); |
7150 | m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); | 7110 | m_host.SetCameraAtOffset(offset); |
7151 | } | 7111 | } |
7152 | 7112 | ||
7153 | public LSL_String llDumpList2String(LSL_List src, string seperator) | 7113 | public LSL_String llDumpList2String(LSL_List src, string seperator) |
@@ -7169,7 +7129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7169 | public LSL_Integer llScriptDanger(LSL_Vector pos) | 7129 | public LSL_Integer llScriptDanger(LSL_Vector pos) |
7170 | { | 7130 | { |
7171 | m_host.AddScriptLPS(1); | 7131 | m_host.AddScriptLPS(1); |
7172 | bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z)); | 7132 | bool result = World.ScriptDanger(m_host.LocalId, pos); |
7173 | if (result) | 7133 | if (result) |
7174 | { | 7134 | { |
7175 | return 1; | 7135 | return 1; |
@@ -8103,13 +8063,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8103 | if (rootPart == part) | 8063 | if (rootPart == part) |
8104 | { | 8064 | { |
8105 | // special case: If we are root, rotate complete SOG to new rotation | 8065 | // special case: If we are root, rotate complete SOG to new rotation |
8106 | SetRot(part, Rot2Quaternion(q)); | 8066 | SetRot(part, q); |
8107 | } | 8067 | } |
8108 | else | 8068 | else |
8109 | { | 8069 | { |
8110 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | 8070 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
8111 | // sounds like sl bug that we need to replicate | 8071 | // sounds like sl bug that we need to replicate |
8112 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); | 8072 | SetRot(part, rootPart.RotationOffset * (Quaternion)q); |
8113 | } | 8073 | } |
8114 | 8074 | ||
8115 | break; | 8075 | break; |
@@ -8283,7 +8243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8283 | LSL_Vector color=rules.GetVector3Item(idx++); | 8243 | LSL_Vector color=rules.GetVector3Item(idx++); |
8284 | double alpha=(double)rules.GetLSLFloatItem(idx++); | 8244 | double alpha=(double)rules.GetLSLFloatItem(idx++); |
8285 | 8245 | ||
8286 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); | 8246 | part.SetFaceColor(color, face); |
8287 | SetAlpha(part, alpha, face); | 8247 | SetAlpha(part, alpha, face); |
8288 | 8248 | ||
8289 | break; | 8249 | break; |
@@ -8432,9 +8392,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8432 | string primText = rules.GetLSLStringItem(idx++); | 8392 | string primText = rules.GetLSLStringItem(idx++); |
8433 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); | 8393 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); |
8434 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); | 8394 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); |
8435 | Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), | 8395 | Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f); |
8436 | Util.Clip((float)primTextColor.y, 0.0f, 1.0f), | ||
8437 | Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); | ||
8438 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); | 8396 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); |
8439 | 8397 | ||
8440 | break; | 8398 | break; |
@@ -8453,8 +8411,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8453 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 8411 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
8454 | if (remain < 1) | 8412 | if (remain < 1) |
8455 | return null; | 8413 | return null; |
8456 | LSL_Rotation lr = rules.GetQuaternionItem(idx++); | 8414 | SetRot(part, rules.GetQuaternionItem(idx++)); |
8457 | SetRot(part, Rot2Quaternion(lr)); | ||
8458 | break; | 8415 | break; |
8459 | case (int)ScriptBaseClass.PRIM_OMEGA: | 8416 | case (int)ScriptBaseClass.PRIM_OMEGA: |
8460 | if (remain < 3) | 8417 | if (remain < 3) |
@@ -8464,7 +8421,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8464 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | 8421 | LSL_Float gain = rules.GetLSLFloatItem(idx++); |
8465 | TargetOmega(part, axis, (double)spinrate, (double)gain); | 8422 | TargetOmega(part, axis, (double)spinrate, (double)gain); |
8466 | break; | 8423 | break; |
8467 | 8424 | case (int)ScriptBaseClass.PRIM_SLICE: | |
8425 | if (remain < 1) | ||
8426 | return null; | ||
8427 | LSL_Vector slice = rules.GetVector3Item(idx++); | ||
8428 | part.UpdateSlice((float)slice.x, (float)slice.y); | ||
8429 | break; | ||
8468 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 8430 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
8469 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 8431 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
8470 | return null; | 8432 | return null; |
@@ -8473,6 +8435,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8473 | } | 8435 | } |
8474 | } | 8436 | } |
8475 | } | 8437 | } |
8438 | catch (InvalidCastException e) | ||
8439 | { | ||
8440 | ShoutError(e.Message); | ||
8441 | } | ||
8476 | finally | 8442 | finally |
8477 | { | 8443 | { |
8478 | if (positionChanged) | 8444 | if (positionChanged) |
@@ -8481,12 +8447,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8481 | { | 8447 | { |
8482 | SceneObjectGroup parent = part.ParentGroup; | 8448 | SceneObjectGroup parent = part.ParentGroup; |
8483 | Util.FireAndForget(delegate(object x) { | 8449 | Util.FireAndForget(delegate(object x) { |
8484 | parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | 8450 | parent.UpdateGroupPosition(currentPosition); |
8485 | }); | 8451 | }); |
8486 | } | 8452 | } |
8487 | else | 8453 | else |
8488 | { | 8454 | { |
8489 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | 8455 | part.OffsetPosition = currentPosition; |
8490 | SceneObjectGroup parent = part.ParentGroup; | 8456 | SceneObjectGroup parent = part.ParentGroup; |
8491 | parent.HasGroupChanged = true; | 8457 | parent.HasGroupChanged = true; |
8492 | parent.ScheduleGroupForTerseUpdate(); | 8458 | parent.ScheduleGroupForTerseUpdate(); |
@@ -9570,7 +9536,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9570 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 9536 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
9571 | res.Add(new LSL_Vector(GetPartLocalPos(part))); | 9537 | res.Add(new LSL_Vector(GetPartLocalPos(part))); |
9572 | break; | 9538 | break; |
9573 | |||
9574 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 9539 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
9575 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 9540 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
9576 | return res; | 9541 | return res; |
@@ -9579,6 +9544,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9579 | LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | 9544 | LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); |
9580 | res += tres; | 9545 | res += tres; |
9581 | return res; | 9546 | return res; |
9547 | case (int)ScriptBaseClass.PRIM_SLICE: | ||
9548 | PrimType prim_type = part.GetPrimType(); | ||
9549 | bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); | ||
9550 | res.Add(new LSL_Vector( | ||
9551 | (useProfileBeginEnd ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0, | ||
9552 | 1 - (useProfileBeginEnd ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0, | ||
9553 | 0 | ||
9554 | )); | ||
9555 | break; | ||
9582 | } | 9556 | } |
9583 | } | 9557 | } |
9584 | return res; | 9558 | return res; |
@@ -11164,9 +11138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11164 | ScenePresence avatar = World.GetScenePresence(detectedParams.Key); | 11138 | ScenePresence avatar = World.GetScenePresence(detectedParams.Key); |
11165 | if (avatar != null) | 11139 | if (avatar != null) |
11166 | { | 11140 | { |
11167 | avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname, | 11141 | avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, |
11168 | new Vector3((float)pos.x, (float)pos.y, (float)pos.z), | 11142 | simname, pos, lookAt); |
11169 | new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z)); | ||
11170 | } | 11143 | } |
11171 | 11144 | ||
11172 | ScriptSleep(1000); | 11145 | ScriptSleep(1000); |
@@ -11901,13 +11874,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11901 | else | 11874 | else |
11902 | rot = obj.GetWorldRotation(); | 11875 | rot = obj.GetWorldRotation(); |
11903 | 11876 | ||
11904 | LSL_Rotation objrot = new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); | 11877 | LSL_Rotation objrot = new LSL_Rotation(rot); |
11905 | ret.Add(objrot); | 11878 | ret.Add(objrot); |
11906 | } | 11879 | } |
11907 | break; | 11880 | break; |
11908 | case ScriptBaseClass.OBJECT_VELOCITY: | 11881 | case ScriptBaseClass.OBJECT_VELOCITY: |
11909 | Vector3 ovel = obj.Velocity; | 11882 | ret.Add(new LSL_Vector(obj.Velocity)); |
11910 | ret.Add(new LSL_Vector(ovel.X, ovel.Y, ovel.Z)); | ||
11911 | break; | 11883 | break; |
11912 | case ScriptBaseClass.OBJECT_OWNER: | 11884 | case ScriptBaseClass.OBJECT_OWNER: |
11913 | ret.Add(new LSL_String(obj.OwnerID.ToString())); | 11885 | ret.Add(new LSL_String(obj.OwnerID.ToString())); |
@@ -12513,8 +12485,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12513 | 12485 | ||
12514 | m_host.AddScriptLPS(1); | 12486 | m_host.AddScriptLPS(1); |
12515 | 12487 | ||
12516 | Vector3 rayStart = new Vector3((float)start.x, (float)start.y, (float)start.z); | 12488 | Vector3 rayStart = start; |
12517 | Vector3 rayEnd = new Vector3((float)end.x, (float)end.y, (float)end.z); | 12489 | Vector3 rayEnd = end; |
12518 | Vector3 dir = rayEnd - rayStart; | 12490 | Vector3 dir = rayEnd - rayStart; |
12519 | 12491 | ||
12520 | float dist = Vector3.Mag(dir); | 12492 | 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 | ||