aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie2013-03-14 22:34:15 +0000
committerMelanie2013-03-14 22:34:15 +0000
commit8b657773e4305dc853802017b3353d8d85872e14 (patch)
tree9810e0c221baf927110b34a2d0545182e25595fd /OpenSim/Region/ScriptEngine
parentMerge branch 'avination' into careminster (diff)
parentrefactor: use LSL_Rotation(Quaternion) constructor in lLGetRootRotation() (diff)
downloadopensim-SC-8b657773e4305dc853802017b3353d8d85872e14.zip
opensim-SC-8b657773e4305dc853802017b3353d8d85872e14.tar.gz
opensim-SC-8b657773e4305dc853802017b3353d8d85872e14.tar.bz2
opensim-SC-8b657773e4305dc853802017b3353d8d85872e14.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/ScenePresence.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs97
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs2
3 files changed, 63 insertions, 45 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ab4b172..d634805 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2441,14 +2441,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2441 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 2441 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
2442 q = avatar.CameraRotation; // Mouselook 2442 q = avatar.CameraRotation; // Mouselook
2443 else 2443 else
2444 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 2444 q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate
2445 } 2445 }
2446 else 2446 else
2447 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case 2447 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
2448 } 2448 }
2449 else 2449 else
2450 q = part.ParentGroup.GroupRotation; // just the group rotation 2450 q = part.ParentGroup.GroupRotation; // just the group rotation
2451 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2451
2452 return new LSL_Rotation(q);
2452 } 2453 }
2453 2454
2454 q = part.GetWorldRotation(); 2455 q = part.GetWorldRotation();
@@ -2572,8 +2573,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2572 public LSL_Vector llGetTorque() 2573 public LSL_Vector llGetTorque()
2573 { 2574 {
2574 m_host.AddScriptLPS(1); 2575 m_host.AddScriptLPS(1);
2575 Vector3 torque = m_host.ParentGroup.GetTorque(); 2576
2576 return new LSL_Vector(torque.X,torque.Y,torque.Z); 2577 return new LSL_Vector(m_host.ParentGroup.GetTorque());
2577 } 2578 }
2578 2579
2579 public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local) 2580 public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local)
@@ -2606,13 +2607,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2606 vel = m_host.ParentGroup.RootPart.Velocity; 2607 vel = m_host.ParentGroup.RootPart.Velocity;
2607 } 2608 }
2608 2609
2609 return new LSL_Vector(vel.X, vel.Y, vel.Z); 2610 return new LSL_Vector(vel);
2610 } 2611 }
2611 2612
2612 public LSL_Vector llGetAccel() 2613 public LSL_Vector llGetAccel()
2613 { 2614 {
2614 m_host.AddScriptLPS(1); 2615 m_host.AddScriptLPS(1);
2615 return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z); 2616
2617 return new LSL_Vector(m_host.Acceleration);
2616 } 2618 }
2617 2619
2618 public void llSetAngularVelocity(LSL_Vector avel, int local) 2620 public void llSetAngularVelocity(LSL_Vector avel, int local)
@@ -3447,14 +3449,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3447 msg.offline = (byte)0; //offline; 3449 msg.offline = (byte)0; //offline;
3448 msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID; 3450 msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID;
3449 msg.Position = new Vector3(m_host.AbsolutePosition); 3451 msg.Position = new Vector3(m_host.AbsolutePosition);
3450 msg.RegionID = World.RegionInfo.RegionID.Guid; 3452 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
3453
3454 Vector3 pos = m_host.AbsolutePosition;
3451 msg.binaryBucket 3455 msg.binaryBucket
3452 = Util.StringToBytes256( 3456 = Util.StringToBytes256(
3453 "{0}/{1}/{2}/{3}", 3457 "{0}/{1}/{2}/{3}",
3454 World.RegionInfo.RegionName, 3458 World.RegionInfo.RegionName,
3455 (int)Math.Floor(m_host.AbsolutePosition.X), 3459 (int)Math.Floor(pos.X),
3456 (int)Math.Floor(m_host.AbsolutePosition.Y), 3460 (int)Math.Floor(pos.Y),
3457 (int)Math.Floor(m_host.AbsolutePosition.Z)); 3461 (int)Math.Floor(pos.Z));
3458 3462
3459 if (m_TransferModule != null) 3463 if (m_TransferModule != null)
3460 { 3464 {
@@ -4594,9 +4598,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4594 if (destination == String.Empty) 4598 if (destination == String.Empty)
4595 destination = World.RegionInfo.RegionName; 4599 destination = World.RegionInfo.RegionName;
4596 4600
4601 Vector3 pos = presence.AbsolutePosition;
4602
4597 // agent must be over the owners land 4603 // agent must be over the owners land
4598 if (m_host.OwnerID == World.LandChannel.GetLandObject( 4604 if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
4599 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4600 { 4605 {
4601 DoLLTeleport(presence, destination, targetPos, targetLookAt); 4606 DoLLTeleport(presence, destination, targetPos, targetLookAt);
4602 } 4607 }
@@ -4626,9 +4631,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4626 // agent must not be a god 4631 // agent must not be a god
4627 if (presence.GodLevel >= 200) return; 4632 if (presence.GodLevel >= 200) return;
4628 4633
4634 Vector3 pos = presence.AbsolutePosition;
4635
4629 // agent must be over the owners land 4636 // agent must be over the owners land
4630 if (m_host.OwnerID == World.LandChannel.GetLandObject( 4637 if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
4631 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4632 { 4638 {
4633 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); 4639 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4634 } 4640 }
@@ -5282,8 +5288,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5282 public LSL_Vector llGetCenterOfMass() 5288 public LSL_Vector llGetCenterOfMass()
5283 { 5289 {
5284 m_host.AddScriptLPS(1); 5290 m_host.AddScriptLPS(1);
5285 Vector3 center = m_host.GetCenterOfMass(); 5291
5286 return new LSL_Vector(center.X,center.Y,center.Z); 5292 return new LSL_Vector(m_host.GetCenterOfMass());
5287 } 5293 }
5288 5294
5289 public LSL_List llListSort(LSL_List src, int stride, int ascending) 5295 public LSL_List llListSort(LSL_List src, int stride, int ascending)
@@ -6302,15 +6308,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6302 ScenePresence presence = World.GetScenePresence(agentID); 6308 ScenePresence presence = World.GetScenePresence(agentID);
6303 if (presence != null) 6309 if (presence != null)
6304 { 6310 {
6311 Vector3 pos = presence.AbsolutePosition;
6312
6305 // agent must be over the owners land 6313 // agent must be over the owners land
6306 ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); 6314 ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y);
6307 if (land == null) 6315 if (land == null)
6308 return; 6316 return;
6309 6317
6310 if (m_host.OwnerID == land.LandData.OwnerID) 6318 if (m_host.OwnerID == land.LandData.OwnerID)
6311 { 6319 {
6312 Vector3 pos = World.GetNearestAllowedPosition(presence, land); 6320 Vector3 p = World.GetNearestAllowedPosition(presence, land);
6313 presence.TeleportWithMomentum(pos, null); 6321 presence.TeleportWithMomentum(p, null);
6314 presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); 6322 presence.ControllingClient.SendAlertMessage("You have been ejected from this land");
6315 } 6323 }
6316 } 6324 }
@@ -6332,19 +6340,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6332 ScenePresence presence = World.GetScenePresence(key); 6340 ScenePresence presence = World.GetScenePresence(key);
6333 if (presence != null) // object is an avatar 6341 if (presence != null) // object is an avatar
6334 { 6342 {
6335 if (m_host.OwnerID 6343 Vector3 pos = presence.AbsolutePosition;
6336 == World.LandChannel.GetLandObject( 6344
6337 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) 6345 if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
6338 return 1; 6346 return 1;
6339 } 6347 }
6340 else // object is not an avatar 6348 else // object is not an avatar
6341 { 6349 {
6342 SceneObjectPart obj = World.GetSceneObjectPart(key); 6350 SceneObjectPart obj = World.GetSceneObjectPart(key);
6351
6343 if (obj != null) 6352 if (obj != null)
6344 if (m_host.OwnerID 6353 {
6345 == World.LandChannel.GetLandObject( 6354 Vector3 pos = obj.AbsolutePosition;
6346 obj.AbsolutePosition.X, obj.AbsolutePosition.Y).LandData.OwnerID) 6355
6356 if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
6347 return 1; 6357 return 1;
6358 }
6348 } 6359 }
6349 } 6360 }
6350 6361
@@ -6453,7 +6464,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6453 // or 6464 // or
6454 // if the object is owned by a person with estate access. 6465 // if the object is owned by a person with estate access.
6455 6466
6456 ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y); 6467 Vector3 pos = av.AbsolutePosition;
6468
6469 ILandObject parcel = World.LandChannel.GetLandObject(pos.X, pos.Y);
6457 if (parcel != null) 6470 if (parcel != null)
6458 { 6471 {
6459 if (m_host.OwnerID == parcel.LandData.OwnerID || 6472 if (m_host.OwnerID == parcel.LandData.OwnerID ||
@@ -6465,14 +6478,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6465 } 6478 }
6466 } 6479 }
6467 } 6480 }
6468
6469 } 6481 }
6470
6471 } 6482 }
6472 6483
6473 public LSL_Vector llGroundSlope(LSL_Vector offset) 6484 public LSL_Vector llGroundSlope(LSL_Vector offset)
6474 { 6485 {
6475 m_host.AddScriptLPS(1); 6486 m_host.AddScriptLPS(1);
6487
6476 //Get the slope normal. This gives us the equation of the plane tangent to the slope. 6488 //Get the slope normal. This gives us the equation of the plane tangent to the slope.
6477 LSL_Vector vsn = llGroundNormal(offset); 6489 LSL_Vector vsn = llGroundNormal(offset);
6478 6490
@@ -6483,7 +6495,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6483 vsl.Normalize(); 6495 vsl.Normalize();
6484 //Normalization might be overkill here 6496 //Normalization might be overkill here
6485 6497
6486 return new LSL_Vector(vsl.X, vsl.Y, vsl.Z); 6498 vsn.x = vsl.X;
6499 vsn.y = vsl.Y;
6500 vsn.z = vsl.Z;
6501
6502 return vsn;
6487 } 6503 }
6488 6504
6489 public LSL_Vector llGroundNormal(LSL_Vector offset) 6505 public LSL_Vector llGroundNormal(LSL_Vector offset)
@@ -6533,7 +6549,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6533 //I believe the crossproduct of two normalized vectors is a normalized vector so 6549 //I believe the crossproduct of two normalized vectors is a normalized vector so
6534 //this normalization may be overkill 6550 //this normalization may be overkill
6535 6551
6536 return new LSL_Vector(vsn.X, vsn.Y, vsn.Z); 6552 return new LSL_Vector(vsn);
6537 } 6553 }
6538 6554
6539 public LSL_Vector llGroundContour(LSL_Vector offset) 6555 public LSL_Vector llGroundContour(LSL_Vector offset)
@@ -7037,7 +7053,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7037 { 7053 {
7038 m_host.AddScriptLPS(1); 7054 m_host.AddScriptLPS(1);
7039 UUID key; 7055 UUID key;
7040 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 7056 Vector3 pos = m_host.AbsolutePosition;
7057
7058 ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y);
7041 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 7059 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
7042 { 7060 {
7043 int expires = 0; 7061 int expires = 0;
@@ -8474,7 +8492,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8474 { 8492 {
8475 m_host.AddScriptLPS(1); 8493 m_host.AddScriptLPS(1);
8476 8494
8477 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 8495 Vector3 pos = m_host.AbsolutePosition;
8496 ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y);
8478 8497
8479 if (land.LandData.OwnerID != m_host.OwnerID) 8498 if (land.LandData.OwnerID != m_host.OwnerID)
8480 return; 8499 return;
@@ -8488,7 +8507,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8488 { 8507 {
8489 m_host.AddScriptLPS(1); 8508 m_host.AddScriptLPS(1);
8490 8509
8491 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 8510 Vector3 pos = m_host.AbsolutePosition;
8511 ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y);
8492 8512
8493 if (land.LandData.OwnerID != m_host.OwnerID) 8513 if (land.LandData.OwnerID != m_host.OwnerID)
8494 return String.Empty; 8514 return String.Empty;
@@ -8499,8 +8519,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8499 public LSL_Vector llGetRootPosition() 8519 public LSL_Vector llGetRootPosition()
8500 { 8520 {
8501 m_host.AddScriptLPS(1); 8521 m_host.AddScriptLPS(1);
8502 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, 8522
8503 m_host.ParentGroup.AbsolutePosition.Z); 8523 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition);
8504 } 8524 }
8505 8525
8506 /// <summary> 8526 /// <summary>
@@ -8523,13 +8543,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8523 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 8543 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
8524 q = avatar.CameraRotation; // Mouselook 8544 q = avatar.CameraRotation; // Mouselook
8525 else 8545 else
8526 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 8546 q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate
8527 else 8547 else
8528 q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case 8548 q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case
8529 } 8549 }
8530 else 8550 else
8531 q = m_host.ParentGroup.GroupRotation; // just the group rotation 8551 q = m_host.ParentGroup.GroupRotation; // just the group rotation
8532 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 8552
8553 return new LSL_Rotation(q);
8533 } 8554 }
8534 8555
8535 public LSL_String llGetObjectDesc() 8556 public LSL_String llGetObjectDesc()
@@ -13387,4 +13408,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13387 } 13408 }
13388 } 13409 }
13389 } 13410 }
13390} \ No newline at end of file 13411}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index e87bb04..a214935 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2641,18 +2641,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2641 { 2641 {
2642 UUID npcId; 2642 UUID npcId;
2643 if (!UUID.TryParse(npc.m_string, out npcId)) 2643 if (!UUID.TryParse(npc.m_string, out npcId))
2644 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2644 return new LSL_Rotation(Quaternion.Identity);
2645 2645
2646 if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) 2646 if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
2647 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2647 return new LSL_Rotation(Quaternion.Identity);
2648 2648
2649 ScenePresence sp = World.GetScenePresence(npcId); 2649 ScenePresence sp = World.GetScenePresence(npcId);
2650 2650
2651 if (sp != null) 2651 if (sp != null)
2652 { 2652 return new LSL_Rotation(sp.GetWorldRotation());
2653 Quaternion rot = sp.Rotation;
2654 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
2655 }
2656 } 2653 }
2657 2654
2658 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2655 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index d3ef378..884f07c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -700,4 +700,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
700 return retList; 700 return retList;
701 } 701 }
702 } 702 }
703} \ No newline at end of file 703}