From c3a8c00ce0e60b0988fc0d62712e896e5c3e1ac8 Mon Sep 17 00:00:00 2001 From: Talun Date: Fri, 6 Apr 2012 19:11:09 +0100 Subject: Addition of missing constants for llGetObjectDetails including for Mantis 5502 Signed-off-by: nebadon --- .../Shared/Api/Implementation/LSL_Api.cs | 72 ++++++++++++++++++++++ .../Shared/Api/Runtime/LSL_Constants.cs | 10 +++ 2 files changed, 82 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 43b66f4..a046f29 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10333,6 +10333,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.OBJECT_CREATOR: ret.Add(new LSL_String(UUID.Zero.ToString())); break; + // For the following 8 see the Object version below + case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_SCRIPT_TIME: + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_SERVER_COST: + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_STREAMING_COST: + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_PHYSICS_COST: + ret.Add(new LSL_Float(0)); + break; + default: + // Invalid or unhandled constant. + ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); + break; } } @@ -10370,6 +10399,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.OBJECT_CREATOR: ret.Add(new LSL_String(obj.CreatorID.ToString())); break; + // The following 8 I have intentionaly coded to return zero. They are part of + // "Land Impact" calculations. These calculations are probably not applicable + // to OpenSim, required figures (cpu/memory usage) are not currently tracked + // I have intentionally left these all at zero rather than return possibly + // missleading numbers + case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: + // in SL this currently includes crashed scripts + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: + // The value returned in SL for mono scripts is 65536 * number of active scripts + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_SCRIPT_TIME: + // Average cpu time per simulator frame expended on all scripts in the objetc + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: + // according to the SL wiki A prim or linkset will have prim + // equivalent of the number of prims in a linkset if it does not + // contain a mesh anywhere in the link set or is not a normal prim + // The value returned in SL for normal prims is prim count + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_SERVER_COST: + // The value returned in SL for normal prims is prim count + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_STREAMING_COST: + // The value returned in SL for normal prims is prim count * 0.06 + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_PHYSICS_COST: + // The value returned in SL for normal prims is prim count + ret.Add(new LSL_Float(0)); + break; + default: + // Invalid or unhandled constant. + ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); + break; } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 5a53e15..f58f9d6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -479,6 +479,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int DEBUG_CHANNEL = 0x7FFFFFFF; public const int PUBLIC_CHANNEL = 0x00000000; + // Constants for llGetObjectDetails + public const int OBJECT_UNKNOWN_DETAIL = -1; public const int OBJECT_NAME = 1; public const int OBJECT_DESC = 2; public const int OBJECT_POS = 3; @@ -487,6 +489,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int OBJECT_OWNER = 6; public const int OBJECT_GROUP = 7; public const int OBJECT_CREATOR = 8; + public const int OBJECT_RUNNING_SCRIPT_COUNT = 9; + public const int OBJECT_TOTAL_SCRIPT_COUNT = 10; + public const int OBJECT_SCRIPT_MEMORY = 11; + public const int OBJECT_SCRIPT_TIME = 12; + public const int OBJECT_PRIM_EQUIVALENCE = 13; + public const int OBJECT_SERVER_COST = 14; + public const int OBJECT_STREAMING_COST = 15; + public const int OBJECT_PHYSICS_COST = 16; // Can not be public const? public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); -- cgit v1.1