add a few lsl constants

0.9.1.0-post-fixes
UbitUmarov 2019-10-19 18:00:45 +01:00
parent 7ed339324f
commit ab335b5926
3 changed files with 114 additions and 5 deletions

View File

@ -32,6 +32,7 @@ using System.Collections.Specialized;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Globalization;
using System.Runtime.Remoting.Lifetime; using System.Runtime.Remoting.Lifetime;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
@ -67,6 +68,7 @@ using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
using PrimType = OpenSim.Region.Framework.Scenes.PrimType; using PrimType = OpenSim.Region.Framework.Scenes.PrimType;
using AssetLandmark = OpenSim.Framework.AssetLandmark; using AssetLandmark = OpenSim.Framework.AssetLandmark;
using RegionFlags = OpenSim.Framework.RegionFlags; using RegionFlags = OpenSim.Framework.RegionFlags;
using RegionInfo = OpenSim.Framework.RegionInfo;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 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)) if (!UUID.TryParse(id, out key))
return ret; return ret;
int count = 0;
ScenePresence av = World.GetScenePresence(key); ScenePresence av = World.GetScenePresence(key);
if (av != null) if (av != null)
{ {
List<SceneObjectGroup> Attachments = null;
int? nAnimated = null;
foreach (object o in args.Data) foreach (object o in args.Data)
{ {
switch (int.Parse(o.ToString())) switch (int.Parse(o.ToString()))
@ -14494,13 +14499,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Vector(Vector3.Zero)); ret.Add(new LSL_Vector(Vector3.Zero));
break; break;
case ScriptBaseClass.OBJECT_PRIM_COUNT: case ScriptBaseClass.OBJECT_PRIM_COUNT:
List<SceneObjectGroup> Attachments = av.GetAttachments(); if (Attachments == null)
int count = 0; Attachments = av.GetAttachments();
count = 0;
try try
{ {
foreach (SceneObjectGroup Attachment in Attachments) foreach (SceneObjectGroup Attachment in Attachments)
count += Attachment.PrimCount; count += Attachment.PrimCount;
} catch { }; }
catch { };
ret.Add(new LSL_Integer(count)); ret.Add(new LSL_Integer(count));
break; break;
case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT: case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
@ -14527,6 +14534,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.OBJECT_TEMP_ATTACHED: case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
ret.Add(new LSL_Integer(0)); ret.Add(new LSL_Integer(0));
break; 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: default:
// Invalid or unhandled constant. // Invalid or unhandled constant.
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 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: case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
SceneObjectPart[] parts = obj.ParentGroup.Parts; SceneObjectPart[] parts = obj.ParentGroup.Parts;
int nparts = parts.Count(); int nparts = parts.Count();
int count = 0; count = 0;
for(int i = 0; i < nparts; i++) for(int i = 0; i < nparts; i++)
count += parts[i].Inventory.Count; count += parts[i].Inventory.Count;
ret.Add(new LSL_Integer(count)); ret.Add(new LSL_Integer(count));
@ -14731,6 +14795,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Integer(0)); ret.Add(new LSL_Integer(0));
} }
break; 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: default:
// Invalid or unhandled constant. // Invalid or unhandled constant.
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));

View File

@ -664,6 +664,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int OBJECT_GROUP_TAG = 33; public const int OBJECT_GROUP_TAG = 33;
public const int OBJECT_TEMP_ATTACHED = 34; public const int OBJECT_TEMP_ATTACHED = 34;
public const int OBJECT_ATTACHED_SLOTS_AVAILABLE = 35; 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 // Pathfinding types
//ApiDesc not supported //ApiDesc not supported

View File

@ -1,4 +1,4 @@
7ddea7b6-2c1f-1bf6-d0b1-8e99955c9587 84b526ce-3ad0-46bb-7a8a-b37be2734c5b
<llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer> <llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer>
<key>controls</key> <key>controls</key>
<map> <map>
@ -1371,6 +1371,14 @@
<key>type</key><string>string</string> <key>type</key><string>string</string>
<key>value</key><string>00000000-0000-0000-0000-000000000000</string> <key>value</key><string>00000000-0000-0000-0000-000000000000</string>
</map> </map>
<key>OBJECT_ANIMATED_COUNT</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>39</string>
</map>
<key>OBJECT_ANIMATED_SLOTS_AVAILABLE</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>40</string>
</map>
<key>OBJECT_ATTACHED_POINT</key><map> <key>OBJECT_ATTACHED_POINT</key><map>
<key>type</key><string>integer</string> <key>type</key><string>integer</string>
<key>value</key><string>19</string> <key>value</key><string>19</string>
@ -1391,6 +1399,10 @@
<key>type</key><string>integer</string> <key>type</key><string>integer</string>
<key>value</key><string>28</string> <key>value</key><string>28</string>
</map> </map>
<key>OBJECT_CREATION_TIME</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>36</string>
</map>
<key>OBJECT_CREATOR</key><map> <key>OBJECT_CREATOR</key><map>
<key>type</key><string>integer</string> <key>type</key><string>integer</string>
<key>value</key><string>8</string> <key>value</key><string>8</string>
@ -1483,10 +1495,18 @@
<key>type</key><string>integer</string> <key>type</key><string>integer</string>
<key>value</key><string>12</string> <key>value</key><string>12</string>
</map> </map>
<key>OBJECT_SELECT_COUNT</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>37</string>
</map>
<key>OBJECT_SERVER_COST</key><map> <key>OBJECT_SERVER_COST</key><map>
<key>type</key><string>integer</string> <key>type</key><string>integer</string>
<key>value</key><string>14</string> <key>value</key><string>14</string>
</map> </map>
<key>OBJECT_SIT_COUNT</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>38</string>
</map>
<key>OBJECT_STREAMING_COST</key><map> <key>OBJECT_STREAMING_COST</key><map>
<key>type</key><string>integer</string> <key>type</key><string>integer</string>
<key>value</key><string>15</string> <key>value</key><string>15</string>