mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 14:16:07 +08:00
add a few lsl constants
This commit is contained in:
@@ -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<SceneObjectGroup> 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<SceneObjectGroup> 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));
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user