本文整理汇总了C#中OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetSublist方法的典型用法代码示例。如果您正苦于以下问题:C# OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetSublist方法的具体用法?C# OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetSublist怎么用?C# OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetSublist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
的用法示例。
在下文中一共展示了OpenSim.Region.ScriptEngine.Shared.LSL_Types.list.GetSublist方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: llListReplaceList
/// <summary>
/// illListReplaceList removes the sub-list defined by the inclusive indices
/// start and end and inserts the src list in its place. The inclusive
/// nature of the indices means that at least one element must be deleted
/// if the indices are within the bounds of the existing list. I.e. 2,2
/// will remove the element at index 2 and replace it with the source
/// list. Both indices may be negative, with the usual interpretation. An
/// interesting case is where end is lower than start. As these indices
/// bound the list to be removed, then 0->end, and start->lim are removed
/// and the source list is added as a suffix.
/// </summary>
public LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end)
{
LSL_List pref = null;
m_host.AddScriptLPS(1);
// Note that although we have normalized, both
// indices could still be negative.
if (start < 0)
{
start = start+dest.Length;
}
if (end < 0)
{
end = end+dest.Length;
}
// The comventional case, remove a sequence starting with
// start and ending with end. And then insert the source
// list.
if (start <= end)
{
// If greater than zero, then there is going to be a
// surviving prefix. Otherwise the inclusive nature
// of the indices mean that we're going to add the
// source list as a prefix.
if (start > 0)
{
pref = dest.GetSublist(0,start-1);
// Only add a suffix if there is something
// beyond the end index (it's inclusive too).
if (end + 1 < dest.Length)
{
return pref + src + dest.GetSublist(end + 1, -1);
}
else
{
return pref + src;
}
}
// If start is less than or equal to zero, then
// the new list is simply a prefix. We still need to
// figure out any necessary surgery to the destination
// based upon end. Note that if end exceeds the upper
// bound in this case, the entire destination list
// is removed.
else
{
if (end + 1 < dest.Length)
{
return src + dest.GetSublist(end + 1, -1);
}
else
{
return src;
}
}
}
// Finally, if start > end, we strip away a prefix and
// a suffix, to leave the list that sits <between> ens
// and start, and then tag on the src list. AT least
// that's my interpretation. We can get sublist to do
// this for us. Note that one, or both of the indices
// might have been negative.
else
{
return dest.GetSublist(end + 1, start - 1) + src;
}
}
示例2: osGetLinkPrimitiveParams
/// <summary>
/// Get the primitive parameters of a linked prim.
/// </summary>
/// <remarks>
/// Threat level is 'Low' because certain users could possibly be tricked into
/// dropping an unverified script into one of their own objects, which could
/// then gather the physical construction details of the object and transmit it
/// to an unscrupulous third party, thus permitting unauthorized duplication of
/// the object's form.
/// </remarks>
/// <param name="linknumber"></param>
/// <param name="rules"></param>
/// <returns></returns>
public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules)
{
CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams");
m_host.AddScriptLPS(1);
InitLSL();
// One needs to cast m_LSL_Api because we're using functions not
// on the ILSL_Api interface.
LSL_Api LSL_Api = (LSL_Api)m_LSL_Api;
LSL_List retVal = new LSL_List();
LSL_List remaining = new LSL_List();
List<SceneObjectPart> parts = LSL_Api.GetLinkParts(linknumber);
foreach (SceneObjectPart part in parts)
{
remaining = LSL_Api.GetPrimParams(part, rules, ref retVal);
}
while (remaining.Length > 2)
{
linknumber = remaining.GetLSLIntegerItem(0);
rules = remaining.GetSublist(1, -1);
parts = LSL_Api.GetLinkParts(linknumber);
foreach (SceneObjectPart part in parts)
remaining = LSL_Api.GetPrimParams(part, rules, ref retVal);
}
return retVal;
}
示例3: llListInsertList
/// <summary>
/// Insert the list identified by <src> into the
/// list designated by <dest> such that the first
/// new element has the index specified by <index>
/// </summary>
public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
{
LSL_List pref = null;
LSL_List suff = null;
m_host.AddScriptLPS(1);
if (index < 0)
{
index = index+dest.Length;
if (index < 0)
{
index = 0;
}
}
if (index != 0)
{
pref = dest.GetSublist(0,index-1);
if (index < dest.Length)
{
suff = dest.GetSublist(index,-1);
return pref + src + suff;
}
else
{
return pref + src;
}
}
else
{
if (index < dest.Length)
{
suff = dest.GetSublist(index,-1);
return src + suff;
}
else
{
return src;
}
}
}
示例4: SetPrimParams
//.........这里部分代码省略.........
case (int)ScriptBaseClass.PRIM_PHYSICS:
if (remain < 1)
return;
string phy = rules.Data[idx++].ToString();
bool physics;
if (phy.Equals("1"))
physics = true;
else
physics = false;
part.ScriptSetPhysicsStatus(physics);
break;
case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
if (remain < 1)
return;
string temp = rules.Data[idx++].ToString();
m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
break;
case (int)ScriptBaseClass.PRIM_TEXGEN:
if (remain < 2)
return;
//face,type
face = rules.GetLSLIntegerItem(idx++);
int style = rules.GetLSLIntegerItem(idx++);
SetTexGen(part, face, style);
break;
case (int)ScriptBaseClass.PRIM_TEXT:
if (remain < 3)
return;
string primText = rules.GetLSLStringItem(idx++);
LSL_Vector primTextColor = rules.GetVector3Item(idx++);
LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f),
Util.Clip((float)primTextColor.y, 0.0f, 1.0f),
Util.Clip((float)primTextColor.z, 0.0f, 1.0f));
part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
break;
case (int)ScriptBaseClass.PRIM_NAME:
if (remain < 1)
return;
string primName = rules.GetLSLStringItem(idx++);
part.Name = primName;
break;
case (int)ScriptBaseClass.PRIM_DESC:
if (remain < 1)
return;
string primDesc = rules.GetLSLStringItem(idx++);
part.Description = primDesc;
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
if (remain < 1)
return;
LSL_Rotation lr = rules.GetQuaternionItem(idx++);
SetRot(part, Rot2Quaternion(lr));
break;
case (int)ScriptBaseClass.PRIM_OMEGA:
if (remain < 3)
return;
LSL_Vector axis = rules.GetVector3Item(idx++);
LSL_Float spinrate = rules.GetLSLFloatItem(idx++);
LSL_Float gain = rules.GetLSLFloatItem(idx++);
TargetOmega(part, axis, (double)spinrate, (double)gain);
break;
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
return;
LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
LSL_List new_rules = rules.GetSublist(idx, -1);
setLinkPrimParams((int)new_linknumber, new_rules);
return;
}
}
}
finally
{
if (positionChanged)
{
if (part.ParentGroup.RootPart == part)
{
SceneObjectGroup parent = part.ParentGroup;
parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z));
}
else
{
part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z);
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate();
}
}
}
}
示例5: GetPrimParams
//.........这里部分代码省略.........
if (face == ScriptBaseClass.ALL_SIDES)
{
for (face = 0; face < GetNumberOfSides(part); face++)
{
MappingType texgen = tex.GetFace((uint)face).TexMapType;
// Convert MappingType to PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR etc.
res.Add(new LSL_Integer((uint)texgen >> 1));
}
}
else
{
if (face >= 0 && face < GetNumberOfSides(part))
{
MappingType texgen = tex.GetFace((uint)face).TexMapType;
res.Add(new LSL_Integer((uint)texgen >> 1));
}
}
break;
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
shape = part.Shape;
if (shape.LightEntry)
res.Add(new LSL_Integer(1)); // active
else
res.Add(new LSL_Integer(0));
res.Add(new LSL_Vector(shape.LightColorR, // color
shape.LightColorG,
shape.LightColorB));
res.Add(new LSL_Float(shape.LightIntensity)); // intensity
res.Add(new LSL_Float(shape.LightRadius)); // radius
res.Add(new LSL_Float(shape.LightFalloff)); // falloff
break;
case (int)ScriptBaseClass.PRIM_GLOW:
if (remain < 1)
return null;
face=(int)rules.GetLSLIntegerItem(idx++);
tex = part.Shape.Textures;
if (face == ScriptBaseClass.ALL_SIDES)
{
for (face = 0; face < GetNumberOfSides(part); face++)
{
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
res.Add(new LSL_Float(texface.Glow));
}
}
else
{
if (face >= 0 && face < GetNumberOfSides(part))
{
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
res.Add(new LSL_Float(texface.Glow));
}
}
break;
case (int)ScriptBaseClass.PRIM_TEXT:
Color4 textColor = part.GetTextColor();
res.Add(new LSL_String(part.Text));
res.Add(new LSL_Vector(textColor.R,
textColor.G,
textColor.B));
res.Add(new LSL_Float(textColor.A));
break;
case (int)ScriptBaseClass.PRIM_NAME:
res.Add(new LSL_String(part.Name));
break;
case (int)ScriptBaseClass.PRIM_DESC:
res.Add(new LSL_String(part.Description));
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
res.Add(new LSL_Rotation(part.RotationOffset));
break;
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
res.Add(new LSL_Vector(GetPartLocalPos(part)));
break;
case (int)ScriptBaseClass.PRIM_SLICE:
PrimType prim_type = part.GetPrimType();
bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING);
res.Add(new LSL_Vector(
(useProfileBeginEnd ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0,
1 - (useProfileBeginEnd ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0,
0
));
break;
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
// TODO: Should be issuing a runtime script warning in this case.
if (remain < 2)
return null;
return rules.GetSublist(idx, -1);
}
}
return null;
}
示例6: llList2List
public LSL_List llList2List(LSL_List src, int start, int end)
{
m_host.AddScriptLPS(1);
return src.GetSublist(start, end);
}
示例7: SetAgentParams
protected LSL_List SetAgentParams(ScenePresence sp, LSL_List rules, string originFunc, ref uint rulesParsed)
{
int idx = 0;
int idxStart = 0;
try
{
while (idx < rules.Length)
{
++rulesParsed;
int code = rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
idxStart = idx;
switch (code)
{
case ScriptBaseClass.PRIM_POSITION:
case ScriptBaseClass.PRIM_POS_LOCAL:
if (remain < 1)
return new LSL_List();
try
{
sp.OffsetPosition = rules.GetVector3Item(idx++);
}
catch(InvalidCastException)
{
if (code == ScriptBaseClass.PRIM_POSITION)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
}
else
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
}
return new LSL_List();
}
break;
case ScriptBaseClass.PRIM_ROTATION:
if (remain < 1)
return new LSL_List();
Quaternion inRot;
try
{
inRot = rules.GetQuaternionItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROTATION: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
SceneObjectPart parentPart = sp.ParentPart;
if (parentPart != null)
sp.Rotation = m_host.GetWorldRotation() * inRot;
break;
case ScriptBaseClass.PRIM_ROT_LOCAL:
if (remain < 1)
return new LSL_List();
try
{
sp.Rotation = rules.GetQuaternionItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROT_LOCAL: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
break;
case ScriptBaseClass.PRIM_TYPE:
Error(originFunc, "PRIM_TYPE disallowed on agent");
return new LSL_List();
case ScriptBaseClass.PRIM_OMEGA:
Error(originFunc, "PRIM_OMEGA disallowed on agent");
return new LSL_List();
case ScriptBaseClass.PRIM_LINK_TARGET:
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
return new LSL_List();
return rules.GetSublist(idx, -1);
default:
Error(originFunc,
string.Format("Error running rule #{0} on agent: arg #{1} - disallowed on agent", rulesParsed, idx - idxStart));
return new LSL_List();
}
}
}
//.........这里部分代码省略.........
示例8: GetAgentParams
//.........这里部分代码省略.........
if (remain < 1)
return null;
face = (int)rules.GetLSLIntegerItem(idx++);
if (face > 21)
break;
res.Add(ScriptBaseClass.ZERO_VECTOR);
res.Add(new LSL_Float(0));
break;
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
if (remain < 1)
return null;
face = (int)rules.GetLSLIntegerItem(idx++);
if (face > 21)
break;
res.Add(ScriptBaseClass.PRIM_SHINY_NONE);
res.Add(ScriptBaseClass.PRIM_BUMP_NONE);
break;
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
if (remain < 1)
return null;
face = (int)rules.GetLSLIntegerItem(idx++);
if (face > 21)
break;
res.Add(ScriptBaseClass.FALSE);
break;
case (int)ScriptBaseClass.PRIM_FLEXIBLE:
res.Add(ScriptBaseClass.FALSE);
res.Add(new LSL_Integer(0));
res.Add(new LSL_Float(0));
res.Add(new LSL_Float(0));
res.Add(new LSL_Float(0));
res.Add(new LSL_Float(0));
res.Add(ScriptBaseClass.ZERO_VECTOR);
break;
case (int)ScriptBaseClass.PRIM_TEXGEN:
if (remain < 1)
return null;
face = (int)rules.GetLSLIntegerItem(idx++);
if (face > 21)
break;
res.Add(ScriptBaseClass.PRIM_TEXGEN_DEFAULT);
break;
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
res.Add(ScriptBaseClass.FALSE);
res.Add(ScriptBaseClass.ZERO_VECTOR);
res.Add(ScriptBaseClass.ZERO_VECTOR);
break;
case (int)ScriptBaseClass.PRIM_GLOW:
if (remain < 1)
return null;
face = (int)rules.GetLSLIntegerItem(idx++);
if (face > 21)
break;
res.Add(new LSL_Float(0));
break;
case (int)ScriptBaseClass.PRIM_TEXT:
res.Add(new LSL_String(""));
res.Add(ScriptBaseClass.ZERO_VECTOR);
res.Add(new LSL_Float(1));
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
res.Add(new LSL_Rotation(sp.Rotation));
break;
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
res.Add(new LSL_Vector(sp.OffsetPosition));
break;
case (int)ScriptBaseClass.PRIM_SLICE:
res.Add(new LSL_Vector(0, 1, 0));
break;
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
if(remain < 3)
return null;
return rules.GetSublist(idx, -1);
}
}
return null;
}
示例9: SetEntityParams
protected void SetEntityParams(List<ISceneEntity> entities, LSL_List rules, string originFunc)
{
LSL_List remaining = new LSL_List();
uint rulesParsed = 0;
foreach (ISceneEntity entity in entities)
{
if (entity is SceneObjectPart)
remaining = SetPrimParams((SceneObjectPart)entity, rules, originFunc, ref rulesParsed);
else
remaining = SetAgentParams((ScenePresence)entity, rules, originFunc, ref rulesParsed);
}
while (remaining.Length > 2)
{
int linknumber;
try
{
linknumber = remaining.GetLSLIntegerItem(0);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_LINK_TARGET: parameter 2 must be integer", rulesParsed));
return;
}
rules = remaining.GetSublist(1, -1);
entities = GetLinkEntities(linknumber);
foreach (ISceneEntity entity in entities)
{
if (entity is SceneObjectPart)
remaining = SetPrimParams((SceneObjectPart)entity, rules, originFunc, ref rulesParsed);
else
remaining = SetAgentParams((ScenePresence)entity, rules, originFunc, ref rulesParsed);
}
}
}
示例10: SetPrimParams
//.........这里部分代码省略.........
rot = rules.GetQuaternionItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROT_LOCAL: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
SetRot(part, rot);
break;
case ScriptBaseClass.PRIM_OMEGA:
if (remain < 3)
return new LSL_List();
LSL_Vector axis;
LSL_Float spinrate;
LSL_Float gain;
try
{
axis = rules.GetVector3Item(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
try
{
spinrate = rules.GetLSLFloatItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 3 must be float", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
try
{
gain = rules.GetLSLFloatItem(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
TargetOmega(part, axis, (double)spinrate, (double)gain);
break;
case ScriptBaseClass.PRIM_SLICE:
if (remain < 1)
return new LSL_List();
LSL_Vector slice;
try
{
slice = rules.GetVector3Item(idx++);
}
catch(InvalidCastException)
{
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SLICE: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
return new LSL_List();
}
part.UpdateSlice((float)slice.x, (float)slice.y);
break;
case ScriptBaseClass.PRIM_LINK_TARGET:
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
return new LSL_List();
return rules.GetSublist(idx, -1);
default:
Error(originFunc, string.Format("Error running rule #{0}: arg #{1} - unsupported parameter", rulesParsed, idx - idxStart));
return new LSL_List();
}
}
}
catch (InvalidCastException e)
{
Error(originFunc, string.Format("Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message);
}
finally
{
if (positionChanged)
{
if (part.ParentGroup.RootPart == part)
{
SceneObjectGroup parent = part.ParentGroup;
parent.UpdateGroupPosition(currentPosition);
}
else
{
part.OffsetPosition = currentPosition;
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate();
}
}
}
return new LSL_List();
}
示例11: SetLinkPrimParams
private void SetLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
{
List<object> parts = new List<object>();
List<SceneObjectPart> prims = GetLinkParts(linknumber);
List<ScenePresence> avatars = GetLinkAvatars(linknumber);
foreach (SceneObjectPart p in prims)
parts.Add(p);
foreach (ScenePresence p in avatars)
parts.Add(p);
LSL_List remaining = new LSL_List();
uint rulesParsed = 0;
if (parts.Count > 0)
{
foreach (object part in parts)
{
if (part is SceneObjectPart)
remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
else
remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
}
while (remaining.Length > 2)
{
linknumber = remaining.GetLSLIntegerItem(0);
rules = remaining.GetSublist(1, -1);
parts.Clear();
prims = GetLinkParts(linknumber);
avatars = GetLinkAvatars(linknumber);
foreach (SceneObjectPart p in prims)
parts.Add(p);
foreach (ScenePresence p in avatars)
parts.Add(p);
remaining = new LSL_List();
foreach (object part in parts)
{
if (part is SceneObjectPart)
remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
else
remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
}
}
}
}
示例12: GetPrimParams
//.........这里部分代码省略.........
res.Add(new LSL_Integer(ScriptBaseClass.FALSE));
}
break;
case (int)ScriptBaseClass.PRIM_FLEXIBLE:
res.Add(new LSL_Integer(0));
res.Add(new LSL_Integer(0));// softness
res.Add(new LSL_Float(0.0f)); // gravity
res.Add(new LSL_Float(0.0f)); // friction
res.Add(new LSL_Float(0.0f)); // wind
res.Add(new LSL_Float(0.0f)); // tension
res.Add(new LSL_Vector(0f,0f,0f));
break;
case (int)ScriptBaseClass.PRIM_TEXGEN:
// (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
if (remain < 1)
return new LSL_List();
face = (int)rules.GetLSLIntegerItem(idx++);
if (face == ScriptBaseClass.ALL_SIDES)
{
for (face = 0; face < 21; face++)
{
res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
}
}
else
{
res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
}
break;
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
res.Add(new LSL_Integer(0));
res.Add(new LSL_Vector(0f,0f,0f));
res.Add(new LSL_Float(0f)); // intensity
res.Add(new LSL_Float(0f)); // radius
res.Add(new LSL_Float(0f)); // falloff
break;
case (int)ScriptBaseClass.PRIM_GLOW:
if (remain < 1)
return new LSL_List();
face = (int)rules.GetLSLIntegerItem(idx++);
if (face == ScriptBaseClass.ALL_SIDES)
{
for (face = 0; face < 21; face++)
{
res.Add(new LSL_Float(0f));
}
}
else
{
res.Add(new LSL_Float(0f));
}
break;
case (int)ScriptBaseClass.PRIM_TEXT:
res.Add(new LSL_String(""));
res.Add(new LSL_Vector(0f,0f,0f));
res.Add(new LSL_Float(1.0f));
break;
case (int)ScriptBaseClass.PRIM_NAME:
res.Add(new LSL_String(avatar.Name));
break;
case (int)ScriptBaseClass.PRIM_DESC:
res.Add(new LSL_String(""));
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
Quaternion lrot = avatar.Rotation;
res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W));
break;
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
Vector3 lpos = avatar.OffsetPosition;
if(!avatar.LegacySitOffsets)
{
Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f);
lpos -= lsitOffset;
}
res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z));
break;
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
return new LSL_List();
return rules.GetSublist(idx, -1);
}
}
return new LSL_List();
}
示例13: SetPrimParams
//.........这里部分代码省略.........
case (int)ScriptBaseClass.PRIM_PHYSICS:
case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
case (int)ScriptBaseClass.PRIM_NAME:
case (int)ScriptBaseClass.PRIM_DESC:
if (remain < 1)
return new LSL_List();
idx++;
break;
case (int)ScriptBaseClass.PRIM_GLOW:
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
case (int)ScriptBaseClass.PRIM_TEXGEN:
if (remain < 2)
return new LSL_List();
idx += 2;
break;
case (int)ScriptBaseClass.PRIM_TYPE:
if (remain < 3)
return new LSL_List();
code = (int)rules.GetLSLIntegerItem(idx++);
remain = rules.Length - idx;
switch (code)
{
case (int)ScriptBaseClass.PRIM_TYPE_BOX:
case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
if (remain < 6)
return new LSL_List();
idx += 6;
break;
case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
if (remain < 5)
return new LSL_List();
idx += 5;
break;
case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
case (int)ScriptBaseClass.PRIM_TYPE_RING:
if (remain < 11)
return new LSL_List();
idx += 11;
break;
case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
if (remain < 2)
return new LSL_List();
idx += 2;
break;
}
break;
case (int)ScriptBaseClass.PRIM_COLOR:
case (int)ScriptBaseClass.PRIM_TEXT:
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
case (int)ScriptBaseClass.PRIM_OMEGA:
if (remain < 3)
return new LSL_List();
idx += 3;
break;
case (int)ScriptBaseClass.PRIM_TEXTURE:
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
if (remain < 5)
return new LSL_List();
idx += 5;
break;
case (int)ScriptBaseClass.PRIM_FLEXIBLE:
if (remain < 7)
return new LSL_List();
idx += 7;
break;
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
return new LSL_List();
return rules.GetSublist(idx, -1);
}
}
}
catch (InvalidCastException e)
{
Error(originFunc,string.Format(
" error running rule #{1}: arg #{2} ",
rulesParsed, idx - idxStart) + e.Message);
}
finally
{
if (positionChanged)
av.SendTerseUpdateToAllClients();
}
return new LSL_List();
}
示例14: llGetLinkPrimitiveParams
public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules)
{
m_host.AddScriptLPS(1);
// acording to SL wiki this must indicate a single link number or link_root or link_this.
// keep other options as before
List<SceneObjectPart> parts;
List<ScenePresence> avatars;
LSL_List res = new LSL_List();
LSL_List remaining = new LSL_List();
while (rules.Length > 0)
{
parts = GetLinkParts(linknumber);
avatars = GetLinkAvatars(linknumber);
remaining = new LSL_List();
foreach (SceneObjectPart part in parts)
{
remaining = GetPrimParams(part, rules, ref res);
}
foreach (ScenePresence avatar in avatars)
{
remaining = GetPrimParams(avatar, rules, ref res);
}
if (remaining.Length > 0)
{
linknumber = remaining.GetLSLIntegerItem(0);
rules = remaining.GetSublist(1, -1);
}
else
break;
}
return res;
}