From b2903c4a8a2e36f570d824a57587be2b24c24d36 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 23 Dec 2007 13:14:56 +0000 Subject: [PATCH] * Patch from Alondria - Added LLFunctions llGetMass(), llGetLandOwnerAt(), llGetVel(), llGround() --- OpenSim/Region/Environment/Scenes/Scene.cs | 18 +++++++++++++++++- .../Environment/Scenes/SceneObjectPart.cs | 16 ++++++++++++++++ .../Server_API/LSL_BuiltIn_Commands.cs | 14 ++++++-------- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 89dc13000a..f12fb92bd1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1964,7 +1964,23 @@ namespace OpenSim.Region.Environment.Scenes { m_eventManager.TriggerOnPluginConsole(args); } - + public double GetLandHeight(int x, int y) + { + return Terrain.GetHeight(x, y); + } + public LLUUID GetLandOwner(float x, float y) + { + Land land = LandManager.getLandObject(x, y); + if (land == null) + { + return LLUUID.Zero; + } + else + { + return land.landData.ownerID; + } + } + #endregion #region Script Engine diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 5398de0f09..66fc53c646 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1225,6 +1225,22 @@ namespace OpenSim.Region.Environment.Scenes #endregion + #region Physics + + public float GetMass() + { + if (PhysActor != null) + { + return PhysActor.Mass; + } + else + { + return 0; + } + } + + #endregion + #region Texture /// diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index a0cd43a3ad..909b4e3a19 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs @@ -410,8 +410,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public double llGround(LSL_Types.Vector3 offset) { - NotImplemented("llGround"); - return 0; + int x = (int)(m_host.AbsolutePosition.X + offset.x); + int y = (int)(m_host.AbsolutePosition.Y + offset.y); + return World.GetLandHeight(x, y); } public double llCloud(LSL_Types.Vector3 offset) @@ -824,8 +825,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public LSL_Types.Vector3 llGetVel() { - NotImplemented("llGetVel"); - return new LSL_Types.Vector3(); + return new LSL_Types.Vector3(m_host.Velocity.X, m_host.Velocity.Y, m_host.Velocity.Z); } public LSL_Types.Vector3 llGetAccel() @@ -993,8 +993,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public double llGetMass() { - NotImplemented("llGetMass"); - return 0; + return m_host.GetMass(); } public void llCollisionFilter(string name, string id, int accept) @@ -1922,8 +1921,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { - NotImplemented("llGetLandOwnerAt"); - return ""; + return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); } public string llGetNotecardLine(string name, int line)