aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs107
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs9
5 files changed, 63 insertions, 90 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fceae02..bca9a75 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1097,9 +1097,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1097 public LSL_Float llGround(LSL_Vector offset) 1097 public LSL_Float llGround(LSL_Vector offset)
1098 { 1098 {
1099 m_host.AddScriptLPS(1); 1099 m_host.AddScriptLPS(1);
1100 Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x, 1100 Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
1101 (float)offset.y,
1102 (float)offset.z);
1103 1101
1104 //Get the slope normal. This gives us the equation of the plane tangent to the slope. 1102 //Get the slope normal. This gives us the equation of the plane tangent to the slope.
1105 LSL_Vector vsn = llGroundNormal(offset); 1103 LSL_Vector vsn = llGroundNormal(offset);
@@ -1387,7 +1385,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1387 if (face == ScriptBaseClass.ALL_SIDES) 1385 if (face == ScriptBaseClass.ALL_SIDES)
1388 face = SceneObjectPart.ALL_SIDES; 1386 face = SceneObjectPart.ALL_SIDES;
1389 1387
1390 m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 1388 m_host.SetFaceColor(color, face);
1391 } 1389 }
1392 1390
1393 public void SetTexGen(SceneObjectPart part, int face,int style) 1391 public void SetTexGen(SceneObjectPart part, int face,int style)
@@ -1974,7 +1972,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1974 1972
1975 bool sameParcel = here.GlobalID == there.GlobalID; 1973 bool sameParcel = here.GlobalID == there.GlobalID;
1976 1974
1977 if (!sameParcel && !World.Permissions.CanRezObject(m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, new Vector3((float)pos.x, (float)pos.y, (float)pos.z))) 1975 if (!sameParcel && !World.Permissions.CanRezObject(
1976 m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, pos))
1978 { 1977 {
1979 return 0; 1978 return 0;
1980 } 1979 }
@@ -2034,13 +2033,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2034 if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0) 2033 if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0)
2035 targetPos.z = ground; 2034 targetPos.z = ground;
2036 SceneObjectGroup parent = part.ParentGroup; 2035 SceneObjectGroup parent = part.ParentGroup;
2037 LSL_Vector real_vec = !adjust ? targetPos : SetPosAdjust(currentPos, targetPos); 2036 parent.UpdateGroupPosition(!adjust ? targetPos :
2038 parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); 2037 SetPosAdjust(currentPos, targetPos));
2039 } 2038 }
2040 else 2039 else
2041 { 2040 {
2042 LSL_Vector rel_vec = !adjust ? targetPos : SetPosAdjust(currentPos, targetPos); 2041 part.OffsetPosition = !adjust ? targetPos : SetPosAdjust(
2043 part.OffsetPosition = new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z); 2042 currentPos, targetPos);
2044 SceneObjectGroup parent = part.ParentGroup; 2043 SceneObjectGroup parent = part.ParentGroup;
2045 parent.HasGroupChanged = true; 2044 parent.HasGroupChanged = true;
2046 parent.ScheduleGroupForTerseUpdate(); 2045 parent.ScheduleGroupForTerseUpdate();
@@ -2084,7 +2083,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2084 2083
2085// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos); 2084// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
2086 2085
2087 return new LSL_Vector(pos.X, pos.Y, pos.Z); 2086 return new LSL_Vector(pos);
2088 } 2087 }
2089 2088
2090 public void llSetRot(LSL_Rotation rot) 2089 public void llSetRot(LSL_Rotation rot)
@@ -2198,7 +2197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2198 if (local != 0) 2197 if (local != 0)
2199 force *= llGetRot(); 2198 force *= llGetRot();
2200 2199
2201 m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z)); 2200 m_host.ParentGroup.RootPart.SetForce(force);
2202 } 2201 }
2203 } 2202 }
2204 2203
@@ -2210,10 +2209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2210 2209
2211 if (!m_host.ParentGroup.IsDeleted) 2210 if (!m_host.ParentGroup.IsDeleted)
2212 { 2211 {
2213 Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce(); 2212 force = m_host.ParentGroup.RootPart.GetForce();
2214 force.x = tmpForce.X;
2215 force.y = tmpForce.Y;
2216 force.z = tmpForce.Z;
2217 } 2213 }
2218 2214
2219 return force; 2215 return force;
@@ -2222,8 +2218,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2222 public LSL_Integer llTarget(LSL_Vector position, double range) 2218 public LSL_Integer llTarget(LSL_Vector position, double range)
2223 { 2219 {
2224 m_host.AddScriptLPS(1); 2220 m_host.AddScriptLPS(1);
2225 return m_host.ParentGroup.registerTargetWaypoint( 2221 return m_host.ParentGroup.registerTargetWaypoint(position,
2226 new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range); 2222 (float)range);
2227 } 2223 }
2228 2224
2229 public void llTargetRemove(int number) 2225 public void llTargetRemove(int number)
@@ -2248,7 +2244,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2248 public void llMoveToTarget(LSL_Vector target, double tau) 2244 public void llMoveToTarget(LSL_Vector target, double tau)
2249 { 2245 {
2250 m_host.AddScriptLPS(1); 2246 m_host.AddScriptLPS(1);
2251 m_host.MoveToTarget(new Vector3((float)target.x, (float)target.y, (float)target.z), (float)tau); 2247 m_host.MoveToTarget(target, (float)tau);
2252 } 2248 }
2253 2249
2254 public void llStopMoveToTarget() 2250 public void llStopMoveToTarget()
@@ -2261,7 +2257,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2261 { 2257 {
2262 m_host.AddScriptLPS(1); 2258 m_host.AddScriptLPS(1);
2263 //No energy force yet 2259 //No energy force yet
2264 Vector3 v = new Vector3((float)force.x, (float)force.y, (float)force.z); 2260 Vector3 v = force;
2265 if (v.Length() > 20000.0f) 2261 if (v.Length() > 20000.0f)
2266 { 2262 {
2267 v.Normalize(); 2263 v.Normalize();
@@ -2273,13 +2269,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2273 public void llApplyRotationalImpulse(LSL_Vector force, int local) 2269 public void llApplyRotationalImpulse(LSL_Vector force, int local)
2274 { 2270 {
2275 m_host.AddScriptLPS(1); 2271 m_host.AddScriptLPS(1);
2276 m_host.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); 2272 m_host.ApplyAngularImpulse(force, local != 0);
2277 } 2273 }
2278 2274
2279 public void llSetTorque(LSL_Vector torque, int local) 2275 public void llSetTorque(LSL_Vector torque, int local)
2280 { 2276 {
2281 m_host.AddScriptLPS(1); 2277 m_host.AddScriptLPS(1);
2282 m_host.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0); 2278 m_host.SetAngularImpulse(torque, local != 0);
2283 } 2279 }
2284 2280
2285 public LSL_Vector llGetTorque() 2281 public LSL_Vector llGetTorque()
@@ -2830,13 +2826,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2830 return; 2826 return;
2831 } 2827 }
2832 2828
2833 Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
2834 Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
2835
2836 // need the magnitude later 2829 // need the magnitude later
2837 // float velmag = (float)Util.GetMagnitude(llvel); 2830 // float velmag = (float)Util.GetMagnitude(llvel);
2838 2831
2839 SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param); 2832 SceneObjectGroup new_group = World.RezObject(m_host, item, pos, Rot2Quaternion(rot), vel, param);
2840 2833
2841 // If either of these are null, then there was an unknown error. 2834 // If either of these are null, then there was an unknown error.
2842 if (new_group == null) 2835 if (new_group == null)
@@ -2857,10 +2850,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2857 2850
2858 PhysicsActor pa = new_group.RootPart.PhysActor; 2851 PhysicsActor pa = new_group.RootPart.PhysActor;
2859 2852
2860 if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) 2853 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
2861 { 2854 {
2862 //Recoil. 2855 //Recoil.
2863 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); 2856 llApplyImpulse(vel * groupmass, 0);
2864 } 2857 }
2865 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 2858 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2866 }); 2859 });
@@ -3381,7 +3374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3381 3374
3382 protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) 3375 protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain)
3383 { 3376 {
3384 part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); 3377 part.UpdateAngularVelocity(axis * spinrate);
3385 } 3378 }
3386 3379
3387 public LSL_Integer llGetStartParameter() 3380 public LSL_Integer llGetStartParameter()
@@ -3588,7 +3581,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3588 List<SceneObjectPart> parts = GetLinkParts(linknumber); 3581 List<SceneObjectPart> parts = GetLinkParts(linknumber);
3589 3582
3590 foreach (SceneObjectPart part in parts) 3583 foreach (SceneObjectPart part in parts)
3591 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 3584 part.SetFaceColor(color, face);
3592 } 3585 }
3593 3586
3594 public void llCreateLink(string target, int parent) 3587 public void llCreateLink(string target, int parent)
@@ -4019,8 +4012,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4019 public void llSetText(string text, LSL_Vector color, double alpha) 4012 public void llSetText(string text, LSL_Vector color, double alpha)
4020 { 4013 {
4021 m_host.AddScriptLPS(1); 4014 m_host.AddScriptLPS(1);
4022 Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y, 4015 Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
4023 (float)color.z), 0.0f, 1.0f);
4024 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); 4016 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
4025 //m_host.ParentGroup.HasGroupChanged = true; 4017 //m_host.ParentGroup.HasGroupChanged = true;
4026 //m_host.ParentGroup.ScheduleGroupForFullUpdate(); 4018 //m_host.ParentGroup.ScheduleGroupForFullUpdate();
@@ -4217,14 +4209,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4217 ScriptSleep(5000); 4209 ScriptSleep(5000);
4218 } 4210 }
4219 4211
4220 public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt) 4212 public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
4221 { 4213 {
4222 m_host.AddScriptLPS(1); 4214 m_host.AddScriptLPS(1);
4223 UUID agentId = new UUID(); 4215 UUID agentId = new UUID();
4224 4216
4225 Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
4226 Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
4227
4228 if (UUID.TryParse(agent, out agentId)) 4217 if (UUID.TryParse(agent, out agentId))
4229 { 4218 {
4230 ScenePresence presence = World.GetScenePresence(agentId); 4219 ScenePresence presence = World.GetScenePresence(agentId);
@@ -4253,15 +4242,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4253 } 4242 }
4254 } 4243 }
4255 4244
4256 public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt) 4245 public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt)
4257 { 4246 {
4258 m_host.AddScriptLPS(1); 4247 m_host.AddScriptLPS(1);
4259 UUID agentId = new UUID(); 4248 UUID agentId = new UUID();
4260 4249
4261 ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); 4250 ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y);
4262 4251
4263 Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
4264 Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
4265 if (UUID.TryParse(agent, out agentId)) 4252 if (UUID.TryParse(agent, out agentId))
4266 { 4253 {
4267 ScenePresence presence = World.GetScenePresence(agentId); 4254 ScenePresence presence = World.GetScenePresence(agentId);
@@ -4545,7 +4532,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4545 distance_attenuation = 1f / normalized_units; 4532 distance_attenuation = 1f / normalized_units;
4546 } 4533 }
4547 4534
4548 Vector3 applied_linear_impulse = new Vector3((float)impulse.x, (float)impulse.y, (float)impulse.z); 4535 Vector3 applied_linear_impulse = impulse;
4549 { 4536 {
4550 float impulse_length = applied_linear_impulse.Length(); 4537 float impulse_length = applied_linear_impulse.Length();
4551 4538
@@ -6044,9 +6031,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6044 6031
6045 //Plug the x,y coordinates of the slope normal into the equation of the plane to get 6032 //Plug the x,y coordinates of the slope normal into the equation of the plane to get
6046 //the height of that point on the plane. The resulting vector gives the slope. 6033 //the height of that point on the plane. The resulting vector gives the slope.
6047 Vector3 vsl = new Vector3(); 6034 Vector3 vsl = vsn;
6048 vsl.X = (float)vsn.x;
6049 vsl.Y = (float)vsn.y;
6050 vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z)); 6035 vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z));
6051 vsl.Normalize(); 6036 vsl.Normalize();
6052 //Normalization might be overkill here 6037 //Normalization might be overkill here
@@ -6057,9 +6042,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6057 public LSL_Vector llGroundNormal(LSL_Vector offset) 6042 public LSL_Vector llGroundNormal(LSL_Vector offset)
6058 { 6043 {
6059 m_host.AddScriptLPS(1); 6044 m_host.AddScriptLPS(1);
6060 Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x, 6045 Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
6061 (float)offset.y,
6062 (float)offset.z);
6063 // Clamp to valid position 6046 // Clamp to valid position
6064 if (pos.X < 0) 6047 if (pos.X < 0)
6065 pos.X = 0; 6048 pos.X = 0;
@@ -6512,8 +6495,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6512 6495
6513 if (!m_host.ParentGroup.IsDeleted) 6496 if (!m_host.ParentGroup.IsDeleted)
6514 { 6497 {
6515 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, 6498 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, vec);
6516 new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
6517 } 6499 }
6518 } 6500 }
6519 6501
@@ -6555,7 +6537,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6555 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) 6537 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
6556 rot.z = 1; // ZERO_ROTATION = 0,0,0,1 6538 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
6557 6539
6558 part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); 6540 part.SitTargetPosition = offset;
6559 part.SitTargetOrientation = Rot2Quaternion(rot); 6541 part.SitTargetOrientation = Rot2Quaternion(rot);
6560 part.ParentGroup.HasGroupChanged = true; 6542 part.ParentGroup.HasGroupChanged = true;
6561 } 6543 }
@@ -6659,13 +6641,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6659 public void llSetCameraEyeOffset(LSL_Vector offset) 6641 public void llSetCameraEyeOffset(LSL_Vector offset)
6660 { 6642 {
6661 m_host.AddScriptLPS(1); 6643 m_host.AddScriptLPS(1);
6662 m_host.SetCameraEyeOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); 6644 m_host.SetCameraEyeOffset(offset);
6663 } 6645 }
6664 6646
6665 public void llSetCameraAtOffset(LSL_Vector offset) 6647 public void llSetCameraAtOffset(LSL_Vector offset)
6666 { 6648 {
6667 m_host.AddScriptLPS(1); 6649 m_host.AddScriptLPS(1);
6668 m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); 6650 m_host.SetCameraAtOffset(offset);
6669 } 6651 }
6670 6652
6671 public LSL_String llDumpList2String(LSL_List src, string seperator) 6653 public LSL_String llDumpList2String(LSL_List src, string seperator)
@@ -6687,7 +6669,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6687 public LSL_Integer llScriptDanger(LSL_Vector pos) 6669 public LSL_Integer llScriptDanger(LSL_Vector pos)
6688 { 6670 {
6689 m_host.AddScriptLPS(1); 6671 m_host.AddScriptLPS(1);
6690 bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z)); 6672 bool result = World.ScriptDanger(m_host.LocalId, pos);
6691 if (result) 6673 if (result)
6692 { 6674 {
6693 return 1; 6675 return 1;
@@ -7515,7 +7497,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7515 LSL_Vector color=rules.GetVector3Item(idx++); 7497 LSL_Vector color=rules.GetVector3Item(idx++);
7516 double alpha=(double)rules.GetLSLFloatItem(idx++); 7498 double alpha=(double)rules.GetLSLFloatItem(idx++);
7517 7499
7518 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 7500 part.SetFaceColor(color, face);
7519 SetAlpha(part, alpha, face); 7501 SetAlpha(part, alpha, face);
7520 7502
7521 break; 7503 break;
@@ -7634,9 +7616,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7634 string primText = rules.GetLSLStringItem(idx++); 7616 string primText = rules.GetLSLStringItem(idx++);
7635 LSL_Vector primTextColor = rules.GetVector3Item(idx++); 7617 LSL_Vector primTextColor = rules.GetVector3Item(idx++);
7636 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); 7618 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
7637 Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x, 7619 Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f);
7638 (float)primTextColor.y,
7639 (float)primTextColor.z), 0.0f, 1.0f);
7640 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); 7620 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
7641 7621
7642 break; 7622 break;
@@ -7691,11 +7671,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7691 if (part.ParentGroup.RootPart == part) 7671 if (part.ParentGroup.RootPart == part)
7692 { 7672 {
7693 SceneObjectGroup parent = part.ParentGroup; 7673 SceneObjectGroup parent = part.ParentGroup;
7694 parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); 7674 parent.UpdateGroupPosition(currentPosition);
7695 } 7675 }
7696 else 7676 else
7697 { 7677 {
7698 part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); 7678 part.OffsetPosition = currentPosition;
7699 SceneObjectGroup parent = part.ParentGroup; 7679 SceneObjectGroup parent = part.ParentGroup;
7700 parent.HasGroupChanged = true; 7680 parent.HasGroupChanged = true;
7701 parent.ScheduleGroupForTerseUpdate(); 7681 parent.ScheduleGroupForTerseUpdate();
@@ -7932,8 +7912,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7932 if (part != null) 7912 if (part != null)
7933 { 7913 {
7934 Vector3 halfSize = part.Scale / 2.0f; 7914 Vector3 halfSize = part.Scale / 2.0f;
7935 LSL_Vector lower = new LSL_Vector(halfSize.X * -1.0f, halfSize.Y * -1.0f, halfSize.Z * -1.0f); 7915 LSL_Vector lower = (new LSL_Vector(halfSize)) * -1.0f;
7936 LSL_Vector upper = new LSL_Vector(halfSize.X, halfSize.Y, halfSize.Z); 7916 LSL_Vector upper = new LSL_Vector(halfSize);
7937 result.Add(lower); 7917 result.Add(lower);
7938 result.Add(upper); 7918 result.Add(upper);
7939 return result; 7919 return result;
@@ -9943,9 +9923,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9943 ScenePresence avatar = World.GetScenePresence(detectedParams.Key); 9923 ScenePresence avatar = World.GetScenePresence(detectedParams.Key);
9944 if (avatar != null) 9924 if (avatar != null)
9945 { 9925 {
9946 avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname, 9926 avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name,
9947 new Vector3((float)pos.x, (float)pos.y, (float)pos.z), 9927 simname, pos, lookAt);
9948 new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z));
9949 } 9928 }
9950 ScriptSleep(1000); 9929 ScriptSleep(1000);
9951 } 9930 }
@@ -11143,8 +11122,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11143 11122
11144 m_host.AddScriptLPS(1); 11123 m_host.AddScriptLPS(1);
11145 11124
11146 Vector3 rayStart = new Vector3((float)start.x, (float)start.y, (float)start.z); 11125 Vector3 rayStart = start;
11147 Vector3 rayEnd = new Vector3((float)end.x, (float)end.y, (float)end.z); 11126 Vector3 rayEnd = end;
11148 Vector3 dir = rayEnd - rayStart; 11127 Vector3 dir = rayEnd - rayStart;
11149 11128
11150 float dist = Vector3.Mag(dir); 11129 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 859ee93..eff1598 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -773,10 +773,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
773 773
774 // We will launch the teleport on a new thread so that when the script threads are terminated 774 // We will launch the teleport on a new thread so that when the script threads are terminated
775 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. 775 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
776 Util.FireAndForget( 776 Util.FireAndForget(o => World.RequestTeleportLocation(
777 o => World.RequestTeleportLocation(presence.ControllingClient, regionName, 777 presence.ControllingClient, regionName, position,
778 new Vector3((float)position.x, (float)position.y, (float)position.z), 778 lookat, (uint)TPFlags.ViaLocation));
779 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
780 779
781 ScriptSleep(5000); 780 ScriptSleep(5000);
782 781
@@ -819,10 +818,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
819 818
820 // We will launch the teleport on a new thread so that when the script threads are terminated 819 // We will launch the teleport on a new thread so that when the script threads are terminated
821 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. 820 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
822 Util.FireAndForget( 821 Util.FireAndForget(o => World.RequestTeleportLocation(
823 o => World.RequestTeleportLocation(presence.ControllingClient, regionHandle, 822 presence.ControllingClient, regionHandle,
824 new Vector3((float)position.x, (float)position.y, (float)position.z), 823 position, lookat, (uint)TPFlags.ViaLocation));
825 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
826 824
827 ScriptSleep(5000); 825 ScriptSleep(5000);
828 826
@@ -2329,7 +2327,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2329 ownerID = m_host.OwnerID; 2327 ownerID = m_host.OwnerID;
2330 UUID x = module.CreateNPC(firstname, 2328 UUID x = module.CreateNPC(firstname,
2331 lastname, 2329 lastname,
2332 new Vector3((float) position.x, (float) position.y, (float) position.z), 2330 position,
2333 ownerID, 2331 ownerID,
2334 senseAsAgent, 2332 senseAsAgent,
2335 World, 2333 World,
@@ -2446,7 +2444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2446 return new LSL_Vector(0, 0, 0); 2444 return new LSL_Vector(0, 0, 0);
2447 } 2445 }
2448 2446
2449 public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) 2447 public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos)
2450 { 2448 {
2451 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); 2449 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
2452 m_host.AddScriptLPS(1); 2450 m_host.AddScriptLPS(1);
@@ -2461,7 +2459,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2461 if (!module.CheckPermissions(npcId, m_host.OwnerID)) 2459 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2462 return; 2460 return;
2463 2461
2464 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
2465 module.MoveToTarget(npcId, World, pos, false, true, false); 2462 module.MoveToTarget(npcId, World, pos, false, true, false);
2466 } 2463 }
2467 } 2464 }
@@ -2481,11 +2478,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2481 if (!module.CheckPermissions(npcId, m_host.OwnerID)) 2478 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2482 return; 2479 return;
2483 2480
2484 Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z);
2485 module.MoveToTarget( 2481 module.MoveToTarget(
2486 new UUID(npc.m_string), 2482 new UUID(npc.m_string),
2487 World, 2483 World,
2488 pos, 2484 target,
2489 (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, 2485 (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0,
2490 (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0, 2486 (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0,
2491 (options & ScriptBaseClass.OS_NPC_RUNNING) != 0); 2487 (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 a626be8..7162226 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -428,9 +428,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
428 try 428 try
429 { 429 {
430 Vector3 diff = toRegionPos - fromRegionPos; 430 Vector3 diff = toRegionPos - fromRegionPos;
431 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z); 431 double dot = LSL_Types.Vector3.Dot(forward_dir, diff);
432 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir); 432 double mag_obj = LSL_Types.Vector3.Mag(diff);
433 double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
434 ang_obj = Math.Acos(dot / (mag_fwd * mag_obj)); 433 ang_obj = Math.Acos(dot / (mag_fwd * mag_obj));
435 } 434 }
436 catch 435 catch
@@ -560,8 +559,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
560 double ang_obj = 0; 559 double ang_obj = 0;
561 try 560 try
562 { 561 {
563 Vector3 diff = toRegionPos - fromRegionPos; 562 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(
564 LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z); 563 toRegionPos - fromRegionPos);
565 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir); 564 double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir);
566 double mag_obj = LSL_Types.Vector3.Mag(obj_dir); 565 double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
567 ang_obj = Math.Acos(dot / (mag_fwd * mag_obj)); 566 ang_obj = Math.Acos(dot / (mag_fwd * mag_obj));