diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b2600624af..302c431f1c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -32,6 +32,7 @@ using System.Collections.Specialized; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; +using System.Globalization; using System.Runtime.Remoting.Lifetime; using System.Text; using System.Threading; @@ -67,6 +68,7 @@ using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; using PrimType = OpenSim.Region.Framework.Scenes.PrimType; using AssetLandmark = OpenSim.Framework.AssetLandmark; using RegionFlags = OpenSim.Framework.RegionFlags; +using RegionInfo = OpenSim.Framework.RegionInfo; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; @@ -14364,9 +14366,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(id, out key)) return ret; + int count = 0; ScenePresence av = World.GetScenePresence(key); if (av != null) { + List Attachments = null; + int? nAnimated = null; foreach (object o in args.Data) { switch (int.Parse(o.ToString())) @@ -14494,13 +14499,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_Vector(Vector3.Zero)); break; case ScriptBaseClass.OBJECT_PRIM_COUNT: - List Attachments = av.GetAttachments(); - int count = 0; + if (Attachments == null) + Attachments = av.GetAttachments(); + count = 0; try { foreach (SceneObjectGroup Attachment in Attachments) count += Attachment.PrimCount; - } catch { }; + } + catch { }; ret.Add(new LSL_Integer(count)); break; case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT: @@ -14527,6 +14534,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.OBJECT_TEMP_ATTACHED: ret.Add(new LSL_Integer(0)); break; + case ScriptBaseClass.OBJECT_CREATION_TIME: + ret.Add(new LSL_String("")); + break; + case ScriptBaseClass.OBJECT_SELECT_COUNT: + ret.Add(new LSL_String("")); + break; + case ScriptBaseClass.OBJECT_SIT_COUNT: + ret.Add(new LSL_String("")); + break; + case ScriptBaseClass.OBJECT_ANIMATED_COUNT: + count = 0; + if (nAnimated.HasValue) + count = nAnimated.Value; + else + { + if (Attachments == null) + Attachments = av.GetAttachments(); + try + { + for(int i = 0; i < Attachments.Count;++i) + { + if(Attachments[i].RootPart.Shape.MeshFlagEntry) + ++count; + } + } + catch { }; + nAnimated = count; + } + ret.Add(new LSL_Integer(count)); + break; + + case ScriptBaseClass.OBJECT_ANIMATED_SLOTS_AVAILABLE: + count = 0; + if (nAnimated.HasValue) + count = nAnimated.Value; + else + { + if (Attachments == null) + Attachments = av.GetAttachments(); + count = 0; + try + { + for (int i = 0; i < Attachments.Count; ++i) + { + if (Attachments[i].RootPart.Shape.MeshFlagEntry) + ++count; + } + } + catch { }; + nAnimated = count; + } + count = 2 - count; // for now hardcoded max (simulator features, viewers settings, etc) + if(count < 0) + count = 0; + ret.Add(new LSL_Integer(count)); + break; + default: // Invalid or unhandled constant. ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); @@ -14710,7 +14774,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT: SceneObjectPart[] parts = obj.ParentGroup.Parts; int nparts = parts.Count(); - int count = 0; + count = 0; for(int i = 0; i < nparts; i++) count += parts[i].Inventory.Count; ret.Add(new LSL_Integer(count)); @@ -14731,6 +14795,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_Integer(0)); } break; + case ScriptBaseClass.OBJECT_CREATION_TIME: + DateTime date = Util.ToDateTime(m_host.ParentGroup.RootPart.CreationDate); + ret.Add(new LSL_String(date.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture))); + break; + case ScriptBaseClass.OBJECT_SELECT_COUNT: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_SIT_COUNT: + ret.Add(new LSL_Integer(m_host.ParentGroup.GetSittingAvatarsCount())); + break; + case ScriptBaseClass.OBJECT_ANIMATED_COUNT: + if(m_host.ParentGroup.RootPart.Shape.MeshFlagEntry) + ret.Add(new LSL_Integer(1)); + else + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_ANIMATED_SLOTS_AVAILABLE: + ret.Add(new LSL_Integer(0)); + break; default: // Invalid or unhandled constant. ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index f7acafe380..3d17d9844b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -664,6 +664,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int OBJECT_GROUP_TAG = 33; public const int OBJECT_TEMP_ATTACHED = 34; public const int OBJECT_ATTACHED_SLOTS_AVAILABLE = 35; + public const int OBJECT_CREATION_TIME = 36; + public const int OBJECT_SELECT_COUNT = 37; + public const int OBJECT_SIT_COUNT = 38; + public const int OBJECT_ANIMATED_COUNT = 39; + public const int OBJECT_ANIMATED_SLOTS_AVAILABLE = 40; + // Pathfinding types //ApiDesc not supported diff --git a/bin/ScriptSyntax.xml b/bin/ScriptSyntax.xml index e2ab46e686..411331b595 100644 --- a/bin/ScriptSyntax.xml +++ b/bin/ScriptSyntax.xml @@ -1,4 +1,4 @@ -7ddea7b6-2c1f-1bf6-d0b1-8e99955c9587 +84b526ce-3ad0-46bb-7a8a-b37be2734c5b llsd-lsl-syntax-version2 controls @@ -1371,6 +1371,14 @@ typestring value00000000-0000-0000-0000-000000000000 + OBJECT_ANIMATED_COUNT + typeinteger + value39 + + OBJECT_ANIMATED_SLOTS_AVAILABLE + typeinteger + value40 + OBJECT_ATTACHED_POINT typeinteger value19 @@ -1391,6 +1399,10 @@ typeinteger value28 + OBJECT_CREATION_TIME + typeinteger + value36 + OBJECT_CREATOR typeinteger value8 @@ -1483,10 +1495,18 @@ typeinteger value12 + OBJECT_SELECT_COUNT + typeinteger + value37 + OBJECT_SERVER_COST typeinteger value14 + OBJECT_SIT_COUNT + typeinteger + value38 + OBJECT_STREAMING_COST typeinteger value15