From fa2495ae6b39b8b1f98bed221d4d2660724018de Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 24 Dec 2007 21:16:32 +0000 Subject: Again, great thanks to Alondria for: Adding:: llSetParcelMusicUrl(), llGetRootPosition(), llGetRootRotation(), llGetGeometricCenter(), llSetLocalRot(), llListReplaceList(), llGetObjectPrimCount(),llGetParcelDetails(), llGetParcelMaxPrims(), llWater(), llGetLocalRot(), and llGetAccel() --- OpenSim/Region/Environment/Scenes/Scene.cs | 21 ++++- .../Region/Environment/Scenes/SceneObjectPart.cs | 14 ++- .../Common/LSL_BuiltIn_Commands_Interface.cs | 2 +- .../DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | 4 +- .../Compiler/Server_API/LSL_BuiltIn_Commands.cs | 101 ++++++++++++++++----- 5 files changed, 115 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 117cbd5..cf17686 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1981,7 +1981,26 @@ namespace OpenSim.Region.Environment.Scenes return land.landData.ownerID; } } - + + public LandData GetLandData(float x, float y) + { + return LandManager.getLandObject(x, y).landData; + } + + public void SetLandMusicURL(float x, float y, string url) + { + Land land = LandManager.getLandObject(x, y); + if (land == null) + { + return; + } + else + { + land.landData.musicURL = url; + return; + } + } + #endregion #region Script Engine diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 66fc53c..cbb50d7 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -543,7 +543,7 @@ namespace OpenSim.Region.Environment.Scenes bool isPhantom = ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0); bool usePhysics = isPhysical && !isPhantom; - + if (usePhysics) { PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape( @@ -1239,6 +1239,18 @@ namespace OpenSim.Region.Environment.Scenes } } + public LLVector3 GetGeometricCenter() + { + if (PhysActor != null) + { + return new LLVector3(PhysActor.CenterOfMass.X,PhysActor.CenterOfMass.Y,PhysActor.CenterOfMass.Z); + } + else + { + return new LLVector3(0, 0, 0); + } + } + #endregion #region Texture diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 34bac59..6ba7018 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs @@ -569,7 +569,7 @@ namespace OpenSim.Region.ScriptEngine.Common void llForceMouselook(int mouselook); //wiki: double llGetObjectMass(key id) double llGetObjectMass(string id); - void llListReplaceList(); + LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end); //wiki: llLoadURL(key avatar_id, string message, string url) void llLoadURL(string avatar_id, string message, string url); //wiki: llParcelMediaCommandList( list commandList ) diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 1657b74..a9297fd 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs @@ -1636,9 +1636,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL return m_LSL_Functions.llGetObjectMass(id); } - public void llListReplaceList() + public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) { - m_LSL_Functions.llListReplaceList(); + return m_LSL_Functions.llListReplaceList(dest,src,start,end); } public void llLoadURL(string avatar_id, string message, string url) 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 909b4e3..eeecd21 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 @@ -34,6 +34,7 @@ using System.Text; using System.Threading; using Axiom.Math; using libsecondlife; +using libsecondlife.StructuredData; using OpenSim.Framework; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; @@ -750,8 +751,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public LSL_Types.Quaternion llGetLocalRot() { - NotImplemented("llGetLocalRot"); - return new LSL_Types.Quaternion(); + return new LSL_Types.Quaternion(m_host.RotationOffset.X, m_host.RotationOffset.Y, m_host.RotationOffset.Z, m_host.RotationOffset.W); } public void llSetForce(LSL_Types.Vector3 force, int local) @@ -830,8 +830,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public LSL_Types.Vector3 llGetAccel() { - NotImplemented("llGetAccel"); - return new LSL_Types.Vector3(); + return new LSL_Types.Vector3(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z); } public LSL_Types.Vector3 llGetOmega() @@ -1346,8 +1345,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public double llWater(LSL_Types.Vector3 offset) { - NotImplemented("llWater"); - return 0; + return World.RegionInfo.EstateSettings.waterHeight; } public void llPassTouches(int pass) @@ -2360,19 +2358,26 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public void llSetParcelMusicURL(string url) { - NotImplemented("llSetParcelMusicURL"); + LLUUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + if (landowner == null) + { + return; + } + if (landowner != m_host.ObjectOwner) + { + return; + } + World.SetLandMusicURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url); } public LSL_Types.Vector3 llGetRootPosition() { - NotImplemented("llGetRootPosition"); - return new LSL_Types.Vector3(); + return new LSL_Types.Vector3(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, m_host.ParentGroup.AbsolutePosition.Z); } public LSL_Types.Quaternion llGetRootRotation() { - NotImplemented("llGetRootRotation"); - return new LSL_Types.Quaternion(); + return new LSL_Types.Quaternion(m_host.ParentGroup.GroupRotation.X, m_host.ParentGroup.GroupRotation.Y, m_host.ParentGroup.GroupRotation.Z, m_host.ParentGroup.GroupRotation.W); } public string llGetObjectDesc() @@ -2495,8 +2500,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public LSL_Types.Vector3 llGetGeometricCenter() { - NotImplemented("llGetGeometricCenter"); - return new LSL_Types.Vector3(); + return new LSL_Types.Vector3(m_host.GetGeometricCenter().X, m_host.GetGeometricCenter().Y, m_host.GetGeometricCenter().Z); } public void llGetPrimitiveParams() @@ -2528,7 +2532,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public void llSetLocalRot(LSL_Types.Quaternion rot) { - NotImplemented("llSetLocalRot"); + m_host.RotationOffset = new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); } public LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list seperators, LSL_Types.list spacers) @@ -2594,9 +2598,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler return 0; } - public void llListReplaceList() + public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) { - NotImplemented("llListReplaceList"); + return dest.GetSublist(0, start - 1) + src + dest.GetSublist(end + 1, -1); } public void llLoadURL(string avatar_id, string message, string url) @@ -2792,20 +2796,73 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public int llGetObjectPrimCount(string object_id) { - NotImplemented("llGetObjectPrimCount"); - return 0; + SceneObjectPart part = World.GetSceneObjectPart(new LLUUID(object_id)); + if (part == null) + { + return 0; + } + else + { + return part.ParentGroup.Children.Count; + } } public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { - NotImplemented("llGetParcelMaxPrims"); - return 0; + // Alondria: This currently just is utilizing the normal grid's 0.22 prims/m2 calculation + // Which probably will be irrelevent in OpenSim.... + LandData land = World.GetLandData((float)pos.x, (float)pos.y); + float bonusfactor = World.RegionInfo.EstateSettings.objectBonusFactor; + if (land == null) + { + return 0; + } + if (sim_wide == 1) + { + decimal v = land.simwideArea * (decimal)(0.22) * (decimal)bonusfactor; + return (int)v; + } + else + { + decimal v = land.area * (decimal)(0.22) * (decimal)bonusfactor; + return (int)v; + } + } public LSL_Types.list llGetParcelDetails(LSL_Types.Vector3 pos, LSL_Types.list param) { - NotImplemented("llGetParcelDetails"); - return new LSL_Types.list(); + LandData land = World.GetLandData((float)pos.x, (float)pos.y); + if (land == null) + { + return new LSL_Types.list(0); + } + LSL_Types.list ret = new LSL_Types.list(); + foreach(object o in param.Data) + { + switch(o.ToString()) + { + case "0": + ret = ret + new LSL_Types.list(land.landName); + break; + case "1": + ret = ret + new LSL_Types.list(land.landDesc); + break; + case "2": + ret = ret + new LSL_Types.list(land.ownerID.ToString()); + break; + case "3": + ret = ret + new LSL_Types.list(land.groupID.ToString()); + break; + case "4": + ret = ret + new LSL_Types.list(land.area); + break; + default: + ret = ret + new LSL_Types.list(0); + break; + } + } + return ret; } // -- cgit v1.1