From 36f7a087e6f101f1d74659621afc460c974a8dc9 Mon Sep 17 00:00:00 2001 From: alondria Date: Tue, 5 Feb 2008 15:06:37 +0000 Subject: Added explicit Quaternion->string and list->string conversions. Some preliminary work on llSetStatus and llGetStatus. --- .../Region/ScriptEngine/Common/LSL_BaseClass.cs | 1 + .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 96 +++++++++++++++++++++- OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 21 +++++ 3 files changed, 116 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs index c985d6f..8511b56 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs @@ -1877,6 +1877,7 @@ namespace OpenSim.Region.ScriptEngine.Common public const int STATUS_BLOCK_GRAB = 64; public const int STATUS_DIE_AT_EDGE = 128; public const int STATUS_RETURN_AT_EDGE = 256; + public const int STATUS_CAST_SHADOWS = 512; public const int AGENT = 1; public const int ACTIVE = 2; public const int PASSIVE = 4; diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 80df86e..242bd27 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -425,13 +425,105 @@ namespace OpenSim.Region.ScriptEngine.Common public void llSetStatus(int status, int value) { - NotImplemented("llSetStatus"); + if ((status & LSL_BaseClass.STATUS_PHYSICS) == LSL_BaseClass.STATUS_PHYSICS) + { + m_host.AddFlag(LLObject.ObjectFlags.Physics); + } + if ((status & LSL_BaseClass.STATUS_PHANTOM) == LSL_BaseClass.STATUS_PHANTOM) + { + m_host.AddFlag(LLObject.ObjectFlags.Phantom); + } + if ((status & LSL_BaseClass.STATUS_CAST_SHADOWS) == LSL_BaseClass.STATUS_CAST_SHADOWS) + { + m_host.AddFlag(LLObject.ObjectFlags.CastShadows); + } + if ((status & LSL_BaseClass.STATUS_ROTATE_X) == LSL_BaseClass.STATUS_ROTATE_X) + { + NotImplemented("llSetStatus - STATUS_ROTATE_X"); + } + if ((status & LSL_BaseClass.STATUS_ROTATE_Y) == LSL_BaseClass.STATUS_ROTATE_Y) + { + NotImplemented("llSetStatus - STATUS_ROTATE_Y"); + } + if ((status & LSL_BaseClass.STATUS_ROTATE_Z) == LSL_BaseClass.STATUS_ROTATE_Z) + { + NotImplemented("llSetStatus - STATUS_ROTATE_Z"); + } + if ((status & LSL_BaseClass.STATUS_BLOCK_GRAB) == LSL_BaseClass.STATUS_BLOCK_GRAB) + { + NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); + } + if ((status & LSL_BaseClass.STATUS_DIE_AT_EDGE) == LSL_BaseClass.STATUS_DIE_AT_EDGE) + { + NotImplemented("llSetStatus - STATUS_DIE_AT_EDGE"); + } + if ((status & LSL_BaseClass.STATUS_RETURN_AT_EDGE) == LSL_BaseClass.STATUS_RETURN_AT_EDGE) + { + NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); + } + if ((status & LSL_BaseClass.STATUS_SANDBOX) == LSL_BaseClass.STATUS_SANDBOX) + { + NotImplemented("llSetStatus - STATUS_SANDBOX"); + } return; } public int llGetStatus(int status) { - NotImplemented("llGetStatus"); + Console.WriteLine(m_host.UUID.ToString() + " status is " + m_host.ObjectFlags.ToString()); + switch (status) + { + case LSL_BaseClass.STATUS_PHYSICS: + if ((m_host.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == (uint)LLObject.ObjectFlags.Physics) + { + return 1; + } + return 0; + break; + case LSL_BaseClass.STATUS_PHANTOM: + if ((m_host.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) + { + return 1; + } + return 0; + break; + case LSL_BaseClass.STATUS_CAST_SHADOWS: + if ((m_host.ObjectFlags & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) + { + return 1; + } + return 0; + break; + case LSL_BaseClass.STATUS_BLOCK_GRAB: + NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); + return 0; + break; + case LSL_BaseClass.STATUS_DIE_AT_EDGE: + NotImplemented("llGetStatus - STATUS_DIE_AT_EDGE"); + return 0; + break; + case LSL_BaseClass.STATUS_RETURN_AT_EDGE: + NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); + return 0; + break; + case LSL_BaseClass.STATUS_ROTATE_X: + NotImplemented("llGetStatus - STATUS_ROTATE_X"); + return 0; + break; + case LSL_BaseClass.STATUS_ROTATE_Y: + NotImplemented("llGetStatus - STATUS_ROTATE_Y"); + return 0; + break; + case LSL_BaseClass.STATUS_ROTATE_Z: + NotImplemented("llGetStatus - STATUS_ROTATE_Z"); + return 0; + break; + case LSL_BaseClass.STATUS_SANDBOX: + NotImplemented("llGetStatus - STATUS_SANDBOX"); + return 0; + break; + } + NotImplemented("llGetStatus - Unknown Status parameter"); return 0; } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index fc0e282..1611b74 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs @@ -305,6 +305,11 @@ namespace OpenSim.Region.ScriptEngine.Common return "<" + x.ToString() + ", " + y.ToString() + ", " + z.ToString() + ", " + s.ToString() + ">"; } + public static explicit operator string(Quaternion r) + { + return "<" + r.x.ToString() + ", " + r.y.ToString() + ", " + r.z.ToString() + ", " + r.s.ToString() + ">"; + } + public static bool operator ==(Quaternion lhs, Quaternion rhs) { // Return true if the fields match: @@ -454,6 +459,8 @@ namespace OpenSim.Region.ScriptEngine.Common return output; } + + public override string ToString() { string output; @@ -470,6 +477,20 @@ namespace OpenSim.Region.ScriptEngine.Common } + public static explicit operator string(list l) + { + string output; + output = String.Empty; + if (l.m_data.Length == 0) + { + return String.Empty; + } + foreach (object o in l.m_data) + { + output = output + o.ToString(); + } + return output; + } } // -- cgit v1.1