From 181c5ab7d7304c5a14c9b2b1af76609bd244dfe8 Mon Sep 17 00:00:00 2001 From: alondria Date: Fri, 21 Mar 2008 20:04:52 +0000 Subject: Implements llGetObjectDetails() --- .../Common/BuiltIn_Commands_BaseClass.cs | 14 ++++ .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 80 ++++++++++++++++++++++ .../Common/LSL_BuiltIn_Commands_Interface.cs | 1 + 3 files changed, 95 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index c4b2729..ce033ad 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs @@ -1843,6 +1843,11 @@ namespace OpenSim.Region.ScriptEngine.Common return m_LSL_Functions.llStringTrim(src, type); } + public LSL_Types.list llGetObjectDetails(string id, LSL_Types.list args) + { + return m_LSL_Functions.llGetObjectDetails(id, args); + } + // // OpenSim Functions // @@ -2339,6 +2344,15 @@ namespace OpenSim.Region.ScriptEngine.Common public const int DEBUG_CHANNEL = 0x7FFFFFFF; public const int PUBLIC_CHANNEL = 0x00000000; + public const int OBJECT_NAME = 1; + public const int OBJECT_DESC = 2; + public const int OBJECT_POS = 3; + public const int OBJECT_ROT = 4; + public const int OBJECT_VELOCITY = 5; + public const int OBJECT_OWNER = 6; + public const int OBJECT_GROUP = 7; + public const int OBJECT_CREATOR = 8; + // Can not be public const? public vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); public rotation ZERO_ROTATION = new rotation(0.0, 0, 0.0, 1.0); diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 85017373..d1b87db 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -4532,6 +4532,86 @@ namespace OpenSim.Region.ScriptEngine.Common return src; } + public LSL_Types.list llGetObjectDetails(string id, LSL_Types.list args) + { + LSL_Types.list ret = new LSL_Types.list(); + LLUUID key = new LLUUID(); + if (LLUUID.TryParse(id, out key)) + { + if (World.m_innerScene.ScenePresences.ContainsKey(key)) + { + ScenePresence av = World.m_innerScene.ScenePresences[key]; + foreach(object o in args.Data) + { + switch(o.ToString()) + { + case "1": + ret.Add(av.Firstname + " " + av.Lastname); + break; + case "2": + ret.Add(""); + break; + case "3": + ret.Add(new LSL_Types.Vector3((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); + break; + case "4": + ret.Add(new LSL_Types.Quaternion((double)av.Rotation.x, (double)av.Rotation.y, (double)av.Rotation.z, (double)av.Rotation.w)); + break; + case "5": + ret.Add(new LSL_Types.Vector3(av.Velocity.X,av.Velocity.Y,av.Velocity.Z)); + break; + case "6": + ret.Add(id); + break; + case "7": + ret.Add(LLUUID.Zero.ToString()); + break; + case "8": + ret.Add(LLUUID.Zero.ToString()); + break; + } + } + return ret; + } + SceneObjectPart obj = World.GetSceneObjectPart(key); + if (obj != null) + { + foreach(object o in args.Data) + { + switch(o.ToString()) + { + case "1": + ret.Add(obj.Name); + break; + case "2": + ret.Add(obj.Description); + break; + case "3": + ret.Add(new LSL_Types.Vector3(obj.AbsolutePosition.X,obj.AbsolutePosition.Y,obj.AbsolutePosition.Z)); + break; + case "4": + ret.Add(new LSL_Types.Quaternion(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); + break; + case "5": + ret.Add(new LSL_Types.Vector3(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); + break; + case "6": + ret.Add(obj.OwnerID.ToString()); + break; + case "7": + ret.Add(obj.GroupID.ToString()); + break; + case "8": + ret.Add(obj.CreatorID.ToString()); + break; + } + } + return ret; + } + } + return new LSL_Types.list(); + } + // // OpenSim functions // diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index cecda07..c8b02da 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs @@ -635,6 +635,7 @@ namespace OpenSim.Region.ScriptEngine.Common //wiki list llGetParcelDetails(vector pos, list params) LSL_Types.list llGetParcelDetails(LSL_Types.Vector3 pos, LSL_Types.list param); string llStringTrim(string src, int type); + LSL_Types.list llGetObjectDetails(string id, LSL_Types.list args); //OpenSim functions string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, -- cgit v1.1