本文整理汇总了C#中OpenSim.Region.ScriptEngine.Shared.LSL_Types类的典型用法代码示例。如果您正苦于以下问题:C# LSL_Types类的具体用法?C# LSL_Types怎么用?C# LSL_Types使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LSL_Types类属于OpenSim.Region.ScriptEngine.Shared命名空间,在下文中一共展示了LSL_Types类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckllSetPrimitiveParams
// Set prim params for a sculpted prim and check results.
public void CheckllSetPrimitiveParams(LSL_Api api, string primTest,
LSL_Types.Vector3 primSize, int primType, string primMap, int primSculptType)
{
// Set the prim params.
api.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
ScriptBaseClass.PRIM_TYPE, primType, primMap, primSculptType));
// Get params for prim to validate settings.
LSL_Types.list primParams =
api.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE));
// Validate settings.
CheckllSetPrimitiveParamsVector(primSize, api.llList2Vector(primParams, 0), primTest + " prim size");
Assert.AreEqual(primType, api.llList2Integer(primParams, 1),
"TestllSetPrimitiveParams " + primTest + " prim type check fail");
Assert.AreEqual(primMap, (string)api.llList2String(primParams, 2),
"TestllSetPrimitiveParams " + primTest + " prim map check fail");
Assert.AreEqual(primSculptType, api.llList2Integer(primParams, 3),
"TestllSetPrimitiveParams " + primTest + " prim type scuplt check fail");
}
示例2: osTeleportOwner
public void osTeleportOwner(int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{
CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat, true);
}
示例3: CheckllRot2Euler
/// <summary>
/// Check an llRot2Euler conversion.
/// </summary>
/// <remarks>
/// Testing Rot2Euler this way instead of comparing against expected angles because
/// 1. There are several ways to get to the original Quaternion. For example a rotation
/// of PI and -PI will give the same result. But PI and -PI aren't equal.
/// 2. This method checks to see if the calculated angles from a quaternion can be used
/// to create a new quaternion to produce the same rotation.
/// However, can't compare the newly calculated quaternion against the original because
/// once again, there are multiple quaternions that give the same result. For instance
/// <X, Y, Z, S> == <-X, -Y, -Z, -S>. Additionally, the magnitude of S can be changed
/// and will still result in the same rotation if the values for X, Y, Z are also changed
/// to compensate.
/// However, if two quaternions represent the same rotation, then multiplying the first
/// quaternion by the conjugate of the second, will give a third quaternion representing
/// a zero rotation. This can be tested for by looking at the X, Y, Z values which should
/// be zero.
/// </remarks>
/// <param name="rot"></param>
private void CheckllRot2Euler(LSL_Types.Quaternion rot)
{
// Call LSL function to convert quaternion rotaion to euler radians.
LSL_Types.Vector3 eulerCalc = m_lslApi.llRot2Euler(rot);
// Now use the euler radians to recalculate a new quaternion rotation
LSL_Types.Quaternion newRot = m_lslApi.llEuler2Rot(eulerCalc);
// Multiple original quaternion by conjugate of quaternion calculated with angles.
LSL_Types.Quaternion check = rot * new LSL_Types.Quaternion(-newRot.x, -newRot.y, -newRot.z, newRot.s);
Assert.AreEqual(0.0, check.x, VECTOR_COMPONENT_ACCURACY, "TestllRot2Euler X bounds check fail");
Assert.AreEqual(0.0, check.y, VECTOR_COMPONENT_ACCURACY, "TestllRot2Euler Y bounds check fail");
Assert.AreEqual(0.0, check.z, VECTOR_COMPONENT_ACCURACY, "TestllRot2Euler Z bounds check fail");
}
示例4: TeleportAgent
private void TeleportAgent(string agent, int regionGridX, int regionGridY,
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
{
ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY);
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null)
{
// For osTeleportAgent, agent must be over owners land to avoid abuse
// For osTeleportOwner, this restriction isn't necessary
// commented out because its redundant and uneeded please remove eventually.
// if (relaxRestrictions ||
// m_host.OwnerID
// == World.LandChannel.GetLandObject(
// presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
// {
// We will launch the teleport on a new thread so that when the script threads are terminated
// before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
Util.FireAndForget(
o => World.RequestTeleportLocation(
presence.ControllingClient, regionHandle,
position, lookat, (uint)TPFlags.ViaLocation),
null, "OSSL_Api.TeleportAgentByRegionName");
ScriptSleep(5000);
// }
}
}
}
示例5: TeleportAgent
private void TeleportAgent(string agent, int regionX, int regionY,
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
{
ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null)
{
// For osTeleportAgent, agent must be over owners land to avoid abuse
// For osTeleportOwner, this restriction isn't necessary
if (relaxRestrictions ||
m_host.OwnerID
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{
World.RequestTeleportLocation(presence.ControllingClient, regionHandle,
new Vector3((float)position.x, (float)position.y, (float)position.z),
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
ScriptSleep(5000);
}
}
}
}
示例6: osMakeNotecard
/// <summary>
/// Write a notecard directly to the prim's inventory.
/// </summary>
/// <remarks>
/// This needs ThreatLevel high. It is an excellent griefer tool,
/// In a loop, it can cause asset bloat and DOS levels of asset
/// writes.
/// </remarks>
/// <param name="notecardName">The name of the notecard to write.</param>
/// <param name="contents">The contents of the notecard.</param>
public void osMakeNotecard(string notecardName, LSL_Types.list contents)
{
CheckThreatLevel(ThreatLevel.High, "osMakeNotecard");
m_host.AddScriptLPS(1);
StringBuilder notecardData = new StringBuilder();
for (int i = 0; i < contents.Length; i++)
notecardData.Append((string)(contents.GetLSLStringItem(i) + "\n"));
SaveNotecard(notecardName, "Script generated notecard", notecardData.ToString(), false);
}
示例7: rexRttCameraWorld
// rex
public void rexRttCameraWorld(string vAvatar, int command, string name, string assetID, LSL_Types.Vector3 vPos, LSL_Types.Vector3 vLookAt, int width, int height)
{
try
{
Vector3 pos = new Vector3((float)vPos.x, (float)vPos.y, (float)vPos.z);
Vector3 lookat = new Vector3((float)vLookAt.x, (float)vLookAt.y, (float)vLookAt.z);
World.ForEachScenePresence(delegate(ScenePresence controller)
{
if (controller.ControllingClient is RexNetwork.RexClientViewBase)
{
((RexNetwork.RexClientViewBase)controller.ControllingClient).SendRexRttCamera(command, name, new UUID(assetID), pos, lookat, width, height);
}
});
//World.SendRexRttCameraToAll(command, name, new UUID(assetID), pos, lookat, width, height);
}
catch { }
}
示例8: rexSetAmbientLight
public void rexSetAmbientLight(string avatar, LSL_Types.Vector3 lightDirection, LSL_Types.Vector3 lightColour, LSL_Types.Vector3 ambientColour)
{
try
{
Vector3 lightDir = new Vector3((float)lightDirection.x, (float)lightDirection.y, (float)lightDirection.z);
Vector3 lightC = new Vector3((float)lightColour.x, (float)lightColour.y, (float)lightColour.z);
Vector3 ambientC = new Vector3((float)ambientColour.x, (float)ambientColour.y, (float)ambientColour.z);
ScenePresence target = World.GetScenePresence(new UUID(avatar));
if (target != null)
{
if (target.ControllingClient is RexNetwork.RexClientViewBase)
{
RexNetwork.RexClientViewBase targetClient = (RexNetwork.RexClientViewBase)target.ControllingClient;
targetClient.SendRexSetAmbientLight(lightDir, lightC, ambientC);
}
}
}
catch { }
}
示例9: rexRaycast
public string rexRaycast(LSL_Types.Vector3 vPos, LSL_Types.Vector3 vDir, float vLength, string vIgnoreId)
{
uint tempignoreid = 0;
uint collid = 0;
if (vIgnoreId.Length > 0)
tempignoreid = System.Convert.ToUInt32(vIgnoreId, 10);
if(World.PhysicsScene is IRexPhysicsScene)
collid = ((IRexPhysicsScene)World.PhysicsScene).Raycast(new Vector3((float)vPos.x, (float)vPos.y, (float)vPos.z), new Vector3((float)vDir.x, (float)vDir.y, (float)vDir.z), vLength, tempignoreid);
return collid.ToString();
}
示例10: rexRttCamera
// rex
public void rexRttCamera(string vAvatar, int command, string name, string assetID, LSL_Types.Vector3 vPos, LSL_Types.Vector3 vLookAt, int width, int height)
{
try
{
ScenePresence target = World.GetScenePresence(new UUID(vAvatar));
if (target != null)
{
Vector3 pos = new Vector3((float)vPos.x, (float)vPos.y, (float)vPos.z);
Vector3 lookat = new Vector3((float)vLookAt.x, (float)vLookAt.y, (float)vLookAt.z);
if (target.ControllingClient is RexNetwork.RexClientViewBase)
{
RexNetwork.RexClientViewBase targetClient = (RexNetwork.RexClientViewBase)target.ControllingClient;
targetClient.SendRexRttCamera(command, name, new UUID(assetID), pos, lookat, width, height);
}
}
}
catch { }
}
示例11: rexIKSetLimbTarget
// rex
public void rexIKSetLimbTarget(string vAvatar, int vLimbId, LSL_Types.Vector3 vDest, float vTimeToTarget, float vStayTime, float vConstraintAngle, string vStartAnim, string vTargetAnim, string vEndAnim)
{
try
{
ScenePresence target = World.GetScenePresence(new UUID(vAvatar));
if (target != null)
{
Vector3 targetpos = new Vector3((float)vDest.x, (float)vDest.y, (float)vDest.z);
World.ForEachScenePresence(delegate(ScenePresence controller)
{
if (controller.ControllingClient is RexNetwork.RexClientViewBase)
{
((RexNetwork.RexClientViewBase)controller.ControllingClient).RexIKSendLimbTarget(target.UUID, vLimbId, targetpos, vTimeToTarget, vStayTime, vConstraintAngle, vStartAnim, vTargetAnim, vEndAnim);
}
});
//World.SendRexIKSetLimbTargetToAll(target.UUID, vLimbId, targetpos, vTimeToTarget, vStayTime, vConstraintAngle, vStartAnim, vTargetAnim, vEndAnim);
}
}
catch { }
}
示例12: rexAttachObjectToAvatar
public void rexAttachObjectToAvatar(string primId, string avatarId, int attachmentPoint, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, bool silent)
{
try
{
uint primLocalId = Convert.ToUInt32(primId);
UUID avatarUUID;
IClientAPI agent = null;
ScenePresence avatar = null;
if (UUID.TryParse(avatarId, out avatarUUID))
{
ScenePresence presence = m_ScriptEngine.World.GetScenePresence(avatarUUID);
agent = presence.ControllingClient;
avatar = presence;
}
else
{
uint avatarLocalId = Convert.ToUInt32(avatarId);
List<EntityBase> entities = m_ScriptEngine.World.GetEntities();
foreach (EntityBase ent in entities)
{
if (ent is ScenePresence)
{
if (ent.LocalId == avatarLocalId)
{
agent = ((ScenePresence)ent).ControllingClient;
avatar = ((ScenePresence)ent);
break;
}
}
}
}
if (agent == null)
{
m_log.ErrorFormat("[REXSCRIPT]: Failed to attach object to avatar. Could not find avatar {0}", avatarId);
return;
}
SceneObjectPart part = m_ScriptEngine.World.GetSceneObjectPart(primLocalId);
if (part == null)
{
m_log.Error("[REXSCRIPT] Error attaching object to avatar: Could not find object");
return;
}
Vector3 position = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
if (attachmentsModule != null)
{
attachmentsModule.AttachObject(agent, primLocalId, (uint)attachmentPoint, silent);
m_ScriptEngine.World.EventManager.TriggerOnAttach(primLocalId, part.ParentGroup.GetFromItemID(), agent.AgentId);
}
}
catch (Exception e)
{
m_log.Error("[REXSCRIPT] Error attaching object to avatar: " + e.ToString());
}
}
示例13: CheckllSetPrimitiveParamsVector
public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg)
{
// Check each vector component against expected result.
Assert.AreEqual(vecCheck.x, vecReturned.x, VECTOR_COMPONENT_ACCURACY,
"TestllSetPrimitiveParams " + msg + " vector check fail on x component");
Assert.AreEqual(vecCheck.y, vecReturned.y, VECTOR_COMPONENT_ACCURACY,
"TestllSetPrimitiveParams " + msg + " vector check fail on y component");
Assert.AreEqual(vecCheck.z, vecReturned.z, VECTOR_COMPONENT_ACCURACY,
"TestllSetPrimitiveParams " + msg + " vector check fail on z component");
}
示例14: osTeleportAgent
// Teleport functions
public void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{
// High because there is no security check. High griefer potential
//
CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null)
{
// agent must be over owners land to avoid abuse
if (m_host.OwnerID
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{
presence.ControllingClient.SendTeleportLocationStart();
World.RequestTeleportLocation(presence.ControllingClient, regionHandle,
new Vector3((float)position.x, (float)position.y, (float)position.z),
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
ScriptSleep(5000);
}
}
}
}
示例15: rexSetCameraClientSideEffect
// rex
public void rexSetCameraClientSideEffect(string avatar, bool enable, string assetId, LSL_Types.Vector3 vPos, LSL_Types.Quaternion vRot)
{
try
{
Vector3 pos = new Vector3((float)vPos.x, (float)vPos.y, (float)vPos.z);
Quaternion rot = new Quaternion((float)vRot.x, (float)vRot.y, (float)vRot.z, (float)vRot.s);
ScenePresence target = World.GetScenePresence(new UUID(avatar));
if (target != null)
{
if (target.ControllingClient is RexNetwork.RexClientViewBase)
{
RexNetwork.RexClientViewBase targetClient = (RexNetwork.RexClientViewBase)target.ControllingClient;
targetClient.SendRexCameraClientSideEffect(enable, new UUID(assetId), pos, rot);
}
}
}
catch { }
}