diff options
9 files changed, 119 insertions, 124 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0ed1ccb..c305f86 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1240,9 +1240,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1240 | public LSL_Float llGround(LSL_Vector offset) | 1240 | public LSL_Float llGround(LSL_Vector offset) |
1241 | { | 1241 | { |
1242 | m_host.AddScriptLPS(1); | 1242 | m_host.AddScriptLPS(1); |
1243 | Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x, | 1243 | Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset; |
1244 | (float)offset.y, | ||
1245 | (float)offset.z); | ||
1246 | 1244 | ||
1247 | //Get the slope normal. This gives us the equation of the plane tangent to the slope. | 1245 | //Get the slope normal. This gives us the equation of the plane tangent to the slope. |
1248 | LSL_Vector vsn = llGroundNormal(offset); | 1246 | LSL_Vector vsn = llGroundNormal(offset); |
@@ -1578,7 +1576,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1578 | if (face == ScriptBaseClass.ALL_SIDES) | 1576 | if (face == ScriptBaseClass.ALL_SIDES) |
1579 | face = SceneObjectPart.ALL_SIDES; | 1577 | face = SceneObjectPart.ALL_SIDES; |
1580 | 1578 | ||
1581 | m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); | 1579 | m_host.SetFaceColor(color, face); |
1582 | } | 1580 | } |
1583 | 1581 | ||
1584 | public void SetTexGen(SceneObjectPart part, int face,int style) | 1582 | public void SetTexGen(SceneObjectPart part, int face,int style) |
@@ -2208,7 +2206,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2208 | 2206 | ||
2209 | bool sameParcel = here.GlobalID == there.GlobalID; | 2207 | bool sameParcel = here.GlobalID == there.GlobalID; |
2210 | 2208 | ||
2211 | if (!sameParcel && !World.Permissions.CanObjectEntry(m_host.UUID, false, new Vector3((float)pos.x, (float)pos.y, (float)pos.z))) | 2209 | if (!sameParcel && !World.Permissions.CanRezObject( |
2210 | m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, pos)) | ||
2212 | { | 2211 | { |
2213 | return 0; | 2212 | return 0; |
2214 | } | 2213 | } |
@@ -2267,16 +2266,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2267 | if (part.ParentGroup.RootPart == part) | 2266 | if (part.ParentGroup.RootPart == part) |
2268 | { | 2267 | { |
2269 | SceneObjectGroup parent = part.ParentGroup; | 2268 | SceneObjectGroup parent = part.ParentGroup; |
2270 | Vector3 dest = new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z); | 2269 | if (!World.Permissions.CanObjectEntry(parent.UUID, false, (Vector3)toPos)) |
2271 | if (!World.Permissions.CanObjectEntry(parent.UUID, false, dest)) | ||
2272 | return; | 2270 | return; |
2273 | Util.FireAndForget(delegate(object x) { | 2271 | Util.FireAndForget(delegate(object x) { |
2274 | parent.UpdateGroupPosition(dest); | 2272 | parent.UpdateGroupPosition((Vector3)toPos); |
2275 | }); | 2273 | }); |
2276 | } | 2274 | } |
2277 | else | 2275 | else |
2278 | { | 2276 | { |
2279 | part.OffsetPosition = new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z); | 2277 | part.OffsetPosition = (Vector3)toPos; |
2280 | SceneObjectGroup parent = part.ParentGroup; | 2278 | SceneObjectGroup parent = part.ParentGroup; |
2281 | parent.HasGroupChanged = true; | 2279 | parent.HasGroupChanged = true; |
2282 | parent.ScheduleGroupForTerseUpdate(); | 2280 | parent.ScheduleGroupForTerseUpdate(); |
@@ -2314,7 +2312,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2314 | pos = part.AbsolutePosition; | 2312 | pos = part.AbsolutePosition; |
2315 | } | 2313 | } |
2316 | 2314 | ||
2317 | return new LSL_Vector(pos.X, pos.Y, pos.Z); | 2315 | // m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos); |
2316 | |||
2317 | return new LSL_Vector(pos); | ||
2318 | } | 2318 | } |
2319 | 2319 | ||
2320 | public void llSetRot(LSL_Rotation rot) | 2320 | public void llSetRot(LSL_Rotation rot) |
@@ -2464,7 +2464,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2464 | if (local != 0) | 2464 | if (local != 0) |
2465 | force *= llGetRot(); | 2465 | force *= llGetRot(); |
2466 | 2466 | ||
2467 | m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z)); | 2467 | m_host.ParentGroup.RootPart.SetForce(force); |
2468 | } | 2468 | } |
2469 | } | 2469 | } |
2470 | 2470 | ||
@@ -2476,10 +2476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2476 | 2476 | ||
2477 | if (!m_host.ParentGroup.IsDeleted) | 2477 | if (!m_host.ParentGroup.IsDeleted) |
2478 | { | 2478 | { |
2479 | Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce(); | 2479 | force = m_host.ParentGroup.RootPart.GetForce(); |
2480 | force.x = tmpForce.X; | ||
2481 | force.y = tmpForce.Y; | ||
2482 | force.z = tmpForce.Z; | ||
2483 | } | 2480 | } |
2484 | 2481 | ||
2485 | return force; | 2482 | return force; |
@@ -2488,8 +2485,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2488 | public LSL_Integer llTarget(LSL_Vector position, double range) | 2485 | public LSL_Integer llTarget(LSL_Vector position, double range) |
2489 | { | 2486 | { |
2490 | m_host.AddScriptLPS(1); | 2487 | m_host.AddScriptLPS(1); |
2491 | return m_host.ParentGroup.registerTargetWaypoint( | 2488 | return m_host.ParentGroup.registerTargetWaypoint(position, |
2492 | new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range); | 2489 | (float)range); |
2493 | } | 2490 | } |
2494 | 2491 | ||
2495 | public void llTargetRemove(int number) | 2492 | public void llTargetRemove(int number) |
@@ -2514,7 +2511,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2514 | public void llMoveToTarget(LSL_Vector target, double tau) | 2511 | public void llMoveToTarget(LSL_Vector target, double tau) |
2515 | { | 2512 | { |
2516 | m_host.AddScriptLPS(1); | 2513 | m_host.AddScriptLPS(1); |
2517 | m_host.MoveToTarget(new Vector3((float)target.x, (float)target.y, (float)target.z), (float)tau); | 2514 | m_host.MoveToTarget(target, (float)tau); |
2518 | } | 2515 | } |
2519 | 2516 | ||
2520 | public void llStopMoveToTarget() | 2517 | public void llStopMoveToTarget() |
@@ -2527,7 +2524,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2527 | { | 2524 | { |
2528 | m_host.AddScriptLPS(1); | 2525 | m_host.AddScriptLPS(1); |
2529 | //No energy force yet | 2526 | //No energy force yet |
2530 | Vector3 v = new Vector3((float)force.x, (float)force.y, (float)force.z); | 2527 | Vector3 v = force; |
2531 | if (v.Length() > 20000.0f) | 2528 | if (v.Length() > 20000.0f) |
2532 | { | 2529 | { |
2533 | v.Normalize(); | 2530 | v.Normalize(); |
@@ -2540,13 +2537,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2540 | public void llApplyRotationalImpulse(LSL_Vector force, int local) | 2537 | public void llApplyRotationalImpulse(LSL_Vector force, int local) |
2541 | { | 2538 | { |
2542 | m_host.AddScriptLPS(1); | 2539 | m_host.AddScriptLPS(1); |
2543 | m_host.ParentGroup.RootPart.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); | 2540 | m_host.ParentGroup.RootPart.ApplyAngularImpulse(force, local != 0); |
2544 | } | 2541 | } |
2545 | 2542 | ||
2546 | public void llSetTorque(LSL_Vector torque, int local) | 2543 | public void llSetTorque(LSL_Vector torque, int local) |
2547 | { | 2544 | { |
2548 | m_host.AddScriptLPS(1); | 2545 | m_host.AddScriptLPS(1); |
2549 | m_host.ParentGroup.RootPart.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0); | 2546 | m_host.ParentGroup.RootPart.SetAngularImpulse(torque, local != 0); |
2550 | } | 2547 | } |
2551 | 2548 | ||
2552 | public LSL_Vector llGetTorque() | 2549 | public LSL_Vector llGetTorque() |
@@ -3111,13 +3108,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3111 | return; | 3108 | return; |
3112 | } | 3109 | } |
3113 | 3110 | ||
3114 | Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); | ||
3115 | Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); | ||
3116 | |||
3117 | // need the magnitude later | 3111 | // need the magnitude later |
3118 | // float velmag = (float)Util.GetMagnitude(llvel); | 3112 | // float velmag = (float)Util.GetMagnitude(llvel); |
3119 | 3113 | ||
3120 | SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param); | 3114 | SceneObjectGroup new_group = World.RezObject(m_host, item, pos, Rot2Quaternion(rot), vel, param); |
3121 | 3115 | ||
3122 | // If either of these are null, then there was an unknown error. | 3116 | // If either of these are null, then there was an unknown error. |
3123 | if (new_group == null) | 3117 | if (new_group == null) |
@@ -3144,11 +3138,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3144 | 3138 | ||
3145 | PhysicsActor pa = new_group.RootPart.PhysActor; | 3139 | PhysicsActor pa = new_group.RootPart.PhysActor; |
3146 | 3140 | ||
3147 | if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) | 3141 | if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) |
3148 | { | 3142 | { |
3149 | float groupmass = new_group.GetMass(); | 3143 | float groupmass = new_group.GetMass(); |
3150 | llvel *= -groupmass; | 3144 | vel *= -groupmass; |
3151 | llApplyImpulse(new LSL_Vector(llvel.X, llvel.Y,llvel.Z), 0); | 3145 | llApplyImpulse(vel, 0); |
3152 | } | 3146 | } |
3153 | // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) | 3147 | // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) |
3154 | return; | 3148 | return; |
@@ -3706,7 +3700,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3706 | 3700 | ||
3707 | protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) | 3701 | protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) |
3708 | { | 3702 | { |
3709 | part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); | 3703 | part.UpdateAngularVelocity(axis * spinrate); |
3710 | } | 3704 | } |
3711 | 3705 | ||
3712 | public LSL_Integer llGetStartParameter() | 3706 | public LSL_Integer llGetStartParameter() |
@@ -3916,7 +3910,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3916 | try | 3910 | try |
3917 | { | 3911 | { |
3918 | foreach (SceneObjectPart part in parts) | 3912 | foreach (SceneObjectPart part in parts) |
3919 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); | 3913 | part.SetFaceColor(color, face); |
3920 | } | 3914 | } |
3921 | finally | 3915 | finally |
3922 | { | 3916 | { |
@@ -4386,8 +4380,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4386 | public void llSetText(string text, LSL_Vector color, double alpha) | 4380 | public void llSetText(string text, LSL_Vector color, double alpha) |
4387 | { | 4381 | { |
4388 | m_host.AddScriptLPS(1); | 4382 | m_host.AddScriptLPS(1); |
4389 | Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y, | 4383 | Vector3 av3 = Util.Clip(color, 0.0f, 1.0f); |
4390 | (float)color.z), 0.0f, 1.0f); | ||
4391 | m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); | 4384 | m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); |
4392 | //m_host.ParentGroup.HasGroupChanged = true; | 4385 | //m_host.ParentGroup.HasGroupChanged = true; |
4393 | //m_host.ParentGroup.ScheduleGroupForFullUpdate(); | 4386 | //m_host.ParentGroup.ScheduleGroupForFullUpdate(); |
@@ -4603,14 +4596,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4603 | ScriptSleep(5000); | 4596 | ScriptSleep(5000); |
4604 | } | 4597 | } |
4605 | 4598 | ||
4606 | public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt) | 4599 | public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt) |
4607 | { | 4600 | { |
4608 | m_host.AddScriptLPS(1); | 4601 | m_host.AddScriptLPS(1); |
4609 | UUID agentId = new UUID(); | 4602 | UUID agentId = new UUID(); |
4610 | 4603 | ||
4611 | Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); | ||
4612 | Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); | ||
4613 | |||
4614 | if (UUID.TryParse(agent, out agentId)) | 4604 | if (UUID.TryParse(agent, out agentId)) |
4615 | { | 4605 | { |
4616 | ScenePresence presence = World.GetScenePresence(agentId); | 4606 | ScenePresence presence = World.GetScenePresence(agentId); |
@@ -4639,15 +4629,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4639 | } | 4629 | } |
4640 | } | 4630 | } |
4641 | 4631 | ||
4642 | public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt) | 4632 | public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt) |
4643 | { | 4633 | { |
4644 | m_host.AddScriptLPS(1); | 4634 | m_host.AddScriptLPS(1); |
4645 | UUID agentId = new UUID(); | 4635 | UUID agentId = new UUID(); |
4646 | 4636 | ||
4647 | ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); | 4637 | ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); |
4648 | 4638 | ||
4649 | Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); | ||
4650 | Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); | ||
4651 | if (UUID.TryParse(agent, out agentId)) | 4639 | if (UUID.TryParse(agent, out agentId)) |
4652 | { | 4640 | { |
4653 | ScenePresence presence = World.GetScenePresence(agentId); | 4641 | ScenePresence presence = World.GetScenePresence(agentId); |
@@ -4944,7 +4932,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4944 | distance_attenuation = 1f / normalized_units; | 4932 | distance_attenuation = 1f / normalized_units; |
4945 | } | 4933 | } |
4946 | 4934 | ||
4947 | Vector3 applied_linear_impulse = new Vector3((float)impulse.x, (float)impulse.y, (float)impulse.z); | 4935 | Vector3 applied_linear_impulse = impulse; |
4948 | { | 4936 | { |
4949 | float impulse_length = applied_linear_impulse.Length(); | 4937 | float impulse_length = applied_linear_impulse.Length(); |
4950 | 4938 | ||
@@ -6505,9 +6493,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6505 | 6493 | ||
6506 | //Plug the x,y coordinates of the slope normal into the equation of the plane to get | 6494 | //Plug the x,y coordinates of the slope normal into the equation of the plane to get |
6507 | //the height of that point on the plane. The resulting vector gives the slope. | 6495 | //the height of that point on the plane. The resulting vector gives the slope. |
6508 | Vector3 vsl = new Vector3(); | 6496 | Vector3 vsl = vsn; |
6509 | vsl.X = (float)vsn.x; | ||
6510 | vsl.Y = (float)vsn.y; | ||
6511 | vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z)); | 6497 | vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z)); |
6512 | vsl.Normalize(); | 6498 | vsl.Normalize(); |
6513 | //Normalization might be overkill here | 6499 | //Normalization might be overkill here |
@@ -6518,9 +6504,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6518 | public LSL_Vector llGroundNormal(LSL_Vector offset) | 6504 | public LSL_Vector llGroundNormal(LSL_Vector offset) |
6519 | { | 6505 | { |
6520 | m_host.AddScriptLPS(1); | 6506 | m_host.AddScriptLPS(1); |
6521 | Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x, | 6507 | Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset; |
6522 | (float)offset.y, | ||
6523 | (float)offset.z); | ||
6524 | // Clamp to valid position | 6508 | // Clamp to valid position |
6525 | if (pos.X < 0) | 6509 | if (pos.X < 0) |
6526 | pos.X = 0; | 6510 | pos.X = 0; |
@@ -6974,8 +6958,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6974 | 6958 | ||
6975 | if (!m_host.ParentGroup.IsDeleted) | 6959 | if (!m_host.ParentGroup.IsDeleted) |
6976 | { | 6960 | { |
6977 | m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, | 6961 | m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, vec); |
6978 | new Vector3((float)vec.x, (float)vec.y, (float)vec.z)); | ||
6979 | } | 6962 | } |
6980 | } | 6963 | } |
6981 | 6964 | ||
@@ -7017,7 +7000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7017 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) | 7000 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) |
7018 | rot.s = 1; // ZERO_ROTATION = 0,0,0,1 | 7001 | rot.s = 1; // ZERO_ROTATION = 0,0,0,1 |
7019 | 7002 | ||
7020 | part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); | 7003 | part.SitTargetPosition = offset; |
7021 | part.SitTargetOrientation = Rot2Quaternion(rot); | 7004 | part.SitTargetOrientation = Rot2Quaternion(rot); |
7022 | part.ParentGroup.HasGroupChanged = true; | 7005 | part.ParentGroup.HasGroupChanged = true; |
7023 | } | 7006 | } |
@@ -7121,13 +7104,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7121 | public void llSetCameraEyeOffset(LSL_Vector offset) | 7104 | public void llSetCameraEyeOffset(LSL_Vector offset) |
7122 | { | 7105 | { |
7123 | m_host.AddScriptLPS(1); | 7106 | m_host.AddScriptLPS(1); |
7124 | m_host.SetCameraEyeOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); | 7107 | m_host.SetCameraEyeOffset(offset); |
7125 | } | 7108 | } |
7126 | 7109 | ||
7127 | public void llSetCameraAtOffset(LSL_Vector offset) | 7110 | public void llSetCameraAtOffset(LSL_Vector offset) |
7128 | { | 7111 | { |
7129 | m_host.AddScriptLPS(1); | 7112 | m_host.AddScriptLPS(1); |
7130 | m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); | 7113 | m_host.SetCameraAtOffset(offset); |
7131 | } | 7114 | } |
7132 | 7115 | ||
7133 | public LSL_String llDumpList2String(LSL_List src, string seperator) | 7116 | public LSL_String llDumpList2String(LSL_List src, string seperator) |
@@ -7149,7 +7132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7149 | public LSL_Integer llScriptDanger(LSL_Vector pos) | 7132 | public LSL_Integer llScriptDanger(LSL_Vector pos) |
7150 | { | 7133 | { |
7151 | m_host.AddScriptLPS(1); | 7134 | m_host.AddScriptLPS(1); |
7152 | bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z)); | 7135 | bool result = World.ScriptDanger(m_host.LocalId, pos); |
7153 | if (result) | 7136 | if (result) |
7154 | { | 7137 | { |
7155 | return 1; | 7138 | return 1; |
@@ -8263,7 +8246,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8263 | LSL_Vector color=rules.GetVector3Item(idx++); | 8246 | LSL_Vector color=rules.GetVector3Item(idx++); |
8264 | double alpha=(double)rules.GetLSLFloatItem(idx++); | 8247 | double alpha=(double)rules.GetLSLFloatItem(idx++); |
8265 | 8248 | ||
8266 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); | 8249 | part.SetFaceColor(color, face); |
8267 | SetAlpha(part, alpha, face); | 8250 | SetAlpha(part, alpha, face); |
8268 | 8251 | ||
8269 | break; | 8252 | break; |
@@ -8412,9 +8395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8412 | string primText = rules.GetLSLStringItem(idx++); | 8395 | string primText = rules.GetLSLStringItem(idx++); |
8413 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); | 8396 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); |
8414 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); | 8397 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); |
8415 | Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x, | 8398 | Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f); |
8416 | (float)primTextColor.y, | ||
8417 | (float)primTextColor.z), 0.0f, 1.0f); | ||
8418 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); | 8399 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); |
8419 | 8400 | ||
8420 | break; | 8401 | break; |
@@ -8470,12 +8451,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8470 | { | 8451 | { |
8471 | SceneObjectGroup parent = part.ParentGroup; | 8452 | SceneObjectGroup parent = part.ParentGroup; |
8472 | Util.FireAndForget(delegate(object x) { | 8453 | Util.FireAndForget(delegate(object x) { |
8473 | parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | 8454 | parent.UpdateGroupPosition(currentPosition); |
8474 | }); | 8455 | }); |
8475 | } | 8456 | } |
8476 | else | 8457 | else |
8477 | { | 8458 | { |
8478 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | 8459 | part.OffsetPosition = currentPosition; |
8479 | SceneObjectGroup parent = part.ParentGroup; | 8460 | SceneObjectGroup parent = part.ParentGroup; |
8480 | parent.HasGroupChanged = true; | 8461 | parent.HasGroupChanged = true; |
8481 | parent.ScheduleGroupForTerseUpdate(); | 8462 | parent.ScheduleGroupForTerseUpdate(); |
@@ -11161,9 +11142,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11161 | ScenePresence avatar = World.GetScenePresence(detectedParams.Key); | 11142 | ScenePresence avatar = World.GetScenePresence(detectedParams.Key); |
11162 | if (avatar != null) | 11143 | if (avatar != null) |
11163 | { | 11144 | { |
11164 | avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname, | 11145 | avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, |
11165 | new Vector3((float)pos.x, (float)pos.y, (float)pos.z), | 11146 | simname, pos, lookAt); |
11166 | new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z)); | ||
11167 | } | 11147 | } |
11168 | 11148 | ||
11169 | ScriptSleep(1000); | 11149 | ScriptSleep(1000); |
@@ -12510,8 +12490,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12510 | 12490 | ||
12511 | m_host.AddScriptLPS(1); | 12491 | m_host.AddScriptLPS(1); |
12512 | 12492 | ||
12513 | Vector3 rayStart = new Vector3((float)start.x, (float)start.y, (float)start.z); | 12493 | Vector3 rayStart = start; |
12514 | Vector3 rayEnd = new Vector3((float)end.x, (float)end.y, (float)end.z); | 12494 | Vector3 rayEnd = end; |
12515 | Vector3 dir = rayEnd - rayStart; | 12495 | Vector3 dir = rayEnd - rayStart; |
12516 | 12496 | ||
12517 | float dist = Vector3.Mag(dir); | 12497 | 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..929948b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | |||
@@ -343,8 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
343 | { | 343 | { |
344 | if (type == typeof(OpenMetaverse.Vector3)) | 344 | if (type == typeof(OpenMetaverse.Vector3)) |
345 | { | 345 | { |
346 | LSL_Vector vect = (LSL_Vector)lslparm; | 346 | return (OpenMetaverse.Vector3)((LSL_Vector)lslparm); |
347 | return new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z); | ||
348 | } | 347 | } |
349 | } | 348 | } |
350 | 349 | ||
@@ -372,8 +371,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
372 | } | 371 | } |
373 | else if (plist[i] is LSL_Vector) | 372 | else if (plist[i] is LSL_Vector) |
374 | { | 373 | { |
375 | LSL_Vector vect = (LSL_Vector)plist[i]; | 374 | result[i] = (OpenMetaverse.Vector3)( |
376 | result[i] = new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z); | 375 | (LSL_Vector)plist[i]); |
377 | } | 376 | } |
378 | else | 377 | else |
379 | MODError("unknown LSL list element type"); | 378 | 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..321d1d8 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); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 678f9d5..8b3be4a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -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 |
@@ -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/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 46772ef..4ab2f23 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -31,6 +31,11 @@ using System.Globalization; | |||
31 | using System.Text.RegularExpressions; | 31 | using System.Text.RegularExpressions; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | 33 | ||
34 | using OpenMetaverse; | ||
35 | using OMV_Vector3 = OpenMetaverse.Vector3; | ||
36 | using OMV_Vector3d = OpenMetaverse.Vector3d; | ||
37 | using OMV_Quaternion = OpenMetaverse.Quaternion; | ||
38 | |||
34 | namespace OpenSim.Region.ScriptEngine.Shared | 39 | namespace 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); |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 5c4174e..a1ad07d 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 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index da22f85..eee5d7b 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1556,7 +1556,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1556 | else if (p[i] is string) | 1556 | else if (p[i] is string) |
1557 | lsl_p[i] = new LSL_Types.LSLString((string)p[i]); | 1557 | lsl_p[i] = new LSL_Types.LSLString((string)p[i]); |
1558 | else if (p[i] is Vector3) | 1558 | else if (p[i] is Vector3) |
1559 | 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]); |
1560 | else if (p[i] is Quaternion) | 1560 | else if (p[i] is Quaternion) |
1561 | 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]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W); |
1562 | else if (p[i] is float) | 1562 | else if (p[i] is float) |
@@ -1582,7 +1582,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1582 | else if (p[i] is string) | 1582 | else if (p[i] is string) |
1583 | lsl_p[i] = new LSL_Types.LSLString((string)p[i]); | 1583 | lsl_p[i] = new LSL_Types.LSLString((string)p[i]); |
1584 | else if (p[i] is Vector3) | 1584 | else if (p[i] is Vector3) |
1585 | 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]); |
1586 | else if (p[i] is Quaternion) | 1586 | else if (p[i] is Quaternion) |
1587 | 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]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W); |
1588 | else if (p[i] is float) | 1588 | else if (p[i] is float) |