some cleanup
parent
5b2fab99a6
commit
01b84ef46b
|
@ -12963,33 +12963,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.SetForceMouselook(mouselook != 0);
|
m_host.SetForceMouselook(mouselook != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Float llGetObjectMass(string id)
|
public LSL_Float llGetObjectMass(LSL_Key id)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
UUID key = new UUID();
|
UUID key = new UUID();
|
||||||
if (UUID.TryParse(id, out key))
|
if (!UUID.TryParse(id, out key))
|
||||||
{
|
return 0;
|
||||||
// return total object mass
|
|
||||||
SceneObjectPart part = World.GetSceneObjectPart(key);
|
|
||||||
if (part != null)
|
|
||||||
return part.ParentGroup.GetMass();
|
|
||||||
|
|
||||||
// the object is null so the key is for an avatar
|
// return total object mass
|
||||||
ScenePresence avatar = World.GetScenePresence(key);
|
SceneObjectPart part = World.GetSceneObjectPart(key);
|
||||||
if (avatar != null)
|
if (part != null)
|
||||||
|
return part.ParentGroup.GetMass();
|
||||||
|
|
||||||
|
// the object is null so the key is for an avatar
|
||||||
|
ScenePresence avatar = World.GetScenePresence(key);
|
||||||
|
if (avatar != null)
|
||||||
|
{
|
||||||
|
if (avatar.IsChildAgent)
|
||||||
{
|
{
|
||||||
if (avatar.IsChildAgent)
|
// reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass
|
||||||
{
|
// child agents have a mass of 1.0
|
||||||
// reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass
|
return 1;
|
||||||
// child agents have a mass of 1.0
|
}
|
||||||
return 1;
|
else
|
||||||
}
|
{
|
||||||
else
|
return avatar.GetMass();
|
||||||
{
|
|
||||||
return (double)avatar.GetMass();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14197,18 +14198,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetObjectPrimCount(string object_id)
|
public LSL_Integer llGetObjectPrimCount(LSL_Key object_id)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
SceneObjectPart part = World.GetSceneObjectPart(new UUID(object_id));
|
UUID id;
|
||||||
if (part == null)
|
if(!UUID.TryParse(object_id, out id))
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
else
|
SceneObjectPart part = World.GetSceneObjectPart(id);
|
||||||
{
|
if (part == null)
|
||||||
return part.ParentGroup.PrimCount;
|
return 0;
|
||||||
}
|
|
||||||
|
return part.ParentGroup.PrimCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide)
|
public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide)
|
||||||
|
@ -14265,406 +14266,399 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_String llStringTrim(string src, int type)
|
public LSL_String llStringTrim(LSL_String src, LSL_Integer type)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); }
|
if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return ((string)src).TrimStart(); }
|
||||||
if (type == (int)ScriptBaseClass.STRING_TRIM_TAIL) { return src.TrimEnd(); }
|
if (type == (int)ScriptBaseClass.STRING_TRIM_TAIL) { return ((string)src).TrimEnd(); }
|
||||||
if (type == (int)ScriptBaseClass.STRING_TRIM) { return src.Trim(); }
|
if (type == (int)ScriptBaseClass.STRING_TRIM) { return ((string)src).Trim(); }
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_List llGetObjectDetails(string id, LSL_List args)
|
public LSL_List llGetObjectDetails(LSL_Key id, LSL_List args)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
LSL_List ret = new LSL_List();
|
LSL_List ret = new LSL_List();
|
||||||
UUID key = new UUID();
|
UUID key = new UUID();
|
||||||
|
if (!UUID.TryParse(id, out key))
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ScenePresence av = World.GetScenePresence(key);
|
||||||
if (UUID.TryParse(id, out key))
|
if (av != null)
|
||||||
{
|
{
|
||||||
ScenePresence av = World.GetScenePresence(key);
|
foreach (object o in args.Data)
|
||||||
|
|
||||||
if (av != null)
|
|
||||||
{
|
{
|
||||||
foreach (object o in args.Data)
|
switch (int.Parse(o.ToString()))
|
||||||
{
|
{
|
||||||
switch (int.Parse(o.ToString()))
|
case ScriptBaseClass.OBJECT_NAME:
|
||||||
{
|
ret.Add(new LSL_String(av.Firstname + " " + av.Lastname));
|
||||||
case ScriptBaseClass.OBJECT_NAME:
|
break;
|
||||||
ret.Add(new LSL_String(av.Firstname + " " + av.Lastname));
|
case ScriptBaseClass.OBJECT_DESC:
|
||||||
break;
|
ret.Add(new LSL_String(""));
|
||||||
case ScriptBaseClass.OBJECT_DESC:
|
break;
|
||||||
ret.Add(new LSL_String(""));
|
case ScriptBaseClass.OBJECT_POS:
|
||||||
break;
|
Vector3 avpos;
|
||||||
case ScriptBaseClass.OBJECT_POS:
|
|
||||||
Vector3 avpos;
|
|
||||||
|
|
||||||
if (av.ParentID != 0 && av.ParentPart != null &&
|
if (av.ParentID != 0 && av.ParentPart != null &&
|
||||||
av.ParentPart.ParentGroup != null && av.ParentPart.ParentGroup.RootPart != null )
|
av.ParentPart.ParentGroup != null && av.ParentPart.ParentGroup.RootPart != null )
|
||||||
|
{
|
||||||
|
avpos = av.OffsetPosition;
|
||||||
|
|
||||||
|
if(!av.LegacySitOffsets)
|
||||||
{
|
{
|
||||||
avpos = av.OffsetPosition;
|
Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f);
|
||||||
|
avpos -= sitOffset;
|
||||||
if(!av.LegacySitOffsets)
|
|
||||||
{
|
|
||||||
Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f);
|
|
||||||
avpos -= sitOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
SceneObjectPart sitRoot = av.ParentPart.ParentGroup.RootPart;
|
|
||||||
avpos = sitRoot.GetWorldPosition() + avpos * sitRoot.GetWorldRotation();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
avpos = av.AbsolutePosition;
|
|
||||||
|
|
||||||
ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z));
|
SceneObjectPart sitRoot = av.ParentPart.ParentGroup.RootPart;
|
||||||
break;
|
avpos = sitRoot.GetWorldPosition() + avpos * sitRoot.GetWorldRotation();
|
||||||
case ScriptBaseClass.OBJECT_ROT:
|
}
|
||||||
Quaternion avrot = av.GetWorldRotation();
|
else
|
||||||
ret.Add(new LSL_Rotation(avrot));
|
avpos = av.AbsolutePosition;
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_VELOCITY:
|
ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z));
|
||||||
Vector3 avvel = av.GetWorldVelocity();
|
break;
|
||||||
ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z));
|
case ScriptBaseClass.OBJECT_ROT:
|
||||||
break;
|
Quaternion avrot = av.GetWorldRotation();
|
||||||
case ScriptBaseClass.OBJECT_OWNER:
|
ret.Add(new LSL_Rotation(avrot));
|
||||||
ret.Add(new LSL_String(id));
|
break;
|
||||||
break;
|
case ScriptBaseClass.OBJECT_VELOCITY:
|
||||||
case ScriptBaseClass.OBJECT_GROUP:
|
Vector3 avvel = av.GetWorldVelocity();
|
||||||
ret.Add(new LSL_String(UUID.Zero.ToString()));
|
ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_CREATOR:
|
case ScriptBaseClass.OBJECT_OWNER:
|
||||||
ret.Add(new LSL_String(UUID.Zero.ToString()));
|
ret.Add(new LSL_Key((string)id));
|
||||||
break;
|
break;
|
||||||
// For the following 8 see the Object version below
|
case ScriptBaseClass.OBJECT_GROUP:
|
||||||
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
ret.Add(new LSL_String(UUID.Zero.ToString()));
|
||||||
ret.Add(new LSL_Integer(av.RunningScriptCount()));
|
break;
|
||||||
break;
|
case ScriptBaseClass.OBJECT_CREATOR:
|
||||||
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
ret.Add(new LSL_Key(UUID.Zero.ToString()));
|
||||||
ret.Add(new LSL_Integer(av.ScriptCount()));
|
break;
|
||||||
break;
|
// For the following 8 see the Object version below
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
||||||
ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384));
|
ret.Add(new LSL_Integer(av.RunningScriptCount()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
||||||
ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f));
|
ret.Add(new LSL_Integer(av.ScriptCount()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
||||||
ret.Add(new LSL_Integer(1));
|
ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SERVER_COST:
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Integer(1));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
case ScriptBaseClass.OBJECT_SERVER_COST:
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
|
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_ROOT:
|
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
||||||
SceneObjectPart p = av.ParentPart;
|
ret.Add(new LSL_Float(0));
|
||||||
if (p != null)
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_ROOT:
|
||||||
|
SceneObjectPart p = av.ParentPart;
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret.Add(new LSL_Key((string)id));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_ATTACHED_POINT:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding
|
||||||
|
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PHYSICS:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PHANTOM:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
|
||||||
|
ret.Add(new LSL_Integer(-1));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
|
||||||
|
LSL_Float shapeType;
|
||||||
|
if (av.Appearance.VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MALE] != 0)
|
||||||
|
shapeType = new LSL_Float(1);
|
||||||
|
else
|
||||||
|
shapeType = new LSL_Float(0);
|
||||||
|
ret.Add(shapeType);
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
|
||||||
|
ret.Add(new LSL_Key(ScriptBaseClass.NULL_KEY));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_CLICK_ACTION:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_OMEGA:
|
||||||
|
ret.Add(new LSL_Vector(Vector3.Zero));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PRIM_COUNT:
|
||||||
|
List<SceneObjectGroup> Attachments = av.GetAttachments();
|
||||||
|
int count = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (SceneObjectGroup Attachment in Attachments)
|
||||||
|
count += Attachment.PrimCount;
|
||||||
|
} catch { };
|
||||||
|
ret.Add(new LSL_Integer(count));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
|
||||||
|
List<SceneObjectGroup> invAttachments = av.GetAttachments();
|
||||||
|
int invcount = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (SceneObjectGroup Attachment in invAttachments)
|
||||||
{
|
{
|
||||||
ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString()));
|
SceneObjectPart[] parts = Attachment.Parts;
|
||||||
|
int nparts = parts.Count();
|
||||||
|
for(int i = 0; i < nparts; i++)
|
||||||
|
invcount += parts[i].Inventory.Count;
|
||||||
}
|
}
|
||||||
else
|
} catch { };
|
||||||
{
|
ret.Add(new LSL_Integer(invcount));
|
||||||
ret.Add(new LSL_String(id));
|
break;
|
||||||
}
|
case ScriptBaseClass.OBJECT_REZZER_KEY:
|
||||||
break;
|
ret.Add(new LSL_Key((string)id));
|
||||||
case ScriptBaseClass.OBJECT_ATTACHED_POINT:
|
break;
|
||||||
ret.Add(new LSL_Integer(0));
|
case ScriptBaseClass.OBJECT_GROUP_TAG:
|
||||||
break;
|
ret.Add(new LSL_String(av.Grouptitle));
|
||||||
case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding
|
break;
|
||||||
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR));
|
case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
|
||||||
break;
|
ret.Add(new LSL_Integer(0));
|
||||||
case ScriptBaseClass.OBJECT_PHYSICS:
|
break;
|
||||||
ret.Add(new LSL_Integer(0));
|
default:
|
||||||
break;
|
// Invalid or unhandled constant.
|
||||||
case ScriptBaseClass.OBJECT_PHANTOM:
|
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||||
ret.Add(new LSL_Integer(0));
|
break;
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
|
|
||||||
ret.Add(new LSL_Integer(0));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
|
|
||||||
ret.Add(new LSL_Integer(-1));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
|
|
||||||
ret.Add(new LSL_Float(0));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
|
|
||||||
LSL_Float shapeType;
|
|
||||||
if (av.Appearance.VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MALE] != 0)
|
|
||||||
shapeType = new LSL_Float(1);
|
|
||||||
else
|
|
||||||
shapeType = new LSL_Float(0);
|
|
||||||
ret.Add(shapeType);
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
|
|
||||||
ret.Add(new LSL_Key(ScriptBaseClass.NULL_KEY));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_CLICK_ACTION:
|
|
||||||
ret.Add(new LSL_Integer(0));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_OMEGA:
|
|
||||||
ret.Add(new LSL_Vector(Vector3.Zero));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_PRIM_COUNT:
|
|
||||||
List<SceneObjectGroup> Attachments = av.GetAttachments();
|
|
||||||
int count = 0;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (SceneObjectGroup Attachment in Attachments)
|
|
||||||
count += Attachment.PrimCount;
|
|
||||||
} catch { };
|
|
||||||
ret.Add(new LSL_Integer(count));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
|
|
||||||
List<SceneObjectGroup> invAttachments = av.GetAttachments();
|
|
||||||
int invcount = 0;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (SceneObjectGroup Attachment in invAttachments)
|
|
||||||
{
|
|
||||||
SceneObjectPart[] parts = Attachment.Parts;
|
|
||||||
int nparts = parts.Count();
|
|
||||||
for(int i = 0; i < nparts; i++)
|
|
||||||
invcount += parts[i].Inventory.Count;
|
|
||||||
}
|
|
||||||
} catch { };
|
|
||||||
ret.Add(new LSL_Integer(invcount));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_REZZER_KEY:
|
|
||||||
ret.Add(new LSL_Key(id));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_GROUP_TAG:
|
|
||||||
ret.Add(new LSL_String(av.Grouptitle));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
|
|
||||||
ret.Add(new LSL_Integer(0));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Invalid or unhandled constant.
|
|
||||||
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
SceneObjectPart obj = World.GetSceneObjectPart(key);
|
SceneObjectPart obj = World.GetSceneObjectPart(key);
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
|
{
|
||||||
|
foreach (object o in args.Data)
|
||||||
{
|
{
|
||||||
foreach (object o in args.Data)
|
switch (int.Parse(o.ToString()))
|
||||||
{
|
{
|
||||||
switch (int.Parse(o.ToString()))
|
case ScriptBaseClass.OBJECT_NAME:
|
||||||
{
|
ret.Add(new LSL_String(obj.Name));
|
||||||
case ScriptBaseClass.OBJECT_NAME:
|
break;
|
||||||
ret.Add(new LSL_String(obj.Name));
|
case ScriptBaseClass.OBJECT_DESC:
|
||||||
break;
|
ret.Add(new LSL_String(obj.Description));
|
||||||
case ScriptBaseClass.OBJECT_DESC:
|
break;
|
||||||
ret.Add(new LSL_String(obj.Description));
|
case ScriptBaseClass.OBJECT_POS:
|
||||||
break;
|
Vector3 opos = obj.AbsolutePosition;
|
||||||
case ScriptBaseClass.OBJECT_POS:
|
ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z));
|
||||||
Vector3 opos = obj.AbsolutePosition;
|
break;
|
||||||
ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z));
|
case ScriptBaseClass.OBJECT_ROT:
|
||||||
break;
|
Quaternion rot = Quaternion.Identity;
|
||||||
case ScriptBaseClass.OBJECT_ROT:
|
|
||||||
Quaternion rot = Quaternion.Identity;
|
|
||||||
|
|
||||||
if (obj.ParentGroup.IsAttachment)
|
if (obj.ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
|
ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
|
||||||
|
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
rot = sp.GetWorldRotation();
|
rot = sp.GetWorldRotation();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (obj.ParentGroup.RootPart == obj)
|
||||||
|
rot = obj.ParentGroup.GroupRotation;
|
||||||
else
|
else
|
||||||
{
|
rot = obj.GetWorldRotation();
|
||||||
if (obj.ParentGroup.RootPart == obj)
|
}
|
||||||
rot = obj.ParentGroup.GroupRotation;
|
|
||||||
else
|
|
||||||
rot = obj.GetWorldRotation();
|
|
||||||
}
|
|
||||||
|
|
||||||
LSL_Rotation objrot = new LSL_Rotation(rot);
|
LSL_Rotation objrot = new LSL_Rotation(rot);
|
||||||
ret.Add(objrot);
|
ret.Add(objrot);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_VELOCITY:
|
case ScriptBaseClass.OBJECT_VELOCITY:
|
||||||
Vector3 vel = Vector3.Zero;
|
Vector3 vel = Vector3.Zero;
|
||||||
|
|
||||||
if (obj.ParentGroup.IsAttachment)
|
if (obj.ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
|
ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
|
||||||
|
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
vel = sp.GetWorldVelocity();
|
vel = sp.GetWorldVelocity();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vel = obj.Velocity;
|
vel = obj.Velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.Add(vel);
|
ret.Add(vel);
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_OWNER:
|
case ScriptBaseClass.OBJECT_OWNER:
|
||||||
ret.Add(new LSL_String(obj.OwnerID.ToString()));
|
ret.Add(new LSL_String(obj.OwnerID.ToString()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_GROUP:
|
case ScriptBaseClass.OBJECT_GROUP:
|
||||||
ret.Add(new LSL_String(obj.GroupID.ToString()));
|
ret.Add(new LSL_String(obj.GroupID.ToString()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_CREATOR:
|
case ScriptBaseClass.OBJECT_CREATOR:
|
||||||
ret.Add(new LSL_String(obj.CreatorID.ToString()));
|
ret.Add(new LSL_String(obj.CreatorID.ToString()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount()));
|
ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount()));
|
ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
||||||
// The value returned in SL for mono scripts is 65536 * number of active scripts
|
// The value returned in SL for mono scripts is 65536 * number of active scripts
|
||||||
// and 16384 * number of active scripts for LSO. since llGetFreememory
|
// and 16384 * number of active scripts for LSO. since llGetFreememory
|
||||||
// is coded to give the LSO value use it here
|
// is coded to give the LSO value use it here
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384));
|
ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
// Average cpu time in seconds per simulator frame expended on all scripts in the object
|
// Average cpu time in seconds per simulator frame expended on all scripts in the object
|
||||||
ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f));
|
ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
// according to the SL wiki A prim or linkset will have prim
|
// 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
|
// 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
|
// 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
|
// The value returned in SL for normal prims is prim count
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
|
ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// costs below may need to be diferent for root parts, need to check
|
// costs below may need to be diferent for root parts, need to check
|
||||||
case ScriptBaseClass.OBJECT_SERVER_COST:
|
case ScriptBaseClass.OBJECT_SERVER_COST:
|
||||||
// The linden calculation is here
|
// The linden calculation is here
|
||||||
// http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight
|
// http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight
|
||||||
// The value returned in SL for normal prims looks like the prim count
|
// The value returned in SL for normal prims looks like the prim count
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
||||||
// The value returned in SL for normal prims is prim count * 0.06
|
// The value returned in SL for normal prims is prim count * 0.06
|
||||||
ret.Add(new LSL_Float(obj.StreamingCost));
|
ret.Add(new LSL_Float(obj.StreamingCost));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
||||||
// The value returned in SL for normal prims is prim count
|
// The value returned in SL for normal prims is prim count
|
||||||
ret.Add(new LSL_Float(obj.PhysicsCost));
|
ret.Add(new LSL_Float(obj.PhysicsCost));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
|
case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(0));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_ROOT:
|
case ScriptBaseClass.OBJECT_ROOT:
|
||||||
ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString()));
|
ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString()));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_ATTACHED_POINT:
|
case ScriptBaseClass.OBJECT_ATTACHED_POINT:
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint));
|
ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
|
case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
|
||||||
byte pcode = obj.Shape.PCode;
|
byte pcode = obj.Shape.PCode;
|
||||||
if (obj.ParentGroup.AttachmentPoint != 0
|
if (obj.ParentGroup.AttachmentPoint != 0
|
||||||
|| pcode == (byte)PCode.Grass
|
|| pcode == (byte)PCode.Grass
|
||||||
|| pcode == (byte)PCode.Tree
|
|| pcode == (byte)PCode.Tree
|
||||||
|| pcode == (byte)PCode.NewTree)
|
|| pcode == (byte)PCode.NewTree)
|
||||||
{
|
{
|
||||||
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER));
|
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET));
|
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PHYSICS:
|
case ScriptBaseClass.OBJECT_PHYSICS:
|
||||||
if (obj.ParentGroup.AttachmentPoint != 0)
|
if (obj.ParentGroup.AttachmentPoint != 0)
|
||||||
{
|
{
|
||||||
ret.Add(new LSL_Integer(0)); // Always false if attached
|
ret.Add(new LSL_Integer(0)); // Always false if attached
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
|
ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PHANTOM:
|
case ScriptBaseClass.OBJECT_PHANTOM:
|
||||||
if (obj.ParentGroup.AttachmentPoint != 0)
|
if (obj.ParentGroup.AttachmentPoint != 0)
|
||||||
{
|
{
|
||||||
ret.Add(new LSL_Integer(0)); // Always false if attached
|
ret.Add(new LSL_Integer(0)); // Always false if attached
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
|
ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
|
case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
|
ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
|
case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
|
||||||
|
ret.Add(new LSL_Float(-1));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
|
||||||
|
ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID.ToString()));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_CLICK_ACTION:
|
||||||
|
ret.Add(new LSL_Integer(obj.ClickAction));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_OMEGA:
|
||||||
|
ret.Add(new LSL_Vector(obj.AngularVelocity));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PRIM_COUNT:
|
||||||
|
ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
|
||||||
|
SceneObjectPart[] parts = obj.ParentGroup.Parts;
|
||||||
|
int nparts = parts.Count();
|
||||||
|
int count = 0;
|
||||||
|
for(int i = 0; i < nparts; i++)
|
||||||
|
count += parts[i].Inventory.Count;
|
||||||
|
ret.Add(new LSL_Integer(count));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_REZZER_KEY:
|
||||||
|
ret.Add(new LSL_Key(obj.ParentGroup.RezzerID.ToString()));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_GROUP_TAG:
|
||||||
|
ret.Add(new LSL_String(String.Empty));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
|
||||||
|
if (obj.ParentGroup.AttachmentPoint != 0 && obj.ParentGroup.FromItemID == UUID.Zero)
|
||||||
|
{
|
||||||
|
ret.Add(new LSL_Integer(1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ret.Add(new LSL_Integer(0));
|
ret.Add(new LSL_Integer(0));
|
||||||
break;
|
}
|
||||||
case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
|
break;
|
||||||
ret.Add(new LSL_Float(0));
|
default:
|
||||||
break;
|
// Invalid or unhandled constant.
|
||||||
case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
|
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||||
ret.Add(new LSL_Float(-1));
|
break;
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
|
|
||||||
ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID.ToString()));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_CLICK_ACTION:
|
|
||||||
ret.Add(new LSL_Integer(obj.ClickAction));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_OMEGA:
|
|
||||||
ret.Add(new LSL_Vector(obj.AngularVelocity));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_PRIM_COUNT:
|
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
|
|
||||||
SceneObjectPart[] parts = obj.ParentGroup.Parts;
|
|
||||||
int nparts = parts.Count();
|
|
||||||
int count = 0;
|
|
||||||
for(int i = 0; i < nparts; i++)
|
|
||||||
count += parts[i].Inventory.Count;
|
|
||||||
ret.Add(new LSL_Integer(count));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_REZZER_KEY:
|
|
||||||
ret.Add(new LSL_Key(obj.ParentGroup.RezzerID.ToString()));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_GROUP_TAG:
|
|
||||||
ret.Add(new LSL_String(String.Empty));
|
|
||||||
break;
|
|
||||||
case ScriptBaseClass.OBJECT_TEMP_ATTACHED:
|
|
||||||
if (obj.ParentGroup.AttachmentPoint != 0 && obj.ParentGroup.FromItemID == UUID.Zero)
|
|
||||||
{
|
|
||||||
ret.Add(new LSL_Integer(1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret.Add(new LSL_Integer(0));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Invalid or unhandled constant.
|
|
||||||
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LSL_List();
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal UUID GetScriptByName(string name)
|
internal UUID GetScriptByName(string name)
|
||||||
|
|
|
@ -169,11 +169,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
LSL_Integer llGetNumberOfPrims();
|
LSL_Integer llGetNumberOfPrims();
|
||||||
LSL_Integer llGetNumberOfSides();
|
LSL_Integer llGetNumberOfSides();
|
||||||
LSL_String llGetObjectDesc();
|
LSL_String llGetObjectDesc();
|
||||||
LSL_List llGetObjectDetails(string id, LSL_List args);
|
LSL_List llGetObjectDetails(LSL_Key objectId, LSL_List args);
|
||||||
LSL_Float llGetObjectMass(string id);
|
LSL_Float llGetObjectMass(LSL_Key objectId);
|
||||||
LSL_String llGetObjectName();
|
LSL_String llGetObjectName();
|
||||||
LSL_Integer llGetObjectPermMask(int mask);
|
LSL_Integer llGetObjectPermMask(int mask);
|
||||||
LSL_Integer llGetObjectPrimCount(string object_id);
|
LSL_Integer llGetObjectPrimCount(LSL_Key objectId);
|
||||||
LSL_Vector llGetOmega();
|
LSL_Vector llGetOmega();
|
||||||
LSL_Key llGetOwner();
|
LSL_Key llGetOwner();
|
||||||
LSL_Key llGetOwnerKey(string id);
|
LSL_Key llGetOwnerKey(string id);
|
||||||
|
@ -416,7 +416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
void llStopSound();
|
void llStopSound();
|
||||||
LSL_Integer llStringLength(string str);
|
LSL_Integer llStringLength(string str);
|
||||||
LSL_String llStringToBase64(string str);
|
LSL_String llStringToBase64(string str);
|
||||||
LSL_String llStringTrim(string src, int type);
|
LSL_String llStringTrim(LSL_String src, LSL_Integer type);
|
||||||
LSL_Integer llSubStringIndex(string source, string pattern);
|
LSL_Integer llSubStringIndex(string source, string pattern);
|
||||||
void llTakeCamera(string avatar);
|
void llTakeCamera(string avatar);
|
||||||
void llTakeControls(int controls, int accept, int pass_on);
|
void llTakeControls(int controls, int accept, int pass_on);
|
||||||
|
|
|
@ -641,7 +641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
return m_LSL_Functions.llGetObjectDesc();
|
return m_LSL_Functions.llGetObjectDesc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_List llGetObjectDetails(string id, LSL_List args)
|
public LSL_List llGetObjectDetails(LSL_Key id, LSL_List args)
|
||||||
{
|
{
|
||||||
return m_LSL_Functions.llGetObjectDetails(id, args);
|
return m_LSL_Functions.llGetObjectDetails(id, args);
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
return m_LSL_Functions.llGetObjectPermMask(mask);
|
return m_LSL_Functions.llGetObjectPermMask(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetObjectPrimCount(string object_id)
|
public LSL_Integer llGetObjectPrimCount(LSL_Key object_id)
|
||||||
{
|
{
|
||||||
return m_LSL_Functions.llGetObjectPrimCount(object_id);
|
return m_LSL_Functions.llGetObjectPrimCount(object_id);
|
||||||
}
|
}
|
||||||
|
@ -1871,7 +1871,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
return m_LSL_Functions.llStringToBase64(str);
|
return m_LSL_Functions.llStringToBase64(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_String llStringTrim(string src, int type)
|
public LSL_String llStringTrim(LSL_String src, LSL_Integer type)
|
||||||
{
|
{
|
||||||
return m_LSL_Functions.llStringTrim(src, type);
|
return m_LSL_Functions.llStringTrim(src, type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue