// 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"); }
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); }
/// <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"); }
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); // } } } }
public void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // Threat level None because this is what can already be done with the World Map in the viewer CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true); }
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); } } } }
/// <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); }
// 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 { } }
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 { } }
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(); }
// 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 { } }
// 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 { } }
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()); } }
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"); }
// 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); } } } }
// 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 { } }
// This needs ThreatLevel high. It is an excellent griefer tool, // In a loop, it can cause asset bloat and DOS levels of asset // writes. // public void osMakeNotecard(string notecardName, LSL_Types.list contents) { CheckThreatLevel(ThreatLevel.High, "osMakeNotecard"); m_host.AddScriptLPS(1); // Create new asset AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); asset.Description = "Script Generated Notecard"; string notecardData = String.Empty; for (int i = 0; i < contents.Length; i++) { notecardData += contents.GetLSLStringItem(i) + "\n"; } int textLength = notecardData.Length; notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " + textLength.ToString() + "\n" + notecardData + "}\n"; asset.Data = Util.UTF8.GetBytes(notecardData); World.AssetService.Store(asset); // Create Task Entry TaskInventoryItem taskItem=new TaskInventoryItem(); taskItem.ResetIDs(m_host.UUID); taskItem.ParentID = m_host.UUID; taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch(); taskItem.Name = asset.Name; taskItem.Description = asset.Description; taskItem.Type = (int)AssetType.Notecard; taskItem.InvType = (int)InventoryType.Notecard; taskItem.OwnerID = m_host.OwnerID; taskItem.CreatorID = m_host.OwnerID; taskItem.BasePermissions = (uint)PermissionMask.All; taskItem.CurrentPermissions = (uint)PermissionMask.All; taskItem.EveryonePermissions = 0; taskItem.NextPermissions = (uint)PermissionMask.All; taskItem.GroupID = m_host.GroupID; taskItem.GroupPermissions = 0; taskItem.Flags = 0; taskItem.PermsGranter = UUID.Zero; taskItem.PermsMask = 0; taskItem.AssetID = asset.FullID; m_host.Inventory.AddInventoryItem(taskItem, false); }
// rex public void rexSetCameraClientSideEffect(string avatar, bool enable, string assetName, int assetType, LSL_Types.Vector3 vPos, LSL_Types.Quaternion vRot) { m_log.Warn("[REXSCRIPT]: rexSetCameraClientSideEffect, could not set camera client side effets. Asset search by name disabled"); //try //{ // UUID tempid = World.AssetCache.ExistsAsset((sbyte)assetType, assetName); // if (tempid != UUID.Zero) // { // rexSetCameraClientSideEffect(avatar, enable, tempid.ToString(), vPos, vRot); // } //} //catch { } }
public double osList2Double(LSL_Types.list src, int index) { // There is really no double type in OSSL. C# and other // have one, but the current implementation of LSL_Types.list // is not allowed to contain any. // This really should be removed. // CheckThreatLevel(ThreatLevel.None, "osList2Double"); m_host.AddScriptLPS(1); if (index < 0) { index = src.Length + index; } if (index >= src.Length) { return 0.0; } return Convert.ToDouble(src.Data[index]); }
// rex public void rexSetClientSideEffect(string assetId, float vTimeUntilLaunch, float vTimeUntilDeath, LSL_Types.Vector3 vPos, LSL_Types.Quaternion vRot, float vSpeed) { 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); World.ForEachScenePresence(delegate(ScenePresence controller) { if (controller.ControllingClient is RexNetwork.RexClientViewBase) { ((RexNetwork.RexClientViewBase)controller.ControllingClient).SendRexClientSideEffect(assetId, vTimeUntilLaunch, vTimeUntilDeath, pos, rot, vSpeed); } }); //World.SendRexClientSideEffectToAll(new UUID(assetId), vTimeUntilLaunch, vTimeUntilDeath, pos, rot, vSpeed); } catch { } }
public void osTeleportAgent(string agent, int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // High because there is no security check. High griefer potential // CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); TeleportAgent(agent, regionGridX, regionGridY, position, lookat, false); }
// rex public void rexSetClientSideEffect(string assetName, int assetType, float vTimeUntilLaunch, float vTimeUntilDeath, LSL_Types.Vector3 vPos, LSL_Types.Quaternion vRot, float vSpeed) { m_log.Warn("[REXSCRIPT]: rexSetCameraClientSideEffect, could not get asset by name. Use method with uuid instead"); //try //{ // UUID tempid = World.AssetCache.ExistsAsset((sbyte)assetType, assetName); // if (tempid != UUID.Zero) // { // rexSetClientSideEffect(tempid.ToString(), vTimeUntilLaunch, vTimeUntilDeath, vPos, vRot, vSpeed); // } //} //catch { } }
public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat); }
// Teleport functions public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // High because there is no security check. High griefer potential // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 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) { // Check for hostname , attempt to make a hglink // and convert the regionName to the target region if (regionName.Contains(".") && regionName.Contains(":")) { List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); // Try to link the region if (regions != null && regions.Count > 0) { GridRegion regInfo = regions[0]; regionName = regInfo.RegionName; } } World.RequestTeleportLocation(presence.ControllingClient, regionName, 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); } } } }
public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { osTeleportOwner(World.RegionInfo.RegionName, position, lookat); }
private void CheckllRot2Euler(LSL_Types.Quaternion rot, LSL_Types.Vector3 eulerCheck) { // Call LSL function to convert quaternion rotaion to euler radians. LSL_Types.Vector3 eulerCalc = m_lslApi.llRot2Euler(rot); // Check upper and lower bounds of x, y and z. // This type of check is performed as opposed to comparing for equal numbers, in order to allow slight // differences in accuracy. Assert.Greater(eulerCalc.x, eulerCheck.x - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X lower bounds check fail"); Assert.Less(eulerCalc.x, eulerCheck.x + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X upper bounds check fail"); Assert.Greater(eulerCalc.y, eulerCheck.y - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y lower bounds check fail"); Assert.Less(eulerCalc.y, eulerCheck.y + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y upper bounds check fail"); Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); }
// private double FromRadians(float radians) // { // return radians * 180 / Math.PI; // } private double FromLslFloat(LSL_Types.LSLFloat lslFloat) { return lslFloat.value; }
// Teleport functions public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // High because there is no security check. High griefer potential // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 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) { // Check for hostname , attempt to make a hglink // and convert the regionName to the target region if (regionName.Contains(".") && regionName.Contains(":")) { // Try to link the region IHyperlinkService hyperService = World.RequestModuleInterface<IHyperlinkService>(); if (hyperService != null) { GridRegion regInfo = hyperService.TryLinkRegion(presence.ControllingClient, regionName); // Get the region name if (regInfo != null) { regionName = regInfo.RegionName; } else { // Might need to ping the client here in case of failure?? } } } presence.ControllingClient.SendTeleportLocationStart(); World.RequestTeleportLocation(presence.ControllingClient, regionName, 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); } } } }
public void CheckllVecNorm(LSL_Types.Vector3 vec, LSL_Types.Vector3 vecNormCheck) { // Call LSL function to normalize the vector. LSL_Types.Vector3 vecNorm = m_lslApi.llVecNorm(vec); // Check each vector component against expected result. Assert.AreEqual(vecNorm.x, vecNormCheck.x, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on x component"); Assert.AreEqual(vecNorm.y, vecNormCheck.y, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on y component"); Assert.AreEqual(vecNorm.z, vecNormCheck.z, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on z component"); }
// Set prim params for a torus, tube or ring and check results. public void CheckllSetPrimitiveParams(LSL_Api api, string primTest, LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, float primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, float primRev, float primRadius, float primSkew, float primHollowCheck) { // Set the prim params. api.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, ScriptBaseClass.PRIM_TYPE, primType, primHoleType, primCut, primHollow, primTwist, primHoleSize, primShear, primProfCut, primTaper, primRev, primRadius, primSkew)); // Get params for prim to validate settings. LSL_Types.list primParams = api.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); // Valdate 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(primHoleType, api.llList2Integer(primParams, 2), "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); CheckllSetPrimitiveParamsVector(primCut, api.llList2Vector(primParams, 3), primTest + " prim cut"); Assert.AreEqual(primHollowCheck, api.llList2Float(primParams, 4), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); CheckllSetPrimitiveParamsVector(primTwist, api.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primHoleSize, api.llList2Vector(primParams, 6), primTest + " prim hole size"); CheckllSetPrimitiveParamsVector(primShear, api.llList2Vector(primParams, 7), primTest + " prim shear"); CheckllSetPrimitiveParamsVector(primProfCut, api.llList2Vector(primParams, 8), primTest + " prim profile cut"); CheckllSetPrimitiveParamsVector(primTaper, api.llList2Vector(primParams, 9), primTest + " prim taper"); Assert.AreEqual(primRev, api.llList2Float(primParams, 10), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim revolutions fail"); Assert.AreEqual(primRadius, api.llList2Float(primParams, 11), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim radius fail"); Assert.AreEqual(primSkew, api.llList2Float(primParams, 12), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim skew fail"); }