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 LSL_Integer llSetMemoryLimit(LSL_Integer limit) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return(new LSL_Integer()); } // Make scripts designed for Mono happy return(65536); }
public LSL_Integer llClearPrimMedia(LSL_Integer face) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return(0); } PScriptSleep(m_sleepMsOnClearPrimMedia); ClearPrimMedia(m_host, face); return(ScriptBaseClass.STATUS_OK); }
public LSL_String llTransferLindenDollars(LSL_String destination, LSL_Integer amt) { LSL_String transferID = UUID.Random().ToString(); IMoneyModule moneyMod = World.RequestModuleInterface <IMoneyModule>(); LSL_String data = ""; LSL_Integer success = LSL_Integer.FALSE; TaskInventoryItem item = m_host.TaskInventory[m_itemID]; UUID destID; if (item.PermsGranter == UUID.Zero || (item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) { data = llList2CSV(new LSL_List("MISSING_PERMISSION_DEBIT")); } else if (!UUID.TryParse(destination, out destID)) { data = llList2CSV(new LSL_List("INVALID_AGENT")); } else if (amt <= 0) { data = llList2CSV(new LSL_List("INVALID_AMOUNT")); } else if (!World.UserAccountService.GetUserAccount(World.RegionInfo.AllScopeIDs, destID).Valid) { data = llList2CSV(new LSL_List("LINDENDOLLAR_ENTITYDOESNOTEXIST")); } else if (m_host.ParentEntity.OwnerID == m_host.ParentEntity.GroupID) { data = llList2CSV(new LSL_List("GROUP_OWNED")); } else if (moneyMod != null) { success = moneyMod.Transfer(UUID.Parse(destination), m_host.OwnerID, amt, "", TransactionType.ObjectPays); data = llList2CSV(success ? new LSL_List(destination, amt) : new LSL_List("LINDENDOLLAR_INSUFFICIENTFUNDS")); } else { data = llList2CSV(new LSL_List("SERVICE_ERROR")); } m_ScriptEngine.PostScriptEvent( m_itemID, m_host.UUID, new EventParams("transaction_result", new object[] { transferID, success, data }, new DetectParams[0]), EventPriority.FirstStart ); return(transferID); }
public void llSetPhysicsMaterial(LSL_Integer bits, LSL_Float density, LSL_Float friction, LSL_Float restitution, LSL_Float gravityMultiplier) { ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = new ObjectFlagUpdatePacket.ExtraPhysicsBlock[1]; blocks[0] = new ObjectFlagUpdatePacket.ExtraPhysicsBlock(); if ((bits & ScriptBaseClass.DENSITY) == ScriptBaseClass.DENSITY) { m_host.Density = (float)density; } else { blocks[0].Density = m_host.Density; } if ((bits & ScriptBaseClass.FRICTION) == ScriptBaseClass.FRICTION) { m_host.Friction = (float)friction; } else { blocks[0].Friction = m_host.Friction; } if ((bits & ScriptBaseClass.RESTITUTION) == ScriptBaseClass.RESTITUTION) { m_host.Restitution = (float)restitution; } else { blocks[0].Restitution = m_host.Restitution; } if ((bits & ScriptBaseClass.GRAVITY_MULTIPLIER) == ScriptBaseClass.GRAVITY_MULTIPLIER) { m_host.GravityMultiplier = (float)gravityMultiplier; } else { blocks[0].GravityMultiplier = m_host.GravityMultiplier; } bool UsePhysics = ((m_host.Flags & PrimFlags.Physics) != 0); bool IsTemporary = ((m_host.Flags & PrimFlags.TemporaryOnRez) != 0); bool IsPhantom = ((m_host.Flags & PrimFlags.Phantom) != 0); bool IsVolumeDetect = m_host.VolumeDetectActive; blocks[0].PhysicsShapeType = m_host.PhysicsType; if (m_host.UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect, blocks)) { m_host.ParentEntity.RebuildPhysicalRepresentation(true, null); } }
public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) { PScriptSleep(m_sleepMsOnSetPrimMediaParams); // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid // Assuming silently fail means sending back STATUS_OK. Ideally, need to check this. // Don't perform the media check directly if (face < 0 || face > m_host.GetNumberOfSides() - 1) { return(ScriptBaseClass.STATUS_OK); } return(SetPrimMediaParams(m_host, face, rules)); }
public void llSetContentType(LSL_Key id, LSL_Integer type) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return; } string content_type = "text/plain"; if (type == ScriptBaseClass.CONTENT_TYPE_HTML) { content_type = "text/html"; } else if (type == ScriptBaseClass.CONTENT_TYPE_XML) { content_type = "application/xml"; } else if (type == ScriptBaseClass.CONTENT_TYPE_XHTML) { content_type = "application/xhtml+xml"; } else if (type == ScriptBaseClass.CONTENT_TYPE_ATOM) { content_type = "application/atom+xml"; } else if (type == ScriptBaseClass.CONTENT_TYPE_JSON) { content_type = "application/json"; } else if (type == ScriptBaseClass.CONTENT_TYPE_LLSD) { content_type = "application/llsd+xml"; } else if (type == ScriptBaseClass.CONTENT_TYPE_FORM) { content_type = "application/x-www-form-urlencoded"; } else if (type == ScriptBaseClass.CONTENT_TYPE_RSS) { content_type = "application/rss+xml"; } else { content_type = "text/plain"; } if (m_UrlModule != null) { m_UrlModule.SetContentType(id, content_type); } }
// 04122016 Fly-Man- // This function is unknown on the SL Wiki public void llLinkLookAt(LSL_Integer link, LSL_Vector target, double strength, double damping) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return; } List <ISceneChildEntity> parts = GetLinkParts(link); foreach (ISceneChildEntity part in parts) { LookAt(target, strength, damping, part); } }
public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return; } List <ISceneChildEntity> entities = GetLinkParts(link); if (entities.Count > 0) { entities[0].CameraEyeOffset = new Vector3((float)eye.x, (float)eye.y, (float)eye.z); entities[0].CameraAtOffset = new Vector3((float)at.x, (float)at.y, (float)at.z); } }
// 04122016 Fly-Man- // This function is unknown on the SL Wiki public void llLinkRotLookAt(LSL_Integer link, LSL_Rotation target, double strength, double damping) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return; } Quaternion rot = new Quaternion((float)target.x, (float)target.y, (float)target.z, (float)target.s); List <ISceneChildEntity> parts = GetLinkParts(link); foreach (ISceneChildEntity part in parts) { part.RotLookAt(rot, (float)strength, (float)damping); } }
public LSL_Integer llManageEstateAccess(LSL_Integer action, LSL_String avatar) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return(LSL_Integer.FALSE); } if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false)) { if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_ADD) { World.RegionInfo.EstateSettings.AddEstateUser(UUID.Parse(avatar)); } else if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_REMOVE) { World.RegionInfo.EstateSettings.RemoveEstateUser(UUID.Parse(avatar)); } else if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_ADD) { World.RegionInfo.EstateSettings.AddEstateGroup(UUID.Parse(avatar)); } else if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_REMOVE) { World.RegionInfo.EstateSettings.RemoveEstateGroup(UUID.Parse(avatar)); } else if (action == ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_ADD) { World.RegionInfo.EstateSettings.AddBan(new EstateBan { EstateID = World.RegionInfo.EstateSettings.EstateID, BannedUserID = UUID.Parse(avatar) }); } else if (action == ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_REMOVE) { World.RegionInfo.EstateSettings.RemoveBan(UUID.Parse(avatar)); } return(LSL_Integer.TRUE); } else { Error("llManageEstateAccess", "llManageEstateAccess object owner must manage estate."); } return(LSL_Integer.FALSE); }
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) { //PScriptSleep(m_sleepMsOnSetLinkMedia); // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid // Assuming silently fail means sending back STATUS_OK. Ideally, need to check this. // Don't perform the media check directly List <ISceneChildEntity> entities = GetLinkParts(link); if (entities.Count == 0 || face < 0 || face > entities[0].GetNumberOfSides() - 1) { return(ScriptBaseClass.STATUS_OK); } foreach (ISceneChildEntity child in entities) { SetPrimMediaParams(child, face, rules); } return(ScriptBaseClass.STATUS_OK); }
public void llExecCharacterCmd(LSL_Integer command, LSL_List options) { IBotManager botManager = World.RequestModuleInterface <IBotManager>(); if (botManager != null) { IBotController controller = botManager.GetCharacterManager(m_host.ParentEntity.UUID); if (controller != null) { if (command == ScriptBaseClass.CHARACTER_CMD_JUMP) { controller.Jump(); } if (command == ScriptBaseClass.CHARACTER_CMD_STOP) { controller.StopMoving(false, true); } } } }
public LSL_Key llAvatarOnLinkSitTarget(LSL_Integer link) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return(ScriptBaseClass.NULL_KEY); } if (link == ScriptBaseClass.LINK_SET || link == ScriptBaseClass.LINK_ALL_CHILDREN || link == ScriptBaseClass.LINK_ALL_OTHERS || link == 0) { return(ScriptBaseClass.NULL_KEY); } var entities = GetLinkParts(link); return(entities.Count == 0 ? ScriptBaseClass.NULL_KEY : new LSL_String(entities[0].SitTargetAvatar.ToString())); }
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return(0); } //PScriptSleep(m_sleepMsOnClearLinkMedia); List <ISceneChildEntity> entities = GetLinkParts(link); if (entities.Count == 0 || face < 0 || face > entities[0].GetNumberOfSides() - 1) { return(ScriptBaseClass.STATUS_OK); } foreach (ISceneChildEntity child in entities) { ClearPrimMedia(child, face); } return(ScriptBaseClass.STATUS_OK); }
public void llSetAngularVelocity(LSL_Vector force, LSL_Integer local) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return; } Vector3 rotvelocity = new Vector3((float)force.x, (float)force.y, (float)force.z); if (local == 1) { Quaternion grot = m_host.GetWorldRotation(); Quaternion AXgrot = grot; Vector3 AXimpulsei = rotvelocity; Vector3 newimpulse = AXimpulsei * AXgrot; rotvelocity = newimpulse; } if (m_host.ParentEntity.RootChild.PhysActor != null) { m_host.ParentEntity.RootChild.PhysActor.RotationalVelocity = rotvelocity; } }
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return; } if (link == ScriptBaseClass.LINK_ROOT) { SitTarget(m_host.ParentEntity.RootChild, offset, rot); } else if (link == ScriptBaseClass.LINK_THIS) { SitTarget(m_host, offset, rot); } else { var entity = m_host.ParentEntity.GetLinkNumPart(link); if (entity != null) { SitTarget((ISceneChildEntity)entity, offset, rot); } } }
public LSL_Integer llClearPrimMedia(LSL_Integer face) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return 0; PScriptSleep(m_sleepMsOnClearPrimMedia); ClearPrimMedia(m_host, face); return ScriptBaseClass.STATUS_OK; }
public void llUpdateCharacter(LSL_List options) { IBotManager botManager = World.RequestModuleInterface <IBotManager>(); if (botManager != null) { IBotController controller = botManager.GetCharacterManager(m_host.ParentEntity.UUID); if (controller == null) { return; // nothing to controll :( } for (int i = 0; i < options.Length; i += 2) { LSL_Integer opt = options.GetLSLIntegerItem(i); LSL_Float value = options.GetLSLFloatItem(i + 1); if (opt == ScriptBaseClass.CHARACTER_DESIRED_SPEED) { controller.SetSpeedModifier((float)value.value); } else if (opt == ScriptBaseClass.CHARACTER_RADIUS) { } else if (opt == ScriptBaseClass.CHARACTER_LENGTH) { } else if (opt == ScriptBaseClass.CHARACTER_ORIENTATION) { } else if (opt == ScriptBaseClass.CHARACTER_AVOIDANCE_MODE) { } else if (opt == ScriptBaseClass.CHARACTER_TYPE) { } else if (opt == ScriptBaseClass.TRAVERSAL_TYPE) { } else if (opt == ScriptBaseClass.CHARACTER_MAX_ACCEL) { } else if (opt == ScriptBaseClass.CHARACTER_MAX_DECEL) { } else if (opt == ScriptBaseClass.CHARACTER_MAX_TURN_RADIUS) { } else if (opt == ScriptBaseClass.CHARACTER_DESIRED_TURN_SPEED) { } else if (opt == ScriptBaseClass.CHARACTER_MAX_SPEED) { } else if (opt == ScriptBaseClass.CHARACTER_ACCOUNT_FOR_SKIPPED_FRAMES) { } else if (opt == ScriptBaseClass.CHARACTER_STAY_WITHIN_PARCEL) { } } } }
public LSL_Key llUpdateKeyValue(LSL_Key key, LSL_String value, LSL_Integer check, LSL_String original_value) { NotImplemented("llUpdateKeyValue", "Not implemented at this moment"); return(UUID.Zero.ToString()); }
public LSL_Key llKeysKeyValue(LSL_Integer first, LSL_Integer count) { NotImplemented("llKeysKeyValue", "Not implemented at this moment"); return(UUID.Zero.ToString()); }
public void llSetPhysicsMaterial(LSL_Integer bits, LSL_Float density, LSL_Float friction, LSL_Float restitution, LSL_Float gravityMultiplier) { ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = new ObjectFlagUpdatePacket.ExtraPhysicsBlock[1]; blocks[0] = new ObjectFlagUpdatePacket.ExtraPhysicsBlock(); if ((bits & ScriptBaseClass.DENSITY) == ScriptBaseClass.DENSITY) m_host.Density = (float)density; else blocks[0].Density = m_host.Density; if ((bits & ScriptBaseClass.FRICTION) == ScriptBaseClass.FRICTION) m_host.Friction = (float)friction; else blocks[0].Friction = m_host.Friction; if ((bits & ScriptBaseClass.RESTITUTION) == ScriptBaseClass.RESTITUTION) m_host.Restitution = (float)restitution; else blocks[0].Restitution = m_host.Restitution; if ((bits & ScriptBaseClass.GRAVITY_MULTIPLIER) == ScriptBaseClass.GRAVITY_MULTIPLIER) m_host.GravityMultiplier = (float)gravityMultiplier; else blocks[0].GravityMultiplier = m_host.GravityMultiplier; bool UsePhysics = ((m_host.Flags & PrimFlags.Physics) != 0); bool IsTemporary = ((m_host.Flags & PrimFlags.TemporaryOnRez) != 0); bool IsPhantom = ((m_host.Flags & PrimFlags.Phantom) != 0); bool IsVolumeDetect = m_host.VolumeDetectActive; blocks[0].PhysicsShapeType = m_host.PhysicsType; if (m_host.UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect, blocks)) m_host.ParentEntity.RebuildPhysicalRepresentation(true, null); }
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 llScriptProfiler(LSL_Integer profilerFlags) { //TODO: We don't support this, notted }
public LSL_Integer llReturnObjectsByOwner(LSL_Key owner, LSL_Integer scope) { NotImplemented("llReturnObjectsByOwner", "Not implemented at this moment"); return 0; }
public LSL_Float llGetSimStats(LSL_Integer statType) { LSL_Float retVal = 0; if (statType == ScriptBaseClass.SIM_STAT_PCT_CHARS_STEPPED) { //TODO: Not implemented retVal = 0; } return retVal; }
public void llExecCharacterCmd(LSL_Integer command, LSL_List options) { IBotManager botManager = World.RequestModuleInterface<IBotManager>(); if (botManager != null) { IBotController controller = botManager.GetCharacterManager(m_host.ParentEntity.UUID); if (controller != null) { if (command == ScriptBaseClass.CHARACTER_CMD_JUMP) controller.Jump (); if (command == ScriptBaseClass.CHARACTER_CMD_STOP) controller.StopMoving (false, true); } } }
public LSL_String llTransferLindenDollars(LSL_String destination, LSL_Integer amt) { LSL_String transferID = UUID.Random().ToString(); IMoneyModule moneyMod = World.RequestModuleInterface<IMoneyModule>(); LSL_String data = ""; LSL_Integer success = LSL_Integer.FALSE; TaskInventoryItem item = m_host.TaskInventory[m_itemID]; UUID destID; if (item.PermsGranter == UUID.Zero || (item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) data = llList2CSV(new LSL_List ("MISSING_PERMISSION_DEBIT")); else if (!UUID.TryParse(destination, out destID)) data = llList2CSV(new LSL_List("INVALID_AGENT")); else if (amt <= 0) data = llList2CSV(new LSL_List("INVALID_AMOUNT")); else if (World.UserAccountService.GetUserAccount(World.RegionInfo.AllScopeIDs, destID) == null) data = llList2CSV(new LSL_List ("LINDENDOLLAR_ENTITYDOESNOTEXIST")); else if (m_host.ParentEntity.OwnerID == m_host.ParentEntity.GroupID) data = llList2CSV(new LSL_List ("GROUP_OWNED")); else if (moneyMod != null) { success = moneyMod.Transfer(UUID.Parse(destination), m_host.OwnerID, amt, "", TransactionType.ObjectPays); data = llList2CSV(success ? new LSL_List(destination, amt) : new LSL_List ("LINDENDOLLAR_INSUFFICIENTFUNDS")); } else data = llList2CSV(new LSL_List ("SERVICE_ERROR")); m_ScriptEngine.PostScriptEvent( m_itemID, m_host.UUID, new EventParams("transaction_result", new object[]{transferID, success,data}, new DetectParams[0]), EventPriority.FirstStart ); return transferID; }
public LSL_Integer llManageEstateAccess(LSL_Integer action, LSL_String avatar) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return LSL_Integer.FALSE; if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false)) { if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_ADD) World.RegionInfo.EstateSettings.AddEstateUser(UUID.Parse(avatar)); else if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_REMOVE) World.RegionInfo.EstateSettings.RemoveEstateUser(UUID.Parse(avatar)); else if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_ADD) World.RegionInfo.EstateSettings.AddEstateGroup(UUID.Parse(avatar)); else if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_REMOVE) World.RegionInfo.EstateSettings.RemoveEstateGroup(UUID.Parse(avatar)); else if (action == ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_ADD) World.RegionInfo.EstateSettings.AddBan(new EstateBan { EstateID = World.RegionInfo.EstateSettings.EstateID, BannedUserID = UUID.Parse(avatar) }); else if (action == ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_REMOVE) World.RegionInfo.EstateSettings.RemoveBan(UUID.Parse(avatar)); return LSL_Integer.TRUE; } else Error("llManageEstateAccess", "llManageEstateAccess object owner must manage estate."); return LSL_Integer.FALSE; }
public void llSetContentType(LSL_Key id, LSL_Integer type) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; string content_type = "text/plain"; if (type == ScriptBaseClass.CONTENT_TYPE_HTML) content_type = "text/html"; else if (type == ScriptBaseClass.CONTENT_TYPE_XML) content_type = "application/xml"; else if (type == ScriptBaseClass.CONTENT_TYPE_XHTML) content_type = "application/xhtml+xml"; else if (type == ScriptBaseClass.CONTENT_TYPE_ATOM) content_type = "application/atom+xml"; else if (type == ScriptBaseClass.CONTENT_TYPE_JSON) content_type = "application/json"; else if (type == ScriptBaseClass.CONTENT_TYPE_LLSD) content_type = "application/llsd+xml"; else if (type == ScriptBaseClass.CONTENT_TYPE_FORM) content_type = "application/x-www-form-urlencoded"; else if (type == ScriptBaseClass.CONTENT_TYPE_RSS) content_type = "application/rss+xml"; else content_type = "text/plain"; if (m_UrlModule != null) m_UrlModule.SetContentType(id, content_type); }
public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_List(); //PScriptSleep(m_sleepMsOnGetLinkMedia); List<ISceneChildEntity> entities = GetLinkParts(link); if (entities.Count == 0 || face < 0 || face > entities[0].GetNumberOfSides() - 1) return new LSL_List(); LSL_List res = new LSL_List(); return entities.Select(part => GetPrimMediaParams(part, face, rules)).Aggregate(res, (current, partRes) => current + partRes); }
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); }
public LSL_String llGetExperienceErrorMessage(LSL_Integer value) { NotImplemented("llGetExperienceDetails", "Not implemented at this moment"); return String.Empty; }
public LSL_Key llKeysKeyValue(LSL_Integer first, LSL_Integer count) { NotImplemented("llKeysKeyValue", "Not implemented at this moment"); return UUID.Zero.ToString(); }
public LSL_Integer llSitOnLink( LSL_Key agent_id, LSL_Integer link ) { NotImplemented("llSitOnLink", "Not implemented at this moment"); return 0; }
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) { //PScriptSleep(m_sleepMsOnSetLinkMedia); // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid // Assuming silently fail means sending back STATUS_OK. Ideally, need to check this. // Don't perform the media check directly List<ISceneChildEntity> entities = GetLinkParts(link); if (entities.Count == 0 || face < 0 || face > entities[0].GetNumberOfSides() - 1) return ScriptBaseClass.STATUS_OK; foreach (ISceneChildEntity child in entities) SetPrimMediaParams(child, face, rules); return ScriptBaseClass.STATUS_OK; }
public LSL_Key llUpdateKeyValue( LSL_Key key, LSL_String value, LSL_Integer check, LSL_String original_value ) { NotImplemented("llUpdateKeyValue", "Not implemented at this moment"); return UUID.Zero.ToString(); }
public LSL_String llGetExperienceErrorMessage(LSL_Integer value) { NotImplemented("llGetExperienceDetails", "Not implemented at this moment"); return(String.Empty); }
private void ClearPrimMedia(ISceneChildEntity entity, LSL_Integer face) { // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid // Assuming silently fail means sending back STATUS_OK. Ideally, need to check this. // FIXME: Don't perform the media check directly if (face < 0 || face > entity.GetNumberOfSides() - 1) return; IMoapModule module = World.RequestModuleInterface<IMoapModule>(); if (null == module) throw new Exception("Media on a prim functions not available"); module.ClearMediaEntry(entity, face); }
public LSL_Integer llSitOnLink(LSL_Key agent_id, LSL_Integer link) { NotImplemented("llSitOnLink", "Not implemented at this moment"); return(0); }
// 04122016 Fly-Man- // This function is unknown on the SL Wiki public void llLinkLookAt(LSL_Integer link, LSL_Vector target, double strength, double damping) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; List<ISceneChildEntity> parts = GetLinkParts(link); foreach (ISceneChildEntity part in parts) LookAt(target, strength, damping, part); }
public LSL_Integer llReturnObjectsByOwner(LSL_Key owner, LSL_Integer scope) { NotImplemented("llReturnObjectsByOwner", "Not implemented at this moment"); return(0); }
// 04122016 Fly-Man- // This function is unknown on the SL Wiki public void llLinkRotLookAt(LSL_Integer link, LSL_Rotation target, double strength, double damping) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; Quaternion rot = new Quaternion((float)target.x, (float)target.y, (float)target.z, (float)target.s); List<ISceneChildEntity> parts = GetLinkParts(link); foreach (ISceneChildEntity part in parts) part.RotLookAt(rot, (float)strength, (float)damping); }
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return 0; //PScriptSleep(m_sleepMsOnClearLinkMedia); List<ISceneChildEntity> entities = GetLinkParts(link); if (entities.Count == 0 || face < 0 || face > entities[0].GetNumberOfSides() - 1) return ScriptBaseClass.STATUS_OK; foreach (ISceneChildEntity child in entities) ClearPrimMedia(child, face); return ScriptBaseClass.STATUS_OK; }
/// <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 && FloatAlmostEqual(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; }
public void aaAllRegionInstanceSay(LSL_Integer channelID, string text) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "AAAllRegionInstanceSay", m_host, "AA", m_itemID)) return; if (text.Length > 1023) text = text.Substring(0, 1023); IChatModule chatModule = World.RequestModuleInterface<IChatModule>(); if (chatModule != null) chatModule.SimChat(text, ChatTypeEnum.Region, channelID, m_host.ParentEntity.RootChild.AbsolutePosition, m_host.Name, m_host.UUID, false, World); var comms = m_host.ParentEntity.Scene.RequestModuleInterface<IWorldComm>(); comms.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text); }
public LSL_Integer llSetMemoryLimit(LSL_Integer limit) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_Integer(); // Make scripts designed for Mono happy return 65536; }
public LSL_List llGetPrimMediaParams(LSL_Integer face, LSL_List rules) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_List(); PScriptSleep(m_sleepMsOnGetPrimMediaParams); // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). // Assuming silently fail means give back an empty list. Ideally, need to check this. if (face < 0 || face > m_host.GetNumberOfSides() - 1) return new LSL_List(); return GetPrimMediaParams(m_host, face, rules); }
public void llScriptProfiler(LSL_Integer profilerFlags) { //TODO: We don't support this, not implemented }
public LSL_List llParcelMediaQuery(LSL_List aList) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return(new LSL_List()); } LSL_List list = new LSL_List(); foreach (object t in aList.Data) { if (t != null) { IParcelManagementModule parcelManagement = World.RequestModuleInterface <IParcelManagementModule>(); if (parcelManagement != null) { LSL_Integer tmp = (LSL_Integer)t; switch ((ParcelMediaCommandEnum)tmp.value) { case ParcelMediaCommandEnum.Url: list.Add( new LSL_String( parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData.MediaURL)); break; case ParcelMediaCommandEnum.Desc: list.Add( new LSL_String( parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y) .LandData.MediaDescription)); break; case ParcelMediaCommandEnum.Texture: list.Add( new LSL_String( parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y) .LandData.MediaID.ToString())); break; case ParcelMediaCommandEnum.Type: list.Add( new LSL_String( parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData.MediaType)); break; case ParcelMediaCommandEnum.Loop: list.Add( new LSL_Integer( parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData.MediaLoop ? 1 : 0)); break; case ParcelMediaCommandEnum.LoopSet: list.Add( new LSL_Integer( parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData.MediaLoopSet)); break; case ParcelMediaCommandEnum.Size: list.Add( new LSL_String( parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData.MediaHeight)); list.Add( new LSL_String( parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData.MediaWidth)); break; default: const ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; NotImplemented("llParcelMediaQuery", "Parameter not supported yet: " + Enum.Parse(mediaCommandEnum.GetType(), t.ToString())); break; } } } } PScriptSleep(m_sleepMsOnParcelMediaQuery); return(list); }
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; if (link == ScriptBaseClass.LINK_ROOT) SitTarget (m_host.ParentEntity.RootChild, offset, rot); else if (link == ScriptBaseClass.LINK_THIS) SitTarget (m_host, offset, rot); else { var entity = m_host.ParentEntity.GetLinkNumPart (link); if (entity != null) { SitTarget ((ISceneChildEntity) entity, offset, rot); } } }
public LSL_Vector botGetWaitingTime(LSL_Integer waitTime) { return(new LSL_Vector(waitTime, 0, 0)); }
public LSL_Key llAvatarOnLinkSitTarget(LSL_Integer link) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return ScriptBaseClass.NULL_KEY; if (link == ScriptBaseClass.LINK_SET || link == ScriptBaseClass.LINK_ALL_CHILDREN || link == ScriptBaseClass.LINK_ALL_OTHERS || link == 0) return ScriptBaseClass.NULL_KEY; var entities = GetLinkParts (link); return entities.Count == 0 ? ScriptBaseClass.NULL_KEY : new LSL_String (entities [0].SitTargetAvatar.ToString ()); }
public LSL_Vector botGetWaitingTime(LSL_Integer waitTime) { return new LSL_Vector(waitTime, 0, 0); }
public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; List<ISceneChildEntity> entities = GetLinkParts(link); if (entities.Count > 0) { entities[0].CameraEyeOffset = new Vector3((float)eye.x, (float)eye.y, (float)eye.z); entities[0].CameraAtOffset = new Vector3((float)at.x, (float)at.y, (float)at.z); } }
public void llSetAngularVelocity(LSL_Vector force, LSL_Integer local) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; Vector3 rotvelocity = new Vector3((float)force.x, (float)force.y, (float)force.z); if (local == 1) { Quaternion grot = m_host.GetWorldRotation(); Quaternion AXgrot = grot; Vector3 AXimpulsei = rotvelocity; Vector3 newimpulse = AXimpulsei * AXgrot; rotvelocity = newimpulse; } if (m_host.ParentEntity.RootChild.PhysActor != null) m_host.ParentEntity.RootChild.PhysActor.RotationalVelocity = rotvelocity; }
public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) { PScriptSleep(m_sleepMsOnSetPrimMediaParams); // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid // Assuming silently fail means sending back STATUS_OK. Ideally, need to check this. // Don't perform the media check directly if (face < 0 || face > m_host.GetNumberOfSides() - 1) return ScriptBaseClass.STATUS_OK; return SetPrimMediaParams(m_host, face, rules); }