aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie2013-03-18 23:31:27 +0000
committerMelanie2013-03-18 23:31:27 +0000
commit5e1f651e21ba81d8be9693d7e8a47d49daa9fce5 (patch)
tree4856d3aa25fcd942a26af39e1510f58fef3c934d /OpenSim/Region/ScriptEngine
parentMerge commit 'ccd6f443e1092cb410f565e921f7cf4dd8cd2dac' into newmultiattach (diff)
parentImprove rejection of any attempt to reattach an object that is already attached. (diff)
downloadopensim-SC_OLD-5e1f651e21ba81d8be9693d7e8a47d49daa9fce5.zip
opensim-SC_OLD-5e1f651e21ba81d8be9693d7e8a47d49daa9fce5.tar.gz
opensim-SC_OLD-5e1f651e21ba81d8be9693d7e8a47d49daa9fce5.tar.bz2
opensim-SC_OLD-5e1f651e21ba81d8be9693d7e8a47d49daa9fce5.tar.xz
Merge branch 'master' into newmultiattach
Conflicts: OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs331
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs53
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs1
6 files changed, 201 insertions, 203 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index cf6f13e..e1f0071 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -283,6 +283,80 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
283 } 283 }
284 } 284 }
285 285
286 /// <summary>
287 /// Get a given link entity from a linkset (linked objects and any sitting avatars).
288 /// </summary>
289 /// <remarks>
290 /// If there are any ScenePresence's in the linkset (i.e. because they are sat upon one of the prims), then
291 /// these are counted as extra entities that correspond to linknums beyond the number of prims in the linkset.
292 /// The ScenePresences receive linknums in the order in which they sat.
293 /// </remarks>
294 /// <returns>
295 /// The link entity. null if not found.
296 /// </returns>
297 /// <param name='linknum'>
298 /// Can be either a non-negative integer or ScriptBaseClass.LINK_THIS (-4).
299 /// If ScriptBaseClass.LINK_THIS then the entity containing the script is returned.
300 /// If the linkset has one entity and a linknum of zero is given, then the single entity is returned. If any
301 /// positive integer is given in this case then null is returned.
302 /// If the linkset has more than one entity and a linknum greater than zero but equal to or less than the number
303 /// of entities, then the entity which corresponds to that linknum is returned.
304 /// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then
305 /// null is returned.
306 /// </param>
307 public ISceneEntity GetLinkEntity(int linknum)
308 {
309 if (linknum < 0)
310 {
311 if (linknum == ScriptBaseClass.LINK_THIS)
312 return m_host;
313 else
314 return null;
315 }
316
317 int actualPrimCount = m_host.ParentGroup.PrimCount;
318 List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
319 int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
320
321 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
322 // prim that has any avatars sat upon it (in which case the root prim is link 1).
323 if (linknum == 0)
324 {
325 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
326 return m_host;
327
328 return null;
329 }
330 // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
331 // here we must match 1 (ScriptBaseClass.LINK_ROOT).
332 else if (linknum == ScriptBaseClass.LINK_ROOT && actualPrimCount == 1)
333 {
334 if (sittingAvatarIds.Count > 0)
335 return m_host.ParentGroup.RootPart;
336 else
337 return null;
338 }
339 else if (linknum <= adjustedPrimCount)
340 {
341 if (linknum <= actualPrimCount)
342 {
343 return m_host.ParentGroup.GetLinkNumPart(linknum);
344 }
345 else
346 {
347 ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]);
348 if (sp != null)
349 return sp;
350 else
351 return null;
352 }
353 }
354 else
355 {
356 return null;
357 }
358 }
359
286 public List<SceneObjectPart> GetLinkParts(int linkType) 360 public List<SceneObjectPart> GetLinkParts(int linkType)
287 { 361 {
288 return GetLinkParts(m_host, linkType); 362 return GetLinkParts(m_host, linkType);
@@ -2174,23 +2248,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2174 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 2248 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
2175 q = avatar.CameraRotation; // Mouselook 2249 q = avatar.CameraRotation; // Mouselook
2176 else 2250 else
2177 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 2251 q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate
2178 } 2252 }
2179 else 2253 else
2180 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case 2254 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
2181 } 2255 }
2182 else 2256 else
2183 q = part.ParentGroup.GroupRotation; // just the group rotation 2257 q = part.ParentGroup.GroupRotation; // just the group rotation
2184 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2258
2259 return new LSL_Rotation(q);
2185 } 2260 }
2186 q = part.GetWorldRotation(); 2261
2187 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2262 return new LSL_Rotation(part.GetWorldRotation());
2188 } 2263 }
2189 2264
2190 public LSL_Rotation llGetLocalRot() 2265 public LSL_Rotation llGetLocalRot()
2191 { 2266 {
2192 m_host.AddScriptLPS(1); 2267 m_host.AddScriptLPS(1);
2193 return new LSL_Rotation(m_host.RotationOffset.X, m_host.RotationOffset.Y, m_host.RotationOffset.Z, m_host.RotationOffset.W); 2268
2269 return new LSL_Rotation(m_host.RotationOffset);
2194 } 2270 }
2195 2271
2196 public void llSetForce(LSL_Vector force, int local) 2272 public void llSetForce(LSL_Vector force, int local)
@@ -2285,8 +2361,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2285 public LSL_Vector llGetTorque() 2361 public LSL_Vector llGetTorque()
2286 { 2362 {
2287 m_host.AddScriptLPS(1); 2363 m_host.AddScriptLPS(1);
2288 Vector3 torque = m_host.ParentGroup.GetTorque(); 2364
2289 return new LSL_Vector(torque.X,torque.Y,torque.Z); 2365 return new LSL_Vector(m_host.ParentGroup.GetTorque());
2290 } 2366 }
2291 2367
2292 public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local) 2368 public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local)
@@ -2312,19 +2388,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2312 vel = m_host.Velocity; 2388 vel = m_host.Velocity;
2313 } 2389 }
2314 2390
2315 return new LSL_Vector(vel.X, vel.Y, vel.Z); 2391 return new LSL_Vector(vel);
2316 } 2392 }
2317 2393
2318 public LSL_Vector llGetAccel() 2394 public LSL_Vector llGetAccel()
2319 { 2395 {
2320 m_host.AddScriptLPS(1); 2396 m_host.AddScriptLPS(1);
2321 return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z); 2397
2398 return new LSL_Vector(m_host.Acceleration);
2322 } 2399 }
2323 2400
2324 public LSL_Vector llGetOmega() 2401 public LSL_Vector llGetOmega()
2325 { 2402 {
2326 m_host.AddScriptLPS(1); 2403 m_host.AddScriptLPS(1);
2327 return new LSL_Vector(m_host.AngularVelocity.X, m_host.AngularVelocity.Y, m_host.AngularVelocity.Z); 2404
2405 return new LSL_Vector(m_host.AngularVelocity);
2328 } 2406 }
2329 2407
2330 public LSL_Float llGetTimeOfDay() 2408 public LSL_Float llGetTimeOfDay()
@@ -3101,13 +3179,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3101 msg.ParentEstateID = 0; //ParentEstateID; 3179 msg.ParentEstateID = 0; //ParentEstateID;
3102 msg.Position = new Vector3(m_host.AbsolutePosition); 3180 msg.Position = new Vector3(m_host.AbsolutePosition);
3103 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; 3181 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
3182
3183 Vector3 pos = m_host.AbsolutePosition;
3104 msg.binaryBucket 3184 msg.binaryBucket
3105 = Util.StringToBytes256( 3185 = Util.StringToBytes256(
3106 "{0}/{1}/{2}/{3}", 3186 "{0}/{1}/{2}/{3}",
3107 World.RegionInfo.RegionName, 3187 World.RegionInfo.RegionName,
3108 (int)Math.Floor(m_host.AbsolutePosition.X), 3188 (int)Math.Floor(pos.X),
3109 (int)Math.Floor(m_host.AbsolutePosition.Y), 3189 (int)Math.Floor(pos.Y),
3110 (int)Math.Floor(m_host.AbsolutePosition.Z)); 3190 (int)Math.Floor(pos.Z));
3111 3191
3112 if (m_TransferModule != null) 3192 if (m_TransferModule != null)
3113 { 3193 {
@@ -3691,47 +3771,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3691 { 3771 {
3692 m_host.AddScriptLPS(1); 3772 m_host.AddScriptLPS(1);
3693 3773
3694 if (linknum < 0) 3774 ISceneEntity entity = GetLinkEntity(linknum);
3695 {
3696 if (linknum == ScriptBaseClass.LINK_THIS)
3697 return m_host.UUID.ToString();
3698 else
3699 return ScriptBaseClass.NULL_KEY;
3700 }
3701
3702 int actualPrimCount = m_host.ParentGroup.PrimCount;
3703 List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
3704 int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
3705
3706 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
3707 // prim that has any avatars sat upon it (in which case the root prim is link 1).
3708 if (linknum == 0)
3709 {
3710 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
3711 return m_host.UUID.ToString();
3712 3775
3713 return ScriptBaseClass.NULL_KEY; 3776 if (entity != null)
3714 } 3777 return entity.UUID.ToString();
3715 // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
3716 // here we must match 1 (ScriptBaseClass.LINK_ROOT).
3717 else if (linknum == 1 && actualPrimCount == 1)
3718 {
3719 if (sittingAvatarIds.Count > 0)
3720 return m_host.ParentGroup.RootPart.UUID.ToString();
3721 else
3722 return ScriptBaseClass.NULL_KEY;
3723 }
3724 else if (linknum <= adjustedPrimCount)
3725 {
3726 if (linknum <= actualPrimCount)
3727 return m_host.ParentGroup.GetLinkNumPart(linknum).UUID.ToString();
3728 else
3729 return sittingAvatarIds[linknum - actualPrimCount - 1].ToString();
3730 }
3731 else 3778 else
3732 {
3733 return ScriptBaseClass.NULL_KEY; 3779 return ScriptBaseClass.NULL_KEY;
3734 }
3735 } 3780 }
3736 3781
3737 /// <summary> 3782 /// <summary>
@@ -3777,55 +3822,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3777 { 3822 {
3778 m_host.AddScriptLPS(1); 3823 m_host.AddScriptLPS(1);
3779 3824
3780 if (linknum < 0) 3825 ISceneEntity entity = GetLinkEntity(linknum);
3781 {
3782 if (linknum == ScriptBaseClass.LINK_THIS)
3783 return m_host.Name;
3784 else
3785 return ScriptBaseClass.NULL_KEY;
3786 }
3787 3826
3788 int actualPrimCount = m_host.ParentGroup.PrimCount; 3827 if (entity != null)
3789 List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars(); 3828 return entity.Name;
3790 int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
3791
3792 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
3793 // prim that has any avatars sat upon it (in which case the root prim is link 1).
3794 if (linknum == 0)
3795 {
3796 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
3797 return m_host.Name;
3798
3799 return ScriptBaseClass.NULL_KEY;
3800 }
3801 // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
3802 // here we must match 1 (ScriptBaseClass.LINK_ROOT).
3803 else if (linknum == 1 && actualPrimCount == 1)
3804 {
3805 if (sittingAvatarIds.Count > 0)
3806 return m_host.ParentGroup.RootPart.Name;
3807 else
3808 return ScriptBaseClass.NULL_KEY;
3809 }
3810 else if (linknum <= adjustedPrimCount)
3811 {
3812 if (linknum <= actualPrimCount)
3813 {
3814 return m_host.ParentGroup.GetLinkNumPart(linknum).Name;
3815 }
3816 else
3817 {
3818 ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]);
3819 if (sp != null)
3820 return sp.Name;
3821 else
3822 return ScriptBaseClass.NULL_KEY;
3823 }
3824 }
3825 else 3829 else
3826 {
3827 return ScriptBaseClass.NULL_KEY; 3830 return ScriptBaseClass.NULL_KEY;
3828 }
3829 } 3831 }
3830 3832
3831 public LSL_Integer llGetInventoryNumber(int type) 3833 public LSL_Integer llGetInventoryNumber(int type)
@@ -4170,13 +4172,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4170 if (presence != null) 4172 if (presence != null)
4171 { 4173 {
4172 // agent must be over the owners land 4174 // agent must be over the owners land
4173 if (m_host.OwnerID == World.LandChannel.GetLandObject( 4175 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
4174 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4175 { 4176 {
4176 World.TeleportClientHome(agentId, presence.ControllingClient); 4177 World.TeleportClientHome(agentId, presence.ControllingClient);
4177 } 4178 }
4178 } 4179 }
4179 } 4180 }
4181
4180 ScriptSleep(5000); 4182 ScriptSleep(5000);
4181 } 4183 }
4182 4184
@@ -4197,8 +4199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4197 destination = World.RegionInfo.RegionName; 4199 destination = World.RegionInfo.RegionName;
4198 4200
4199 // agent must be over the owners land 4201 // agent must be over the owners land
4200 if (m_host.OwnerID == World.LandChannel.GetLandObject( 4202 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
4201 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4202 { 4203 {
4203 DoLLTeleport(presence, destination, targetPos, targetLookAt); 4204 DoLLTeleport(presence, destination, targetPos, targetLookAt);
4204 } 4205 }
@@ -4229,8 +4230,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4229 if (presence.GodLevel >= 200) return; 4230 if (presence.GodLevel >= 200) return;
4230 4231
4231 // agent must be over the owners land 4232 // agent must be over the owners land
4232 if (m_host.OwnerID == World.LandChannel.GetLandObject( 4233 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
4233 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4234 { 4234 {
4235 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); 4235 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4236 } 4236 }
@@ -4434,7 +4434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4434 { 4434 {
4435 if (pushrestricted) 4435 if (pushrestricted)
4436 { 4436 {
4437 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); 4437 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos);
4438 4438
4439 // We didn't find the parcel but region is push restricted so assume it is NOT ok 4439 // We didn't find the parcel but region is push restricted so assume it is NOT ok
4440 if (targetlandObj == null) 4440 if (targetlandObj == null)
@@ -4449,7 +4449,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4449 } 4449 }
4450 else 4450 else
4451 { 4451 {
4452 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); 4452 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos);
4453 if (targetlandObj == null) 4453 if (targetlandObj == null)
4454 { 4454 {
4455 // We didn't find the parcel but region isn't push restricted so assume it's ok 4455 // We didn't find the parcel but region isn't push restricted so assume it's ok
@@ -4871,8 +4871,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4871 public LSL_Vector llGetCenterOfMass() 4871 public LSL_Vector llGetCenterOfMass()
4872 { 4872 {
4873 m_host.AddScriptLPS(1); 4873 m_host.AddScriptLPS(1);
4874 Vector3 center = m_host.GetCenterOfMass(); 4874
4875 return new LSL_Vector(center.X,center.Y,center.Z); 4875 return new LSL_Vector(m_host.GetCenterOfMass());
4876 } 4876 }
4877 4877
4878 public LSL_List llListSort(LSL_List src, int stride, int ascending) 4878 public LSL_List llListSort(LSL_List src, int stride, int ascending)
@@ -5703,12 +5703,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5703 } 5703 }
5704 5704
5705 ILandObject land; 5705 ILandObject land;
5706 Vector3 pos;
5707 UUID id = UUID.Zero; 5706 UUID id = UUID.Zero;
5707
5708 if (parcel || parcelOwned) 5708 if (parcel || parcelOwned)
5709 { 5709 {
5710 pos = m_host.ParentGroup.RootPart.GetWorldPosition(); 5710 land = World.LandChannel.GetLandObject(m_host.ParentGroup.RootPart.GetWorldPosition());
5711 land = World.LandChannel.GetLandObject(pos.X, pos.Y);
5712 if (land == null) 5711 if (land == null)
5713 { 5712 {
5714 id = UUID.Zero; 5713 id = UUID.Zero;
@@ -5734,8 +5733,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5734 { 5733 {
5735 if (!regionWide) 5734 if (!regionWide)
5736 { 5735 {
5737 pos = ssp.AbsolutePosition; 5736 land = World.LandChannel.GetLandObject(ssp.AbsolutePosition);
5738 land = World.LandChannel.GetLandObject(pos.X, pos.Y);
5739 if (land != null) 5737 if (land != null)
5740 { 5738 {
5741 if (parcelOwned && land.LandData.OwnerID == id || 5739 if (parcelOwned && land.LandData.OwnerID == id ||
@@ -5860,7 +5858,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5860 if (presence != null) 5858 if (presence != null)
5861 { 5859 {
5862 // agent must be over the owners land 5860 // agent must be over the owners land
5863 ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); 5861 ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition);
5864 if (land == null) 5862 if (land == null)
5865 return; 5863 return;
5866 5864
@@ -5882,19 +5880,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5882 ScenePresence presence = World.GetScenePresence(key); 5880 ScenePresence presence = World.GetScenePresence(key);
5883 if (presence != null) // object is an avatar 5881 if (presence != null) // object is an avatar
5884 { 5882 {
5885 if (m_host.OwnerID 5883 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
5886 == World.LandChannel.GetLandObject(
5887 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
5888 return 1; 5884 return 1;
5889 } 5885 }
5890 else // object is not an avatar 5886 else // object is not an avatar
5891 { 5887 {
5892 SceneObjectPart obj = World.GetSceneObjectPart(key); 5888 SceneObjectPart obj = World.GetSceneObjectPart(key);
5889
5893 if (obj != null) 5890 if (obj != null)
5894 if (m_host.OwnerID 5891 {
5895 == World.LandChannel.GetLandObject( 5892 if (m_host.OwnerID == World.LandChannel.GetLandObject(obj.AbsolutePosition).LandData.OwnerID)
5896 obj.AbsolutePosition.X, obj.AbsolutePosition.Y).LandData.OwnerID)
5897 return 1; 5893 return 1;
5894 }
5898 } 5895 }
5899 } 5896 }
5900 5897
@@ -5972,8 +5969,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5972 // if the land is group owned and the object is group owned by the same group 5969 // if the land is group owned and the object is group owned by the same group
5973 // or 5970 // or
5974 // if the object is owned by a person with estate access. 5971 // if the object is owned by a person with estate access.
5975 5972 ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition);
5976 ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y);
5977 if (parcel != null) 5973 if (parcel != null)
5978 { 5974 {
5979 if (m_host.OwnerID == parcel.LandData.OwnerID || 5975 if (m_host.OwnerID == parcel.LandData.OwnerID ||
@@ -5985,14 +5981,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5985 } 5981 }
5986 } 5982 }
5987 } 5983 }
5988
5989 } 5984 }
5990
5991 } 5985 }
5992 5986
5993 public LSL_Vector llGroundSlope(LSL_Vector offset) 5987 public LSL_Vector llGroundSlope(LSL_Vector offset)
5994 { 5988 {
5995 m_host.AddScriptLPS(1); 5989 m_host.AddScriptLPS(1);
5990
5996 //Get the slope normal. This gives us the equation of the plane tangent to the slope. 5991 //Get the slope normal. This gives us the equation of the plane tangent to the slope.
5997 LSL_Vector vsn = llGroundNormal(offset); 5992 LSL_Vector vsn = llGroundNormal(offset);
5998 5993
@@ -6003,7 +5998,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6003 vsl.Normalize(); 5998 vsl.Normalize();
6004 //Normalization might be overkill here 5999 //Normalization might be overkill here
6005 6000
6006 return new LSL_Vector(vsl.X, vsl.Y, vsl.Z); 6001 vsn.x = vsl.X;
6002 vsn.y = vsl.Y;
6003 vsn.z = vsl.Z;
6004
6005 return vsn;
6007 } 6006 }
6008 6007
6009 public LSL_Vector llGroundNormal(LSL_Vector offset) 6008 public LSL_Vector llGroundNormal(LSL_Vector offset)
@@ -6053,7 +6052,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6053 //I believe the crossproduct of two normalized vectors is a normalized vector so 6052 //I believe the crossproduct of two normalized vectors is a normalized vector so
6054 //this normalization may be overkill 6053 //this normalization may be overkill
6055 6054
6056 return new LSL_Vector(vsn.X, vsn.Y, vsn.Z); 6055 return new LSL_Vector(vsn);
6057 } 6056 }
6058 6057
6059 public LSL_Vector llGroundContour(LSL_Vector offset) 6058 public LSL_Vector llGroundContour(LSL_Vector offset)
@@ -6069,7 +6068,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6069 return m_host.ParentGroup.AttachmentPoint; 6068 return m_host.ParentGroup.AttachmentPoint;
6070 } 6069 }
6071 6070
6072 public LSL_Integer llGetFreeMemory() 6071 public virtual LSL_Integer llGetFreeMemory()
6073 { 6072 {
6074 m_host.AddScriptLPS(1); 6073 m_host.AddScriptLPS(1);
6075 // Make scripts designed for LSO happy 6074 // Make scripts designed for LSO happy
@@ -6553,7 +6552,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6553 { 6552 {
6554 m_host.AddScriptLPS(1); 6553 m_host.AddScriptLPS(1);
6555 UUID key; 6554 UUID key;
6556 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 6555 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
6556
6557 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 6557 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
6558 { 6558 {
6559 int expires = 0; 6559 int expires = 0;
@@ -7782,7 +7782,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7782 { 7782 {
7783 m_host.AddScriptLPS(1); 7783 m_host.AddScriptLPS(1);
7784 7784
7785 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 7785 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
7786 7786
7787 if (land.LandData.OwnerID != m_host.OwnerID) 7787 if (land.LandData.OwnerID != m_host.OwnerID)
7788 return; 7788 return;
@@ -7796,7 +7796,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7796 { 7796 {
7797 m_host.AddScriptLPS(1); 7797 m_host.AddScriptLPS(1);
7798 7798
7799 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 7799 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
7800 7800
7801 if (land.LandData.OwnerID != m_host.OwnerID) 7801 if (land.LandData.OwnerID != m_host.OwnerID)
7802 return String.Empty; 7802 return String.Empty;
@@ -7807,8 +7807,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7807 public LSL_Vector llGetRootPosition() 7807 public LSL_Vector llGetRootPosition()
7808 { 7808 {
7809 m_host.AddScriptLPS(1); 7809 m_host.AddScriptLPS(1);
7810 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, 7810
7811 m_host.ParentGroup.AbsolutePosition.Z); 7811 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition);
7812 } 7812 }
7813 7813
7814 /// <summary> 7814 /// <summary>
@@ -7831,13 +7831,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7831 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 7831 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
7832 q = avatar.CameraRotation; // Mouselook 7832 q = avatar.CameraRotation; // Mouselook
7833 else 7833 else
7834 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 7834 q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate
7835 else 7835 else
7836 q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case 7836 q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case
7837 } 7837 }
7838 else 7838 else
7839 q = m_host.ParentGroup.GroupRotation; // just the group rotation 7839 q = m_host.ParentGroup.GroupRotation; // just the group rotation
7840 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 7840
7841 return new LSL_Rotation(q);
7841 } 7842 }
7842 7843
7843 public LSL_String llGetObjectDesc() 7844 public LSL_String llGetObjectDesc()
@@ -7944,7 +7945,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7944 7945
7945 public LSL_Vector llGetGeometricCenter() 7946 public LSL_Vector llGetGeometricCenter()
7946 { 7947 {
7947 return new LSL_Vector(m_host.GetGeometricCenter().X, m_host.GetGeometricCenter().Y, m_host.GetGeometricCenter().Z); 7948 return new LSL_Vector(m_host.GetGeometricCenter());
7948 } 7949 }
7949 7950
7950 public LSL_List llGetPrimitiveParams(LSL_List rules) 7951 public LSL_List llGetPrimitiveParams(LSL_List rules)
@@ -8031,23 +8032,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8031 break; 8032 break;
8032 8033
8033 case (int)ScriptBaseClass.PRIM_POSITION: 8034 case (int)ScriptBaseClass.PRIM_POSITION:
8034 LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X, 8035 LSL_Vector v = new LSL_Vector(part.AbsolutePosition);
8035 part.AbsolutePosition.Y, 8036
8036 part.AbsolutePosition.Z);
8037 // For some reason, the part.AbsolutePosition.* values do not change if the 8037 // For some reason, the part.AbsolutePosition.* values do not change if the
8038 // linkset is rotated; they always reflect the child prim's world position 8038 // linkset is rotated; they always reflect the child prim's world position
8039 // as though the linkset is unrotated. This is incompatible behavior with SL's 8039 // as though the linkset is unrotated. This is incompatible behavior with SL's
8040 // implementation, so will break scripts imported from there (not to mention it 8040 // implementation, so will break scripts imported from there (not to mention it
8041 // makes it more difficult to determine a child prim's actual inworld position). 8041 // makes it more difficult to determine a child prim's actual inworld position).
8042 if (part.ParentID != 0) 8042 if (!part.IsRoot)
8043 v = ((v - llGetRootPosition()) * llGetRootRotation()) + llGetRootPosition(); 8043 {
8044 LSL_Vector rootPos = new LSL_Vector(m_host.ParentGroup.AbsolutePosition);
8045 v = ((v - rootPos) * llGetRootRotation()) + rootPos;
8046 }
8047
8044 res.Add(v); 8048 res.Add(v);
8045 break; 8049 break;
8046 8050
8047 case (int)ScriptBaseClass.PRIM_SIZE: 8051 case (int)ScriptBaseClass.PRIM_SIZE:
8048 res.Add(new LSL_Vector(part.Scale.X, 8052 res.Add(new LSL_Vector(part.Scale));
8049 part.Scale.Y,
8050 part.Scale.Z));
8051 break; 8053 break;
8052 8054
8053 case (int)ScriptBaseClass.PRIM_ROTATION: 8055 case (int)ScriptBaseClass.PRIM_ROTATION:
@@ -8361,8 +8363,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8361 case (int)ScriptBaseClass.PRIM_DESC: 8363 case (int)ScriptBaseClass.PRIM_DESC:
8362 res.Add(new LSL_String(part.Description)); 8364 res.Add(new LSL_String(part.Description));
8363 break; 8365 break;
8364 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8366 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8365 res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); 8367 res.Add(new LSL_Rotation(part.RotationOffset));
8366 break; 8368 break;
8367 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 8369 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8368 res.Add(new LSL_Vector(GetPartLocalPos(part))); 8370 res.Add(new LSL_Vector(GetPartLocalPos(part)));
@@ -9571,7 +9573,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9571 9573
9572 // according to the docs, this command only works if script owner and land owner are the same 9574 // according to the docs, this command only works if script owner and land owner are the same
9573 // lets add estate owners and gods, too, and use the generic permission check. 9575 // lets add estate owners and gods, too, and use the generic permission check.
9574 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 9576 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
9575 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; 9577 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return;
9576 9578
9577 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? 9579 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
@@ -9890,21 +9892,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9890 m_host.AddScriptLPS(1); 9892 m_host.AddScriptLPS(1);
9891 9893
9892 if (m_item.PermsGranter == UUID.Zero) 9894 if (m_item.PermsGranter == UUID.Zero)
9893 return new LSL_Vector(); 9895 return Vector3.Zero;
9894 9896
9895 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 9897 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
9896 { 9898 {
9897 ShoutError("No permissions to track the camera"); 9899 ShoutError("No permissions to track the camera");
9898 return new LSL_Vector(); 9900 return Vector3.Zero;
9899 } 9901 }
9900 9902
9901 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 9903 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
9902 if (presence != null) 9904 if (presence != null)
9903 { 9905 {
9904 LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z); 9906 LSL_Vector pos = new LSL_Vector(presence.CameraPosition);
9905 return pos; 9907 return pos;
9906 } 9908 }
9907 return new LSL_Vector(); 9909
9910 return Vector3.Zero;
9908 } 9911 }
9909 9912
9910 public LSL_Rotation llGetCameraRot() 9913 public LSL_Rotation llGetCameraRot()
@@ -9912,21 +9915,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9912 m_host.AddScriptLPS(1); 9915 m_host.AddScriptLPS(1);
9913 9916
9914 if (m_item.PermsGranter == UUID.Zero) 9917 if (m_item.PermsGranter == UUID.Zero)
9915 return new LSL_Rotation(); 9918 return Quaternion.Identity;
9916 9919
9917 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 9920 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
9918 { 9921 {
9919 ShoutError("No permissions to track the camera"); 9922 ShoutError("No permissions to track the camera");
9920 return new LSL_Rotation(); 9923 return Quaternion.Identity;
9921 } 9924 }
9922 9925
9923 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 9926 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
9924 if (presence != null) 9927 if (presence != null)
9925 { 9928 {
9926 return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W); 9929 return new LSL_Rotation(presence.CameraRotation);
9927 } 9930 }
9928 9931
9929 return new LSL_Rotation(); 9932 return Quaternion.Identity;
9930 } 9933 }
9931 9934
9932 /// <summary> 9935 /// <summary>
@@ -9995,7 +9998,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9995 { 9998 {
9996 m_host.AddScriptLPS(1); 9999 m_host.AddScriptLPS(1);
9997 UUID key; 10000 UUID key;
9998 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 10001 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
9999 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 10002 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
10000 { 10003 {
10001 int expires = 0; 10004 int expires = 0;
@@ -10036,7 +10039,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10036 { 10039 {
10037 m_host.AddScriptLPS(1); 10040 m_host.AddScriptLPS(1);
10038 UUID key; 10041 UUID key;
10039 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 10042 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10040 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) 10043 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed))
10041 { 10044 {
10042 if (UUID.TryParse(avatar, out key)) 10045 if (UUID.TryParse(avatar, out key))
@@ -10063,7 +10066,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10063 { 10066 {
10064 m_host.AddScriptLPS(1); 10067 m_host.AddScriptLPS(1);
10065 UUID key; 10068 UUID key;
10066 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 10069 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10067 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 10070 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
10068 { 10071 {
10069 if (UUID.TryParse(avatar, out key)) 10072 if (UUID.TryParse(avatar, out key))
@@ -10325,7 +10328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10325 public void llResetLandBanList() 10328 public void llResetLandBanList()
10326 { 10329 {
10327 m_host.AddScriptLPS(1); 10330 m_host.AddScriptLPS(1);
10328 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 10331 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData;
10329 if (land.OwnerID == m_host.OwnerID) 10332 if (land.OwnerID == m_host.OwnerID)
10330 { 10333 {
10331 foreach (LandAccessEntry entry in land.ParcelAccessList) 10334 foreach (LandAccessEntry entry in land.ParcelAccessList)
@@ -10342,7 +10345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10342 public void llResetLandPassList() 10345 public void llResetLandPassList()
10343 { 10346 {
10344 m_host.AddScriptLPS(1); 10347 m_host.AddScriptLPS(1);
10345 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 10348 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData;
10346 if (land.OwnerID == m_host.OwnerID) 10349 if (land.OwnerID == m_host.OwnerID)
10347 { 10350 {
10348 foreach (LandAccessEntry entry in land.ParcelAccessList) 10351 foreach (LandAccessEntry entry in land.ParcelAccessList)
@@ -10518,7 +10521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10518 ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); 10521 ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z));
10519 break; 10522 break;
10520 case ScriptBaseClass.OBJECT_ROT: 10523 case ScriptBaseClass.OBJECT_ROT:
10521 ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); 10524 ret.Add(new LSL_Rotation(av.GetWorldRotation()));
10522 break; 10525 break;
10523 case ScriptBaseClass.OBJECT_VELOCITY: 10526 case ScriptBaseClass.OBJECT_VELOCITY:
10524 ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); 10527 ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z));
@@ -10920,7 +10923,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10920 10923
10921 LSL_List result = new LSL_List(); 10924 LSL_List result = new LSL_List();
10922 10925
10923 if (obj != null && obj.OwnerID != m_host.OwnerID) 10926 if (obj != null && obj.OwnerID == m_host.OwnerID)
10924 { 10927 {
10925 LSL_List remaining = GetPrimParams(obj, rules, ref result); 10928 LSL_List remaining = GetPrimParams(obj, rules, ref result);
10926 10929
@@ -11021,7 +11024,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11021 World.ForEachScenePresence(delegate(ScenePresence sp) 11024 World.ForEachScenePresence(delegate(ScenePresence sp)
11022 { 11025 {
11023 Vector3 ac = sp.AbsolutePosition - rayStart; 11026 Vector3 ac = sp.AbsolutePosition - rayStart;
11024 Vector3 bc = sp.AbsolutePosition - rayEnd; 11027// Vector3 bc = sp.AbsolutePosition - rayEnd;
11025 11028
11026 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); 11029 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
11027 11030
@@ -11111,7 +11114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11111 radius = Math.Abs(maxZ); 11114 radius = Math.Abs(maxZ);
11112 radius = radius*1.413f; 11115 radius = radius*1.413f;
11113 Vector3 ac = group.AbsolutePosition - rayStart; 11116 Vector3 ac = group.AbsolutePosition - rayStart;
11114 Vector3 bc = group.AbsolutePosition - rayEnd; 11117// Vector3 bc = group.AbsolutePosition - rayEnd;
11115 11118
11116 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); 11119 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
11117 11120
@@ -11455,7 +11458,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11455 list.Add(new LSL_Integer(linkNum)); 11458 list.Add(new LSL_Integer(linkNum));
11456 11459
11457 if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL) 11460 if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL)
11458 list.Add(new LSL_Vector(result.Normal.X, result.Normal.Y, result.Normal.Z)); 11461 list.Add(new LSL_Vector(result.Normal));
11459 11462
11460 values++; 11463 values++;
11461 if (values >= count) 11464 if (values >= count)
@@ -11557,7 +11560,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11557 return 16384; 11560 return 16384;
11558 } 11561 }
11559 11562
11560 public LSL_Integer llGetUsedMemory() 11563 public virtual LSL_Integer llGetUsedMemory()
11561 { 11564 {
11562 m_host.AddScriptLPS(1); 11565 m_host.AddScriptLPS(1);
11563 // The value returned for LSO scripts in SL 11566 // The value returned for LSO scripts in SL
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index d0922aa..21bae27 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -266,6 +266,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
266 { 266 {
267 llist[i] = new LSL_Float((float)result[i]); 267 llist[i] = new LSL_Float((float)result[i]);
268 } 268 }
269 else if (result[i] is double)
270 {
271 llist[i] = new LSL_Float((double)result[i]);
272 }
269 else if (result[i] is UUID) 273 else if (result[i] is UUID)
270 { 274 {
271 llist[i] = new LSL_Key(result[i].ToString()); 275 llist[i] = new LSL_Key(result[i].ToString());
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 48c6b50..bf1b45b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -363,7 +363,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
363 //OSSL only may be used if object is in the same group as the parcel 363 //OSSL only may be used if object is in the same group as the parcel
364 if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) 364 if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER"))
365 { 365 {
366 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 366 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
367 367
368 if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) 368 if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero)
369 { 369 {
@@ -374,7 +374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
374 //Only Parcelowners may use the function 374 //Only Parcelowners may use the function
375 if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) 375 if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER"))
376 { 376 {
377 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 377 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
378 378
379 if (land.LandData.OwnerID == ownerID) 379 if (land.LandData.OwnerID == ownerID)
380 { 380 {
@@ -1502,8 +1502,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1502 1502
1503 m_host.AddScriptLPS(1); 1503 m_host.AddScriptLPS(1);
1504 1504
1505 ILandObject land 1505 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
1506 = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
1507 1506
1508 if (land.LandData.OwnerID != m_host.OwnerID) 1507 if (land.LandData.OwnerID != m_host.OwnerID)
1509 return; 1508 return;
@@ -1519,8 +1518,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1519 1518
1520 m_host.AddScriptLPS(1); 1519 m_host.AddScriptLPS(1);
1521 1520
1522 ILandObject land 1521 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
1523 = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
1524 1522
1525 if (land.LandData.OwnerID != m_host.OwnerID) 1523 if (land.LandData.OwnerID != m_host.OwnerID)
1526 { 1524 {
@@ -2515,13 +2513,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2515 ScenePresence sp = World.GetScenePresence(npcId); 2513 ScenePresence sp = World.GetScenePresence(npcId);
2516 2514
2517 if (sp != null) 2515 if (sp != null)
2518 { 2516 return new LSL_Vector(sp.AbsolutePosition);
2519 Vector3 pos = sp.AbsolutePosition;
2520 return new LSL_Vector(pos.X, pos.Y, pos.Z);
2521 }
2522 } 2517 }
2523 2518
2524 return new LSL_Vector(0, 0, 0); 2519 return Vector3.Zero;
2525 } 2520 }
2526 2521
2527 public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) 2522 public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos)
@@ -2578,21 +2573,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2578 { 2573 {
2579 UUID npcId; 2574 UUID npcId;
2580 if (!UUID.TryParse(npc.m_string, out npcId)) 2575 if (!UUID.TryParse(npc.m_string, out npcId))
2581 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2576 return new LSL_Rotation(Quaternion.Identity);
2582 2577
2583 if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) 2578 if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
2584 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2579 return new LSL_Rotation(Quaternion.Identity);
2585 2580
2586 ScenePresence sp = World.GetScenePresence(npcId); 2581 ScenePresence sp = World.GetScenePresence(npcId);
2587 2582
2588 if (sp != null) 2583 if (sp != null)
2589 { 2584 return new LSL_Rotation(sp.GetWorldRotation());
2590 Quaternion rot = sp.Rotation;
2591 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
2592 }
2593 } 2585 }
2594 2586
2595 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2587 return Quaternion.Identity;
2596 } 2588 }
2597 2589
2598 public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) 2590 public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation)
@@ -3022,20 +3014,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3022 3014
3023 UUID avatarId = new UUID(avatar); 3015 UUID avatarId = new UUID(avatar);
3024 ScenePresence presence = World.GetScenePresence(avatarId); 3016 ScenePresence presence = World.GetScenePresence(avatarId);
3025 Vector3 pos = m_host.GetWorldPosition(); 3017
3026 bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 3018 if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
3027 if (result)
3028 { 3019 {
3029 if (presence != null) 3020 float health = presence.Health;
3030 { 3021 health += (float)healing;
3031 float health = presence.Health; 3022
3032 health += (float)healing; 3023 if (health >= 100)
3033 if (health >= 100) 3024 health = 100;
3034 { 3025
3035 health = 100; 3026 presence.setHealthWithUpdate(health);
3036 }
3037 presence.setHealthWithUpdate(health);
3038 }
3039 } 3027 }
3040 } 3028 }
3041 3029
@@ -3112,8 +3100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3112 if (avatar != null && avatar.UUID != m_host.OwnerID) 3100 if (avatar != null && avatar.UUID != m_host.OwnerID)
3113 { 3101 {
3114 result.Add(new LSL_String(avatar.UUID.ToString())); 3102 result.Add(new LSL_String(avatar.UUID.ToString()));
3115 OpenMetaverse.Vector3 ap = avatar.AbsolutePosition; 3103 result.Add(new LSL_Vector(avatar.AbsolutePosition));
3116 result.Add(new LSL_Vector(ap.X, ap.Y, ap.Z));
3117 result.Add(new LSL_String(avatar.Name)); 3104 result.Add(new LSL_String(avatar.Name));
3118 } 3105 }
3119 }); 3106 });
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index dd45406..88ab515 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -353,7 +353,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
353 // Position of a sensor in a child prim attached to an avatar 353 // Position of a sensor in a child prim attached to an avatar
354 // will be still wrong. 354 // will be still wrong.
355 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); 355 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
356 q = avatar.Rotation * q; 356 q = avatar.GetWorldRotation() * q;
357 } 357 }
358 358
359 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q); 359 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);
@@ -480,7 +480,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
480 // Position of a sensor in a child prim attached to an avatar 480 // Position of a sensor in a child prim attached to an avatar
481 // will be still wrong. 481 // will be still wrong.
482 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); 482 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
483 q = avatar.Rotation * q; 483 q = avatar.GetWorldRotation() * q;
484 } 484 }
485 485
486 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q); 486 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 9d20c9e..b71afe3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -662,13 +662,18 @@ namespace SecondLife
662 { 662 {
663 string severity = CompErr.IsWarning ? "Warning" : "Error"; 663 string severity = CompErr.IsWarning ? "Warning" : "Error";
664 664
665 KeyValuePair<int, int> lslPos; 665 KeyValuePair<int, int> errorPos;
666 666
667 // Show 5 errors max, but check entire list for errors 667 // Show 5 errors max, but check entire list for errors
668 668
669 if (severity == "Error") 669 if (severity == "Error")
670 { 670 {
671 lslPos = FindErrorPosition(CompErr.Line, CompErr.Column, m_lineMaps[assembly]); 671 // C# scripts will not have a linemap since theres no line translation involved.
672 if (!m_lineMaps.ContainsKey(assembly))
673 errorPos = new KeyValuePair<int, int>(CompErr.Line, CompErr.Column);
674 else
675 errorPos = FindErrorPosition(CompErr.Line, CompErr.Column, m_lineMaps[assembly]);
676
672 string text = CompErr.ErrorText; 677 string text = CompErr.ErrorText;
673 678
674 // Use LSL type names 679 // Use LSL type names
@@ -678,7 +683,7 @@ namespace SecondLife
678 // The Second Life viewer's script editor begins 683 // The Second Life viewer's script editor begins
679 // countingn lines and columns at 0, so we subtract 1. 684 // countingn lines and columns at 0, so we subtract 1.
680 errtext += String.Format("({0},{1}): {4} {2}: {3}\n", 685 errtext += String.Format("({0},{1}): {4} {2}: {3}\n",
681 lslPos.Key - 1, lslPos.Value - 1, 686 errorPos.Key - 1, errorPos.Value - 1,
682 CompErr.ErrorNumber, text, severity); 687 CompErr.ErrorNumber, text, severity);
683 hadErrors = true; 688 hadErrors = true;
684 } 689 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
index b0baa1c..ab44e38 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
@@ -209,7 +209,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
209 += (itemId, evp) => m_lslApi.llHTTPResponse(evp.Params[0].ToString(), 200, testResponse); 209 += (itemId, evp) => m_lslApi.llHTTPResponse(evp.Params[0].ToString(), 200, testResponse);
210 210
211// Console.WriteLine("Trying {0}", returnedUri); 211// Console.WriteLine("Trying {0}", returnedUri);
212 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri);
213 212
214 AssertHttpResponse(returnedUri, testResponse); 213 AssertHttpResponse(returnedUri, testResponse);
215 214