本文整理汇总了C#中Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.Add方法的具体用法?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.Add怎么用?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
的用法示例。
在下文中一共展示了Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: llGetParcelDetails
public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>();
LSL_List ret = new LSL_List();
if (parcelManagement != null)
{
LandData land = parcelManagement.GetLandObject((float)pos.x, (float)pos.y).LandData;
if (land == null)
{
return new LSL_List(0);
}
foreach (object o in param.Data)
{
switch (o.ToString())
{
case "0":
ret.Add (new LSL_String (land.Name));
break;
case "1":
ret.Add (new LSL_String (land.Description));
break;
case "2":
ret.Add (new LSL_Key (land.OwnerID.ToString ()));
break;
case "3":
ret.Add (new LSL_Key (land.GroupID.ToString ()));
break;
case "4":
ret.Add(new LSL_Integer(land.Area));
break;
case "5":
//Returning the InfoUUID so that we can use this for landmarks outside of this region
// http://wiki.secondlife.com/wiki/PARCEL_DETAILS_ID
ret.Add (new LSL_Key (land.InfoUUID.ToString ()));
break;
default:
ret.Add (new LSL_Integer (0));
break;
}
}
}
return ret;
}
示例2: GetLinkPrimitiveParams
public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules)
{
LSL_List res = new LSL_List();
int idx = 0;
while (idx < rules.Length)
{
int code = (int)rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
Primitive.TextureEntry tex = part.Shape.Textures;
int face = 0;
if (idx < rules.Length)
face = (int)rules.GetLSLIntegerItem(idx++);
Primitive.TextureEntryFace texFace = tex.GetFace((uint)face);
if (code == (int)ScriptBaseClass.PRIM_NAME)
{
res.Add(new LSL_Integer(part.Name));
}
if (code == (int)ScriptBaseClass.PRIM_DESC)
{
res.Add(new LSL_Integer(part.Description));
}
if (code == (int)ScriptBaseClass.PRIM_MATERIAL)
{
res.Add(new LSL_Integer(part.Material));
}
if (code == (int)ScriptBaseClass.PRIM_PHYSICS)
{
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0)
res.Add(new LSL_Integer(1));
else
res.Add(new LSL_Integer(0));
}
if (code == (int)ScriptBaseClass.PRIM_TEMP_ON_REZ)
{
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0)
res.Add(new LSL_Integer(1));
else
res.Add(new LSL_Integer(0));
}
if (code == (int)ScriptBaseClass.PRIM_PHANTOM)
{
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
res.Add(new LSL_Integer(1));
else
res.Add(new LSL_Integer(0));
}
if (code == (int)ScriptBaseClass.PRIM_POSITION)
{
Vector3 tmp = part.AbsolutePosition;
LSL_Vector v = new LSL_Vector(tmp.X,
tmp.Y,
tmp.Z);
// For some reason, the part.AbsolutePosition.* values do not change if the
// linkset is rotated; they always reflect the child prim's world position
// as though the linkset is unrotated. This is incompatible behavior with SL's
// implementation, so will break scripts imported from there (not to mention it
// makes it more difficult to determine a child prim's actual inworld position).
if (part.ParentID != 0)
{
LSL_Rotation rtmp = llGetRootRotation();
LSL_Vector rpos = llGetRootPosition();
v = ((v - rpos) * rtmp) + rpos;
}
res.Add(v);
}
if (code == (int)ScriptBaseClass.PRIM_SIZE)
{
Vector3 tmp = part.Scale;
res.Add(new LSL_Vector(tmp.X,
tmp.Y,
tmp.Z));
}
if (code == (int)ScriptBaseClass.PRIM_ROTATION)
{
res.Add(GetPartRot(part));
}
if (code == (int)ScriptBaseClass.PRIM_TYPE)
{
// implementing box
PrimitiveBaseShape Shape = part.Shape;
int primType = (int)part.GetPrimType();
res.Add(new LSL_Integer(primType));
double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX
double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY.
if (primType == ScriptBaseClass.PRIM_TYPE_BOX ||
ScriptBaseClass.PRIM_TYPE_CYLINDER ||
ScriptBaseClass.PRIM_TYPE_PRISM)
{
res.Add(new LSL_Integer(Shape.ProfileCurve));
//.........这里部分代码省略.........
示例3: aaDeserializeXMLValues
public LSL_List aaDeserializeXMLValues(LSL_String xmlFile)
{
if (
!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "AADeserializeXMLValues", m_host, "AA",
m_itemID)) return new LSL_List();
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlFile.m_string);
XmlNodeList children = doc.ChildNodes;
LSL_List values = new LSL_List();
foreach (XmlNode node in children)
{
values.Add(node.InnerText);
}
return values;
}
示例4: llListRandomize
/// <summary>
/// Randomizes the list, be arbitrarily reordering
/// sublists of stride elements. As the stride approaches
/// the size of the list, the options become very
/// limited.
/// </summary>
/// <remarks>
/// This could take a while for very large list
/// sizes.
/// </remarks>
public LSL_List llListRandomize(LSL_List src, int stride)
{
LSL_List result;
Random rand = new Random();
int chunkk;
int[] chunks;
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
if (stride <= 0)
{
stride = 1;
}
// Stride MUST be a factor of the list length
// If not, then return the src list. This also
// traps those cases where stride > length.
if (src.Length != stride && src.Length%stride == 0)
{
chunkk = src.Length/stride;
chunks = new int[chunkk];
for (int i = 0; i < chunkk; i++)
chunks[i] = i;
// Knuth shuffle the chunkk index
for (int i = chunkk - 1; i >= 1; i--)
{
// Elect an unrandomized chunk to swap
int index = rand.Next(i + 1);
int tmp;
// and swap position with first unrandomized chunk
tmp = chunks[i];
chunks[i] = chunks[index];
chunks[index] = tmp;
}
// Construct the randomized list
result = new LSL_List();
for (int i = 0; i < chunkk; i++)
{
for (int j = 0; j < stride; j++)
{
result.Add(src.Data[chunks[i]*stride+j]);
}
}
}
else {
object[] array = new object[src.Length];
Array.Copy(src.Data, 0, array, 0, src.Length);
result = new LSL_List(array);
}
return result;
}
示例5: llGetAnimationList
public LSL_List llGetAnimationList(string id)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
LSL_List l = new LSL_List();
ScenePresence av = World.GetScenePresence((UUID)id);
if (av == null || av.IsChildAgent) // only if in the region
return l;
UUID[] anims;
anims = av.Animator.GetAnimationArray();
foreach (UUID foo in anims)
l.Add(foo.ToString());
return l;
}
示例6: GetPrimMediaParams
private LSL_List GetPrimMediaParams(int face, LSL_List rules)
{
IMoapModule module = World.RequestModuleInterface<IMoapModule>();
if (null == module)
throw new Exception("Media on a prim functions not available");
MediaEntry me = module.GetMediaEntry(m_host, face);
// As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
if (null == me)
return new LSL_List();
LSL_List res = new LSL_List();
for (int i = 0; i < rules.Length; i++)
{
int code = (int)rules.GetLSLIntegerItem(i);
if (code == ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE)
{
// Not implemented
res.Add(new LSL_Integer(0));
}
else if (code == ScriptBaseClass.PRIM_MEDIA_CONTROLS)
{
if (me.Controls == MediaControls.Standard)
res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD));
else
res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI));
}
else if (code == ScriptBaseClass.PRIM_MEDIA_CURRENT_URL)
{
res.Add(new LSL_String(me.CurrentURL));
}
else if (code == ScriptBaseClass.PRIM_MEDIA_HOME_URL)
{
res.Add(new LSL_String(me.HomeURL));
}
else if (code == ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP)
{
res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
}
else if (code == ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY)
{
res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
}
else if (code == ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE)
{
res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
}
else if (code == ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM)
{
res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
}
else if (code == ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT)
{
res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
}
else if (code == ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS)
{
res.Add(new LSL_Integer(me.Width));
}
else if (code == ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS)
{
res.Add(new LSL_Integer(me.Height));
}
else if (code == ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE)
{
res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
}
else if (code == ScriptBaseClass.PRIM_MEDIA_WHITELIST)
{
string[] urls = (string[])me.WhiteList.Clone();
for (int j = 0; j < urls.Length; j++)
urls[j] = Uri.EscapeDataString(urls[j]);
res.Add(new LSL_String(string.Join(", ", urls)));
}
else if (code == ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT)
{
res.Add(new LSL_Integer((int)me.InteractPermissions));
}
else if (code == ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL)
{
res.Add(new LSL_Integer((int)me.ControlPermissions));
}
}
return res;
}
示例7: llGetObjectDetails
public LSL_List llGetObjectDetails(string id, LSL_List args)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
LSL_List ret = new LSL_List();
UUID key = new UUID();
if (UUID.TryParse(id, out key))
{
ScenePresence av = World.GetScenePresence(key);
if (av != null)
{
foreach (object o in args.Data)
{
if ((LSL_Integer)o == ScriptBaseClass.OBJECT_NAME)
{
ret.Add(av.Firstname + " " + av.Lastname);
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_DESC)
{
ret.Add("");
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_POS)
{
Vector3 tmp = av.AbsolutePosition;
ret.Add(new LSL_Vector((double)tmp.X, (double)tmp.Y, (double)tmp.Z));
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_ROT)
{
Quaternion rtmp = av.Rotation;
ret.Add(new LSL_Rotation((double)rtmp.X, (double)rtmp.Y, (double)rtmp.Z, (double)rtmp.W));
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_VELOCITY)
{
Vector3 tmp = av.Velocity;
ret.Add(new LSL_Vector(tmp.X, tmp.Y, tmp.Z));
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_OWNER)
{
ret.Add(id);
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_GROUP)
{
ret.Add(UUID.Zero.ToString());
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_CREATOR)
{
ret.Add(UUID.Zero.ToString());
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT)
{
IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
int activeScripts = 0;
foreach (IScriptModule module in modules)
{
activeScripts += module.GetActiveScripts(av);
}
ret.Add(activeScripts);
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT)
{
IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
int totalScripts = 0;
foreach (IScriptModule module in modules)
{
totalScripts += module.GetTotalScripts(av);
}
ret.Add(totalScripts);
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_SCRIPT_MEMORY)
{
ret.Add(0);
}
}
return ret;
}
SceneObjectPart obj = World.GetSceneObjectPart(key);
if (obj != null)
{
foreach (object o in args.Data)
{
if ((LSL_Integer)o == ScriptBaseClass.OBJECT_NAME)
{
ret.Add(obj.Name);
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_DESC)
{
ret.Add(obj.Description);
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_POS)
{
Vector3 tmp = obj.AbsolutePosition;
ret.Add(new LSL_Vector(tmp.X, tmp.Y, tmp.Z));
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_ROT)
{
Quaternion rtmp = obj.RotationOffset;
ret.Add(new LSL_Rotation(rtmp.X, rtmp.Y, rtmp.Z, rtmp.W));
}
else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_VELOCITY)
//.........这里部分代码省略.........
示例8: llCastRay
public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
return new LSL_List();
LSL_List list = new LSL_List();
Vector3 rayStart = start.ToVector3();
Vector3 rayEnd = end.ToVector3();
Vector3 dir = rayEnd - rayStart;
float dist = Vector3.Mag(dir);
int count = 1;
bool detectPhantom = false;
int dataFlags = 0;
int rejectTypes = 0;
for (int i = 0; i < options.Length; i += 2)
{
if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
count = options.GetLSLIntegerItem(i + 1);
else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
detectPhantom = (options.GetLSLIntegerItem(i + 1) > 0);
else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DATA_FLAGS)
dataFlags = options.GetLSLIntegerItem(i + 1);
else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
rejectTypes = options.GetLSLIntegerItem(i + 1);
}
if (count > 16)
count = 16;
List<ContactResult> results = new List<ContactResult>();
bool checkTerrain = !((rejectTypes & ScriptBaseClass.RC_REJECT_LAND) == ScriptBaseClass.RC_REJECT_LAND);
bool checkAgents = !((rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) == ScriptBaseClass.RC_REJECT_AGENTS);
bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL);
bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
if (checkAgents)
{
ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
foreach (ContactResult r in agentHits)
results.Add(r);
}
if (checkPhysical || checkNonPhysical || detectPhantom)
{
ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom);
for (int iter = 0; iter < objectHits.Length; iter++)
{
// Redistance the Depth because the Scene RayCaster returns distance from center to make the rezzing code simpler.
objectHits[iter].Depth = Vector3.Distance(objectHits[iter].Pos, rayStart);
results.Add(objectHits[iter]);
}
}
if (checkTerrain)
{
ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
if (groundContact != null)
results.Add((ContactResult)groundContact);
}
results.Sort(delegate(ContactResult a, ContactResult b)
{
return a.Depth.CompareTo(b.Depth);
});
int values = 0;
ISceneEntity thisgrp = m_host.ParentEntity;
foreach (ContactResult result in results)
{
if (result.Depth > dist)
continue;
// physics ray can return colisions with host prim
if (m_host.LocalId == result.ConsumerID)
continue;
UUID itemID = UUID.Zero;
int linkNum = 0;
ISceneChildEntity part = World.GetSceneObjectPart(result.ConsumerID);
// It's a prim!
if (part != null)
{
// dont detect members of same object ???
if (part.ParentEntity == thisgrp)
continue;
if ((dataFlags & ScriptBaseClass.RC_GET_ROOT_KEY) == ScriptBaseClass.RC_GET_ROOT_KEY)
itemID = part.ParentEntity.UUID;
else
itemID = part.UUID;
linkNum = part.LinkNum;
//.........这里部分代码省略.........
示例9: llGetAgentList
/// <summary>
/// http://wiki.secondlife.com/wiki/LlGetAgentList
/// The list of options is currently not used in SL
/// scope is one of:-
/// AGENT_LIST_REGION - all in the region
/// AGENT_LIST_PARCEL - all in the same parcel as the scripted object
/// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the
/// current parcel.
/// </summary>
public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
return new LSL_List();
// the constants are 1, 2 and 4 so bits are being set, but you
// get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4
bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION;
bool parcelOwned = scope == ScriptBaseClass.AGENT_LIST_PARCEL_OWNER;
bool parcel = scope == ScriptBaseClass.AGENT_LIST_PARCEL;
LSL_List result = new LSL_List();
if (!regionWide && !parcelOwned && !parcel)
{
result.Add("INVALID_SCOPE");
return result;
}
Vector3 pos;
UUID id = UUID.Zero;
if (parcel || parcelOwned)
{
pos = m_host.GetWorldPosition();
IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>();
ILandObject land = parcelManagement.GetLandObject(pos.X, pos.Y);
if (land == null)
{
id = UUID.Zero;
}
else
{
if (parcelOwned)
{
id = land.LandData.OwnerID;
}
else
{
id = land.LandData.GlobalID;
}
}
}
World.ForEachScenePresence(delegate(IScenePresence ssp)
{
// Gods are not listed in SL
if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent)
{
if (!regionWide)
{
pos = ssp.AbsolutePosition;
IParcelManagementModule parcelManagement =
World.RequestModuleInterface<IParcelManagementModule>();
ILandObject land = parcelManagement.GetLandObject(pos.X, pos.Y);
if (land != null)
{
if (parcelOwned && land.LandData.OwnerID == id ||
parcel && land.LandData.GlobalID == id)
{
result.Add(ssp.UUID.ToString());
}
}
}
else
{
result.Add(ssp.UUID.ToString());
}
}
// Maximum of 100 results
if (result.Length > 99)
{
return;
}
});
return result;
}
示例10: llGetObjectDetails
public LSL_List llGetObjectDetails(string id, LSL_List args)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
LSL_List ret = new LSL_List();
UUID key = new UUID();
if (UUID.TryParse(id, out key))
{
ScenePresence av = World.GetScenePresence(key);
if (av != null)
{
foreach (object o in args.Data)
{
switch (o.ToString())
{
case "1":
ret.Add(av.Firstname + " " + av.Lastname);
break;
case "2":
ret.Add("");
break;
case "3":
ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z));
break;
case "4":
ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W));
break;
case "5":
ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z));
break;
case "6":
ret.Add(id);
break;
case "7":
ret.Add(UUID.Zero.ToString());
break;
case "8":
ret.Add(UUID.Zero.ToString());
break;
}
}
return ret;
}
SceneObjectPart obj = World.GetSceneObjectPart(key);
if (obj != null)
{
foreach (object o in args.Data)
{
switch (o.ToString())
{
case "1":
ret.Add(obj.Name);
break;
case "2":
ret.Add(obj.Description);
break;
case "3":
ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z));
break;
case "4":
ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W));
break;
case "5":
ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z));
break;
case "6":
ret.Add(obj.OwnerID.ToString());
break;
case "7":
ret.Add(obj.GroupID.ToString());
break;
case "8":
ret.Add(obj.CreatorID.ToString());
break;
}
}
return ret;
}
}
return new LSL_List();
}
示例11: llGetObjectDetails
public LSL_List llGetObjectDetails(string id, LSL_List args)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
return new LSL_List();
LSL_List ret = new LSL_List();
UUID key = new UUID();
if (UUID.TryParse(id, out key))
{
IScenePresence av = World.GetScenePresence(key);
if (av != null)
{
foreach (object o in args.Data)
{
if ((LSL_Integer) o == ScriptBaseClass.OBJECT_NAME)
{
ret.Add(new LSL_String(av.Name));
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_DESC)
{
ret.Add(new LSL_String(""));
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_POS)
{
Vector3 tmp = av.AbsolutePosition;
ret.Add(new LSL_Vector(tmp.X, tmp.Y, tmp.Z));
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_ROT)
{
Quaternion rtmp = av.Rotation;
ret.Add(new LSL_Rotation(rtmp.X, rtmp.Y, rtmp.Z, rtmp.W));
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_VELOCITY)
{
Vector3 tmp = av.Velocity;
ret.Add(new LSL_Vector(tmp.X, tmp.Y, tmp.Z));
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_OWNER)
{
ret.Add(id);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_GROUP)
{
ret.Add(UUID.Zero.ToString());
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_CREATOR)
{
ret.Add(UUID.Zero.ToString());
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT)
{
IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
int activeScripts = modules.Sum(mod => mod.GetActiveScripts(av));
ret.Add(activeScripts);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT)
{
IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
int totalScripts = modules.Sum(mod => mod.GetTotalScripts(av));
ret.Add(totalScripts);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_SCRIPT_MEMORY)
{
ret.Add(0);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_SCRIPT_TIME)
{
IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
int scriptTime = modules.Sum(mod => mod.GetScriptTime(m_itemID));
ret.Add(scriptTime);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE)
{
ret.Add(0);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_SERVER_COST)
{
ret.Add(0);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_STREAMING_COST)
{
ret.Add(0);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_PHYSICS_COST)
{
ret.Add(0);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_CHARACTER_TIME)
{
ret.Add(0);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_ROOT)
{
ret.Add(av.Sitting ? av.SittingOnUUID : av.UUID);
}
else if ((LSL_Integer) o == ScriptBaseClass.OBJECT_ATTACHED_POINT)
{
ret.Add(0);
}
//.........这里部分代码省略.........
示例12: llGetParcelPrimOwners
public LSL_List llGetParcelPrimOwners(LSL_Vector pos)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
LandObject land = (LandObject)World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
LSL_List ret = new LSL_List();
if (land != null)
{
foreach (KeyValuePair<UUID, int> detectedParams in land.GetLandObjectOwners())
{
ret.Add(detectedParams.Key.ToString());
ret.Add(detectedParams.Value);
}
}
ScriptSleep(2000);
return ret;
}
示例13: osGetAvatarList
/// <summary>
/// Like osGetAgents but returns enough info for a radar
/// </summary>
/// <returns>Strided list of the UUID, position and name of each avatar in the region</returns>
public LSL_List osGetAvatarList()
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "osGetAvatarList", m_host, "OSSL");
LSL_List result = new LSL_List();
World.ForEachScenePresence(delegate (ScenePresence avatar)
{
if (avatar != null && avatar.UUID != m_host.OwnerID)
{
if (!avatar.IsChildAgent)
{
result.Add(avatar.UUID);
result.Add(avatar.AbsolutePosition);
result.Add(avatar.Name);
}
}
});
return result;
}
示例14: ParseJsonNode
private object ParseJsonNode(OSD node)
{
if (node.Type == OSDType.Integer)
return new LSL_Integer(node.AsInteger());
if (node.Type == OSDType.Boolean)
return new LSL_Integer(node.AsBoolean() ? 1 : 0);
if (node.Type == OSDType.Real)
return new LSL_Float(node.AsReal());
if (node.Type == OSDType.UUID || node.Type == OSDType.String)
return new LSL_String(node.AsString());
if (node.Type == OSDType.Array)
{
LSL_List resp = new LSL_List();
OSDArray ar = node as OSDArray;
foreach (OSD o in ar)
resp.Add(ParseJsonNode(o));
return resp;
}
if (node.Type == OSDType.Map)
{
LSL_List resp = new LSL_List();
OSDMap ar = node as OSDMap;
foreach (KeyValuePair<string, OSD> o in ar)
{
resp.Add(new LSL_String(o.Key));
resp.Add(ParseJsonNode(o.Value));
}
return resp;
}
throw new Exception(ScriptBaseClass.JSON_INVALID);
}
示例15: botGetBotsWithTag
public LSL_List botGetBotsWithTag (string tag)
{
ScriptProtection.CheckThreatLevel (ThreatLevel.Moderate, "botGetBotsWithTag", m_host, "bot");
IBotManager manager = World.RequestModuleInterface<IBotManager> ();
List<UUID> bots = new List<UUID> ();
if (manager != null)
bots = manager.GetBotsWithTag (tag);
LSL_List b = new LSL_List ();
foreach(UUID bot in bots)
b.Add(bot.ToString());
return b;
}