aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs53
1 files changed, 20 insertions, 33 deletions
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 });