diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 220 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 44 |
2 files changed, 132 insertions, 132 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d634805..1fbfc52 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -371,6 +371,80 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
371 | } | 371 | } |
372 | } | 372 | } |
373 | 373 | ||
374 | /// <summary> | ||
375 | /// Get a given link entity from a linkset (linked objects and any sitting avatars). | ||
376 | /// </summary> | ||
377 | /// <remarks> | ||
378 | /// If there are any ScenePresence's in the linkset (i.e. because they are sat upon one of the prims), then | ||
379 | /// these are counted as extra entities that correspond to linknums beyond the number of prims in the linkset. | ||
380 | /// The ScenePresences receive linknums in the order in which they sat. | ||
381 | /// </remarks> | ||
382 | /// <returns> | ||
383 | /// The link entity. null if not found. | ||
384 | /// </returns> | ||
385 | /// <param name='linknum'> | ||
386 | /// Can be either a non-negative integer or ScriptBaseClass.LINK_THIS (-4). | ||
387 | /// If ScriptBaseClass.LINK_THIS then the entity containing the script is returned. | ||
388 | /// If the linkset has one entity and a linknum of zero is given, then the single entity is returned. If any | ||
389 | /// positive integer is given in this case then null is returned. | ||
390 | /// If the linkset has more than one entity and a linknum greater than zero but equal to or less than the number | ||
391 | /// of entities, then the entity which corresponds to that linknum is returned. | ||
392 | /// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then | ||
393 | /// null is returned. | ||
394 | /// </param> | ||
395 | public ISceneEntity GetLinkEntity(int linknum) | ||
396 | { | ||
397 | if (linknum < 0) | ||
398 | { | ||
399 | if (linknum == ScriptBaseClass.LINK_THIS) | ||
400 | return m_host; | ||
401 | else | ||
402 | return null; | ||
403 | } | ||
404 | |||
405 | int actualPrimCount = m_host.ParentGroup.PrimCount; | ||
406 | List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars(); | ||
407 | int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count; | ||
408 | |||
409 | // Special case for a single prim. In this case the linknum is zero. However, this will not match a single | ||
410 | // prim that has any avatars sat upon it (in which case the root prim is link 1). | ||
411 | if (linknum == 0) | ||
412 | { | ||
413 | if (actualPrimCount == 1 && sittingAvatarIds.Count == 0) | ||
414 | return m_host; | ||
415 | |||
416 | return null; | ||
417 | } | ||
418 | // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but | ||
419 | // here we must match 1 (ScriptBaseClass.LINK_ROOT). | ||
420 | else if (linknum == ScriptBaseClass.LINK_ROOT && actualPrimCount == 1) | ||
421 | { | ||
422 | if (sittingAvatarIds.Count > 0) | ||
423 | return m_host.ParentGroup.RootPart; | ||
424 | else | ||
425 | return null; | ||
426 | } | ||
427 | else if (linknum <= adjustedPrimCount) | ||
428 | { | ||
429 | if (linknum <= actualPrimCount) | ||
430 | { | ||
431 | return m_host.ParentGroup.GetLinkNumPart(linknum); | ||
432 | } | ||
433 | else | ||
434 | { | ||
435 | ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]); | ||
436 | if (sp != null) | ||
437 | return sp; | ||
438 | else | ||
439 | return null; | ||
440 | } | ||
441 | } | ||
442 | else | ||
443 | { | ||
444 | return null; | ||
445 | } | ||
446 | } | ||
447 | |||
374 | public List<SceneObjectPart> GetLinkParts(int linkType) | 448 | public List<SceneObjectPart> GetLinkParts(int linkType) |
375 | { | 449 | { |
376 | return GetLinkParts(m_host, linkType); | 450 | return GetLinkParts(m_host, linkType); |
@@ -4149,55 +4223,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4149 | { | 4223 | { |
4150 | m_host.AddScriptLPS(1); | 4224 | m_host.AddScriptLPS(1); |
4151 | 4225 | ||
4152 | if (linknum < 0) | 4226 | ISceneEntity entity = GetLinkEntity(linknum); |
4153 | { | ||
4154 | if (linknum == ScriptBaseClass.LINK_THIS) | ||
4155 | return m_host.Name; | ||
4156 | else | ||
4157 | return ScriptBaseClass.NULL_KEY; | ||
4158 | } | ||
4159 | |||
4160 | int actualPrimCount = m_host.ParentGroup.PrimCount; | ||
4161 | List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars(); | ||
4162 | int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count; | ||
4163 | |||
4164 | // Special case for a single prim. In this case the linknum is zero. However, this will not match a single | ||
4165 | // prim that has any avatars sat upon it (in which case the root prim is link 1). | ||
4166 | if (linknum == 0) | ||
4167 | { | ||
4168 | if (actualPrimCount == 1 && sittingAvatarIds.Count == 0) | ||
4169 | return m_host.Name; | ||
4170 | 4227 | ||
4171 | return ScriptBaseClass.NULL_KEY; | 4228 | if (entity != null) |
4172 | } | 4229 | return entity.Name; |
4173 | // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but | ||
4174 | // here we must match 1 (ScriptBaseClass.LINK_ROOT). | ||
4175 | else if (linknum == 1 && actualPrimCount == 1) | ||
4176 | { | ||
4177 | if (sittingAvatarIds.Count > 0) | ||
4178 | return m_host.ParentGroup.RootPart.Name; | ||
4179 | else | ||
4180 | return ScriptBaseClass.NULL_KEY; | ||
4181 | } | ||
4182 | else if (linknum <= adjustedPrimCount) | ||
4183 | { | ||
4184 | if (linknum <= actualPrimCount) | ||
4185 | { | ||
4186 | return m_host.ParentGroup.GetLinkNumPart(linknum).Name; | ||
4187 | } | ||
4188 | else | ||
4189 | { | ||
4190 | ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]); | ||
4191 | if (sp != null) | ||
4192 | return sp.Name; | ||
4193 | else | ||
4194 | return ScriptBaseClass.NULL_KEY; | ||
4195 | } | ||
4196 | } | ||
4197 | else | 4230 | else |
4198 | { | ||
4199 | return ScriptBaseClass.NULL_KEY; | 4231 | return ScriptBaseClass.NULL_KEY; |
4200 | } | ||
4201 | } | 4232 | } |
4202 | 4233 | ||
4203 | public LSL_Integer llGetInventoryNumber(int type) | 4234 | public LSL_Integer llGetInventoryNumber(int type) |
@@ -4562,8 +4593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4562 | if (presence.UserLevel >= 200) return; | 4593 | if (presence.UserLevel >= 200) return; |
4563 | 4594 | ||
4564 | // agent must be over the owners land | 4595 | // agent must be over the owners land |
4565 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 4596 | if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) |
4566 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
4567 | { | 4597 | { |
4568 | if (!World.TeleportClientHome(agentId, presence.ControllingClient)) | 4598 | if (!World.TeleportClientHome(agentId, presence.ControllingClient)) |
4569 | { | 4599 | { |
@@ -4579,6 +4609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4579 | } | 4609 | } |
4580 | } | 4610 | } |
4581 | } | 4611 | } |
4612 | |||
4582 | ScriptSleep(5000); | 4613 | ScriptSleep(5000); |
4583 | } | 4614 | } |
4584 | 4615 | ||
@@ -4598,10 +4629,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4598 | if (destination == String.Empty) | 4629 | if (destination == String.Empty) |
4599 | destination = World.RegionInfo.RegionName; | 4630 | destination = World.RegionInfo.RegionName; |
4600 | 4631 | ||
4601 | Vector3 pos = presence.AbsolutePosition; | ||
4602 | |||
4603 | // agent must be over the owners land | 4632 | // agent must be over the owners land |
4604 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | 4633 | if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) |
4605 | { | 4634 | { |
4606 | DoLLTeleport(presence, destination, targetPos, targetLookAt); | 4635 | DoLLTeleport(presence, destination, targetPos, targetLookAt); |
4607 | } | 4636 | } |
@@ -4631,10 +4660,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4631 | // agent must not be a god | 4660 | // agent must not be a god |
4632 | if (presence.GodLevel >= 200) return; | 4661 | if (presence.GodLevel >= 200) return; |
4633 | 4662 | ||
4634 | Vector3 pos = presence.AbsolutePosition; | ||
4635 | |||
4636 | // agent must be over the owners land | 4663 | // agent must be over the owners land |
4637 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | 4664 | if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) |
4638 | { | 4665 | { |
4639 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | 4666 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); |
4640 | } | 4667 | } |
@@ -4849,7 +4876,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4849 | { | 4876 | { |
4850 | if (pushrestricted) | 4877 | if (pushrestricted) |
4851 | { | 4878 | { |
4852 | ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); | 4879 | ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos); |
4853 | 4880 | ||
4854 | // We didn't find the parcel but region is push restricted so assume it is NOT ok | 4881 | // We didn't find the parcel but region is push restricted so assume it is NOT ok |
4855 | if (targetlandObj == null) | 4882 | if (targetlandObj == null) |
@@ -4864,7 +4891,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4864 | } | 4891 | } |
4865 | else | 4892 | else |
4866 | { | 4893 | { |
4867 | ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); | 4894 | ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos); |
4868 | if (targetlandObj == null) | 4895 | if (targetlandObj == null) |
4869 | { | 4896 | { |
4870 | // We didn't find the parcel but region isn't push restricted so assume it's ok | 4897 | // We didn't find the parcel but region isn't push restricted so assume it's ok |
@@ -6146,12 +6173,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6146 | } | 6173 | } |
6147 | 6174 | ||
6148 | ILandObject land; | 6175 | ILandObject land; |
6149 | Vector3 pos; | ||
6150 | UUID id = UUID.Zero; | 6176 | UUID id = UUID.Zero; |
6177 | |||
6151 | if (parcel || parcelOwned) | 6178 | if (parcel || parcelOwned) |
6152 | { | 6179 | { |
6153 | pos = m_host.ParentGroup.RootPart.GetWorldPosition(); | 6180 | land = World.LandChannel.GetLandObject(m_host.ParentGroup.RootPart.GetWorldPosition()); |
6154 | land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
6155 | if (land == null) | 6181 | if (land == null) |
6156 | { | 6182 | { |
6157 | id = UUID.Zero; | 6183 | id = UUID.Zero; |
@@ -6177,8 +6203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6177 | { | 6203 | { |
6178 | if (!regionWide) | 6204 | if (!regionWide) |
6179 | { | 6205 | { |
6180 | pos = ssp.AbsolutePosition; | 6206 | land = World.LandChannel.GetLandObject(ssp.AbsolutePosition); |
6181 | land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
6182 | if (land != null) | 6207 | if (land != null) |
6183 | { | 6208 | { |
6184 | if (parcelOwned && land.LandData.OwnerID == id || | 6209 | if (parcelOwned && land.LandData.OwnerID == id || |
@@ -6308,10 +6333,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6308 | ScenePresence presence = World.GetScenePresence(agentID); | 6333 | ScenePresence presence = World.GetScenePresence(agentID); |
6309 | if (presence != null) | 6334 | if (presence != null) |
6310 | { | 6335 | { |
6311 | Vector3 pos = presence.AbsolutePosition; | ||
6312 | |||
6313 | // agent must be over the owners land | 6336 | // agent must be over the owners land |
6314 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | 6337 | ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition); |
6315 | if (land == null) | 6338 | if (land == null) |
6316 | return; | 6339 | return; |
6317 | 6340 | ||
@@ -6340,9 +6363,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6340 | ScenePresence presence = World.GetScenePresence(key); | 6363 | ScenePresence presence = World.GetScenePresence(key); |
6341 | if (presence != null) // object is an avatar | 6364 | if (presence != null) // object is an avatar |
6342 | { | 6365 | { |
6343 | Vector3 pos = presence.AbsolutePosition; | 6366 | if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) |
6344 | |||
6345 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | ||
6346 | return 1; | 6367 | return 1; |
6347 | } | 6368 | } |
6348 | else // object is not an avatar | 6369 | else // object is not an avatar |
@@ -6351,9 +6372,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6351 | 6372 | ||
6352 | if (obj != null) | 6373 | if (obj != null) |
6353 | { | 6374 | { |
6354 | Vector3 pos = obj.AbsolutePosition; | 6375 | if (m_host.OwnerID == World.LandChannel.GetLandObject(obj.AbsolutePosition).LandData.OwnerID) |
6355 | |||
6356 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | ||
6357 | return 1; | 6376 | return 1; |
6358 | } | 6377 | } |
6359 | } | 6378 | } |
@@ -6463,10 +6482,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6463 | // if the land is group owned and the object is group owned by the same group | 6482 | // if the land is group owned and the object is group owned by the same group |
6464 | // or | 6483 | // or |
6465 | // if the object is owned by a person with estate access. | 6484 | // if the object is owned by a person with estate access. |
6466 | 6485 | ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition); | |
6467 | Vector3 pos = av.AbsolutePosition; | ||
6468 | |||
6469 | ILandObject parcel = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
6470 | if (parcel != null) | 6486 | if (parcel != null) |
6471 | { | 6487 | { |
6472 | if (m_host.OwnerID == parcel.LandData.OwnerID || | 6488 | if (m_host.OwnerID == parcel.LandData.OwnerID || |
@@ -7053,9 +7069,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7053 | { | 7069 | { |
7054 | m_host.AddScriptLPS(1); | 7070 | m_host.AddScriptLPS(1); |
7055 | UUID key; | 7071 | UUID key; |
7056 | Vector3 pos = m_host.AbsolutePosition; | 7072 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
7057 | 7073 | ||
7058 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
7059 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 7074 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
7060 | { | 7075 | { |
7061 | int expires = 0; | 7076 | int expires = 0; |
@@ -8492,8 +8507,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8492 | { | 8507 | { |
8493 | m_host.AddScriptLPS(1); | 8508 | m_host.AddScriptLPS(1); |
8494 | 8509 | ||
8495 | Vector3 pos = m_host.AbsolutePosition; | 8510 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
8496 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
8497 | 8511 | ||
8498 | if (land.LandData.OwnerID != m_host.OwnerID) | 8512 | if (land.LandData.OwnerID != m_host.OwnerID) |
8499 | return; | 8513 | return; |
@@ -8507,8 +8521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8507 | { | 8521 | { |
8508 | m_host.AddScriptLPS(1); | 8522 | m_host.AddScriptLPS(1); |
8509 | 8523 | ||
8510 | Vector3 pos = m_host.AbsolutePosition; | 8524 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
8511 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
8512 | 8525 | ||
8513 | if (land.LandData.OwnerID != m_host.OwnerID) | 8526 | if (land.LandData.OwnerID != m_host.OwnerID) |
8514 | return String.Empty; | 8527 | return String.Empty; |
@@ -8717,8 +8730,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8717 | 8730 | ||
8718 | public LSL_Vector llGetGeometricCenter() | 8731 | public LSL_Vector llGetGeometricCenter() |
8719 | { | 8732 | { |
8720 | Vector3 tmp = m_host.GetGeometricCenter(); | 8733 | return new LSL_Vector(m_host.GetGeometricCenter()); |
8721 | return new LSL_Vector(tmp.X, tmp.Y, tmp.Z); | ||
8722 | } | 8734 | } |
8723 | 8735 | ||
8724 | public LSL_List llGetPrimitiveParams(LSL_List rules) | 8736 | public LSL_List llGetPrimitiveParams(LSL_List rules) |
@@ -8825,9 +8837,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8825 | break; | 8837 | break; |
8826 | 8838 | ||
8827 | case (int)ScriptBaseClass.PRIM_SIZE: | 8839 | case (int)ScriptBaseClass.PRIM_SIZE: |
8828 | res.Add(new LSL_Vector(part.Scale.X, | 8840 | res.Add(new LSL_Vector(part.Scale)); |
8829 | part.Scale.Y, | ||
8830 | part.Scale.Z)); | ||
8831 | break; | 8841 | break; |
8832 | 8842 | ||
8833 | case (int)ScriptBaseClass.PRIM_ROTATION: | 8843 | case (int)ScriptBaseClass.PRIM_ROTATION: |
@@ -9188,9 +9198,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9188 | case (int)ScriptBaseClass.PRIM_DESC: | 9198 | case (int)ScriptBaseClass.PRIM_DESC: |
9189 | res.Add(new LSL_String(part.Description)); | 9199 | res.Add(new LSL_String(part.Description)); |
9190 | break; | 9200 | break; |
9191 | 9201 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | |
9192 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 9202 | res.Add(new LSL_Rotation(part.RotationOffset)); |
9193 | res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); | ||
9194 | break; | 9203 | break; |
9195 | 9204 | ||
9196 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 9205 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
@@ -10374,7 +10383,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10374 | 10383 | ||
10375 | // according to the docs, this command only works if script owner and land owner are the same | 10384 | // according to the docs, this command only works if script owner and land owner are the same |
10376 | // lets add estate owners and gods, too, and use the generic permission check. | 10385 | // lets add estate owners and gods, too, and use the generic permission check. |
10377 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 10386 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
10378 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; | 10387 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; |
10379 | 10388 | ||
10380 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? | 10389 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? |
@@ -10697,22 +10706,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10697 | m_host.AddScriptLPS(1); | 10706 | m_host.AddScriptLPS(1); |
10698 | 10707 | ||
10699 | if (m_item.PermsGranter == UUID.Zero) | 10708 | if (m_item.PermsGranter == UUID.Zero) |
10700 | return new LSL_Vector(); | 10709 | return Vector3.Zero; |
10701 | 10710 | ||
10702 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 10711 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10703 | { | 10712 | { |
10704 | ShoutError("No permissions to track the camera"); | 10713 | ShoutError("No permissions to track the camera"); |
10705 | return new LSL_Vector(); | 10714 | return Vector3.Zero; |
10706 | } | 10715 | } |
10707 | 10716 | ||
10708 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 10717 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
10709 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); | 10718 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
10710 | if (presence != null) | 10719 | if (presence != null) |
10711 | { | 10720 | { |
10712 | LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z); | 10721 | LSL_Vector pos = new LSL_Vector(presence.CameraPosition); |
10713 | return pos; | 10722 | return pos; |
10714 | } | 10723 | } |
10715 | return new LSL_Vector(); | 10724 | |
10725 | return Vector3.Zero; | ||
10716 | } | 10726 | } |
10717 | 10727 | ||
10718 | public LSL_Rotation llGetCameraRot() | 10728 | public LSL_Rotation llGetCameraRot() |
@@ -10720,22 +10730,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10720 | m_host.AddScriptLPS(1); | 10730 | m_host.AddScriptLPS(1); |
10721 | 10731 | ||
10722 | if (m_item.PermsGranter == UUID.Zero) | 10732 | if (m_item.PermsGranter == UUID.Zero) |
10723 | return new LSL_Rotation(); | 10733 | return Quaternion.Identity; |
10724 | 10734 | ||
10725 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 10735 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10726 | { | 10736 | { |
10727 | ShoutError("No permissions to track the camera"); | 10737 | ShoutError("No permissions to track the camera"); |
10728 | return new LSL_Rotation(); | 10738 | return Quaternion.Identity; |
10729 | } | 10739 | } |
10730 | 10740 | ||
10731 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 10741 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
10732 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); | 10742 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
10733 | if (presence != null) | 10743 | if (presence != null) |
10734 | { | 10744 | { |
10735 | return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W); | 10745 | return new LSL_Rotation(presence.CameraRotation); |
10736 | } | 10746 | } |
10737 | 10747 | ||
10738 | return new LSL_Rotation(); | 10748 | return Quaternion.Identity; |
10739 | } | 10749 | } |
10740 | 10750 | ||
10741 | /// <summary> | 10751 | /// <summary> |
@@ -10816,7 +10826,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10816 | { | 10826 | { |
10817 | m_host.AddScriptLPS(1); | 10827 | m_host.AddScriptLPS(1); |
10818 | UUID key; | 10828 | UUID key; |
10819 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 10829 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
10820 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 10830 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
10821 | { | 10831 | { |
10822 | int expires = 0; | 10832 | int expires = 0; |
@@ -10857,7 +10867,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10857 | { | 10867 | { |
10858 | m_host.AddScriptLPS(1); | 10868 | m_host.AddScriptLPS(1); |
10859 | UUID key; | 10869 | UUID key; |
10860 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 10870 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
10861 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) | 10871 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) |
10862 | { | 10872 | { |
10863 | if (UUID.TryParse(avatar, out key)) | 10873 | if (UUID.TryParse(avatar, out key)) |
@@ -10884,7 +10894,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10884 | { | 10894 | { |
10885 | m_host.AddScriptLPS(1); | 10895 | m_host.AddScriptLPS(1); |
10886 | UUID key; | 10896 | UUID key; |
10887 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 10897 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
10888 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 10898 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
10889 | { | 10899 | { |
10890 | if (UUID.TryParse(avatar, out key)) | 10900 | if (UUID.TryParse(avatar, out key)) |
@@ -11250,7 +11260,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11250 | public void llResetLandBanList() | 11260 | public void llResetLandBanList() |
11251 | { | 11261 | { |
11252 | m_host.AddScriptLPS(1); | 11262 | m_host.AddScriptLPS(1); |
11253 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 11263 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; |
11254 | if (land.OwnerID == m_host.OwnerID) | 11264 | if (land.OwnerID == m_host.OwnerID) |
11255 | { | 11265 | { |
11256 | foreach (LandAccessEntry entry in land.ParcelAccessList) | 11266 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
@@ -11267,7 +11277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11267 | public void llResetLandPassList() | 11277 | public void llResetLandPassList() |
11268 | { | 11278 | { |
11269 | m_host.AddScriptLPS(1); | 11279 | m_host.AddScriptLPS(1); |
11270 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 11280 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; |
11271 | if (land.OwnerID == m_host.OwnerID) | 11281 | if (land.OwnerID == m_host.OwnerID) |
11272 | { | 11282 | { |
11273 | foreach (LandAccessEntry entry in land.ParcelAccessList) | 11283 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
@@ -11967,7 +11977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11967 | World.ForEachScenePresence(delegate(ScenePresence sp) | 11977 | World.ForEachScenePresence(delegate(ScenePresence sp) |
11968 | { | 11978 | { |
11969 | Vector3 ac = sp.AbsolutePosition - rayStart; | 11979 | Vector3 ac = sp.AbsolutePosition - rayStart; |
11970 | Vector3 bc = sp.AbsolutePosition - rayEnd; | 11980 | // Vector3 bc = sp.AbsolutePosition - rayEnd; |
11971 | 11981 | ||
11972 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); | 11982 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); |
11973 | 11983 | ||
@@ -12057,7 +12067,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12057 | radius = Math.Abs(maxZ); | 12067 | radius = Math.Abs(maxZ); |
12058 | radius = radius*1.413f; | 12068 | radius = radius*1.413f; |
12059 | Vector3 ac = group.AbsolutePosition - rayStart; | 12069 | Vector3 ac = group.AbsolutePosition - rayStart; |
12060 | Vector3 bc = group.AbsolutePosition - rayEnd; | 12070 | // Vector3 bc = group.AbsolutePosition - rayEnd; |
12061 | 12071 | ||
12062 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); | 12072 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); |
12063 | 12073 | ||
@@ -12435,7 +12445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12435 | list.Add(new LSL_Integer(linkNum)); | 12445 | list.Add(new LSL_Integer(linkNum)); |
12436 | 12446 | ||
12437 | if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL) | 12447 | if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL) |
12438 | list.Add(new LSL_Vector(result.Normal.X, result.Normal.Y, result.Normal.Z)); | 12448 | list.Add(new LSL_Vector(result.Normal)); |
12439 | 12449 | ||
12440 | values++; | 12450 | values++; |
12441 | if (values >= count) | 12451 | if (values >= count) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a214935..234ba34 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -372,7 +372,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
372 | //OSSL only may be used if object is in the same group as the parcel | 372 | //OSSL only may be used if object is in the same group as the parcel |
373 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) | 373 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) |
374 | { | 374 | { |
375 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 375 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
376 | 376 | ||
377 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) | 377 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) |
378 | { | 378 | { |
@@ -383,7 +383,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
383 | //Only Parcelowners may use the function | 383 | //Only Parcelowners may use the function |
384 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) | 384 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) |
385 | { | 385 | { |
386 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 386 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
387 | 387 | ||
388 | if (land.LandData.OwnerID == ownerID) | 388 | if (land.LandData.OwnerID == ownerID) |
389 | { | 389 | { |
@@ -1511,8 +1511,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1511 | 1511 | ||
1512 | m_host.AddScriptLPS(1); | 1512 | m_host.AddScriptLPS(1); |
1513 | 1513 | ||
1514 | ILandObject land | 1514 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
1515 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
1516 | 1515 | ||
1517 | if (land.LandData.OwnerID != m_host.OwnerID) | 1516 | if (land.LandData.OwnerID != m_host.OwnerID) |
1518 | return; | 1517 | return; |
@@ -1528,8 +1527,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1528 | 1527 | ||
1529 | m_host.AddScriptLPS(1); | 1528 | m_host.AddScriptLPS(1); |
1530 | 1529 | ||
1531 | ILandObject land | 1530 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
1532 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
1533 | 1531 | ||
1534 | if (land.LandData.OwnerID != m_host.OwnerID) | 1532 | if (land.LandData.OwnerID != m_host.OwnerID) |
1535 | { | 1533 | { |
@@ -2578,13 +2576,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2578 | ScenePresence sp = World.GetScenePresence(npcId); | 2576 | ScenePresence sp = World.GetScenePresence(npcId); |
2579 | 2577 | ||
2580 | if (sp != null) | 2578 | if (sp != null) |
2581 | { | 2579 | return new LSL_Vector(sp.AbsolutePosition); |
2582 | Vector3 pos = sp.AbsolutePosition; | ||
2583 | return new LSL_Vector(pos.X, pos.Y, pos.Z); | ||
2584 | } | ||
2585 | } | 2580 | } |
2586 | 2581 | ||
2587 | return new LSL_Vector(0, 0, 0); | 2582 | return Vector3.Zero; |
2588 | } | 2583 | } |
2589 | 2584 | ||
2590 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) | 2585 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) |
@@ -2652,7 +2647,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2652 | return new LSL_Rotation(sp.GetWorldRotation()); | 2647 | return new LSL_Rotation(sp.GetWorldRotation()); |
2653 | } | 2648 | } |
2654 | 2649 | ||
2655 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2650 | return Quaternion.Identity; |
2656 | } | 2651 | } |
2657 | 2652 | ||
2658 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) | 2653 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) |
@@ -3098,20 +3093,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3098 | 3093 | ||
3099 | UUID avatarId = new UUID(avatar); | 3094 | UUID avatarId = new UUID(avatar); |
3100 | ScenePresence presence = World.GetScenePresence(avatarId); | 3095 | ScenePresence presence = World.GetScenePresence(avatarId); |
3101 | Vector3 pos = m_host.GetWorldPosition(); | 3096 | |
3102 | bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.X, (float)pos.Y, (float)pos.Z)); | 3097 | if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) |
3103 | if (result) | ||
3104 | { | 3098 | { |
3105 | if (presence != null) | 3099 | float health = presence.Health; |
3106 | { | 3100 | health += (float)healing; |
3107 | float health = presence.Health; | 3101 | |
3108 | health += (float)healing; | 3102 | if (health >= 100) |
3109 | if (health >= 100) | 3103 | health = 100; |
3110 | { | 3104 | |
3111 | health = 100; | 3105 | presence.setHealthWithUpdate(health); |
3112 | } | ||
3113 | presence.setHealthWithUpdate(health); | ||
3114 | } | ||
3115 | } | 3106 | } |
3116 | } | 3107 | } |
3117 | 3108 | ||
@@ -3188,8 +3179,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3188 | if (avatar != null && avatar.UUID != m_host.OwnerID) | 3179 | if (avatar != null && avatar.UUID != m_host.OwnerID) |
3189 | { | 3180 | { |
3190 | result.Add(new LSL_String(avatar.UUID.ToString())); | 3181 | result.Add(new LSL_String(avatar.UUID.ToString())); |
3191 | OpenMetaverse.Vector3 ap = avatar.AbsolutePosition; | 3182 | result.Add(new LSL_Vector(avatar.AbsolutePosition)); |
3192 | result.Add(new LSL_Vector(ap.X, ap.Y, ap.Z)); | ||
3193 | result.Add(new LSL_String(avatar.Name)); | 3183 | result.Add(new LSL_String(avatar.Name)); |
3194 | } | 3184 | } |
3195 | }); | 3185 | }); |