public void llPursue(LSL_String target, LSL_List options) { IBotManager botManager = World.RequestModuleInterface <IBotManager>(); if (botManager != null) { float fuzz = 2; Vector3 offset = Vector3.Zero; bool requireLOS = false; // 20131224 not used bool intercept; = false; //Not implemented for (int i = 0; i < options.Length; i += 2) { LSL_Integer opt = options.GetLSLIntegerItem(i); if (opt == ScriptBaseClass.PURSUIT_FUZZ_FACTOR) { fuzz = (float)options.GetLSLFloatItem(i + 1).value; } if (opt == ScriptBaseClass.PURSUIT_OFFSET) { offset = options.GetVector3Item(i + 1).ToVector3(); } if (opt == ScriptBaseClass.REQUIRE_LINE_OF_SIGHT) { requireLOS = options.GetLSLIntegerItem(i + 1) == 1; } // 20131224 not used if (opt == ScriptBaseClass.PURSUIT_INTERCEPT) // 20131224 not used intercept = options.GetLSLIntegerItem(i + 1) == 1; } botManager.FollowAvatar(m_host.ParentEntity.UUID, target.m_string, fuzz, fuzz, requireLOS, offset, m_host.ParentEntity.OwnerID); } }
public void botSetMap(string keyOfBot, LSL_List positions, LSL_List movementType, LSL_Integer flags) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSetMap", m_host, "bot", m_itemID)) { return; } List <Vector3> PositionsMap = new List <Vector3>(); for (int i = 0; i < positions.Length; i++) { LSL_Vector pos = positions.GetVector3Item(i); PositionsMap.Add(new Vector3((float)pos.x, (float)pos.y, (float)pos.z)); } List <TravelMode> TravelMap = new List <TravelMode>(); for (int i = 0; i < movementType.Length; i++) { LSL_Integer travel = movementType.GetLSLIntegerItem(i); TravelMap.Add((TravelMode)travel.value); } IBotManager manager = World.RequestModuleInterface <IBotManager>(); if (manager != null) { manager.SetBotMap(UUID.Parse(keyOfBot), PositionsMap, TravelMap, flags.value, m_host.OwnerID); } }
public void llSetKeyframedMotion(LSL_List keyframes, LSL_List options) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return; } if (!m_host.IsRoot) { Error("llSetKeyframedMotion", "Must be used in the root object!"); return; } KeyframeAnimation.Data dataType = KeyframeAnimation.Data.Both; KeyframeAnimation.Modes currentMode = KeyframeAnimation.Modes.Forward; for (int i = 0; i < options.Length; i += 2) { LSL_Integer option = options.GetLSLIntegerItem(i); LSL_Integer value = options.GetLSLIntegerItem(i + 1); if (option == ScriptBaseClass.KFM_COMMAND) { m_host.ParentEntity.AddKeyframedMotion(null, (KeyframeAnimation.Commands)value.value); break; //Its supposed to be the only option in the list } if (option == ScriptBaseClass.KFM_MODE) { currentMode = (KeyframeAnimation.Modes)value.value; } else if (option == ScriptBaseClass.KFM_DATA) { dataType = (KeyframeAnimation.Data)value.value; } } List <Vector3> positions = new List <Vector3>(); List <Quaternion> rotations = new List <Quaternion>(); List <float> times = new List <float>(); for (int i = 0; i < keyframes.Length; i += (dataType == KeyframeAnimation.Data.Both ? 3 : 2)) { if (dataType == KeyframeAnimation.Data.Both || dataType == KeyframeAnimation.Data.Translation) { LSL_Vector pos = keyframes.GetVector3Item(i); positions.Add(pos.ToVector3()); } if (dataType == KeyframeAnimation.Data.Both || dataType == KeyframeAnimation.Data.Rotation) { LSL_Rotation rot = keyframes.GetQuaternionItem(i + (dataType == KeyframeAnimation.Data.Both ? 1 : 0)); Quaternion quat = rot.ToQuaternion(); quat.Normalize(); rotations.Add(quat); } LSL_Float time = keyframes.GetLSLFloatItem(i + (dataType == KeyframeAnimation.Data.Both ? 2 : 1)); times.Add((float)time); } KeyframeAnimation animation = new KeyframeAnimation { CurrentMode = currentMode, PositionList = positions.ToArray(), RotationList = rotations.ToArray(), TimeList = times.ToArray(), CurrentAnimationPosition = 0, InitialPosition = m_host.AbsolutePosition, InitialRotation = m_host.GetRotationOffset() }; m_host.ParentEntity.AddKeyframedMotion(animation, KeyframeAnimation.Commands.Play); }