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 osCauseDamage(string avatar, double damage, string regionName, LSL_Vector position, LSL_Vector lookat) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osCauseDamage", m_host, "OSSL", m_itemID)) return; UUID avatarId = new UUID(avatar); Vector3 pos = m_host.GetWorldPosition(); IScenePresence presence = World.GetScenePresence(avatarId); if (presence != null) { IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>(); if (parcelManagement != null) { LandData land = parcelManagement.GetLandObject(pos.X, pos.Y).LandData; if ((land.Flags & (uint) ParcelFlags.AllowDamage) == (uint) ParcelFlags.AllowDamage) { ICombatPresence cp = presence.RequestModuleInterface<ICombatPresence>(); cp.IncurDamage(World.GetScenePresence(m_host.OwnerID), damage, regionName, new Vector3((float) position.x, (float) position.y, (float) position.z), new Vector3((float) lookat.x, (float) lookat.y, (float) lookat.z)); } } } }
public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt", m_host, "OSSL", m_itemID)) return; DropAttachmentAt(false, pos, rot); }
public DateTime osTeleportOwner(string regionName, LSL_Vector position, LSL_Vector lookat) { // Threat level None because this is what can already be done with the World Map in the viewer if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "osTeleportOwner", m_host, "OSSL", m_itemID)) return DateTime.Now; List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.AllScopeIDs, regionName, 0, 1); // Try to link the region if (regions != null && regions.Count > 0) { GridRegion regInfo = regions[0]; ulong regionHandle = regInfo.RegionHandle; return TeleportAgent(m_host.OwnerID, regionHandle, new Vector3((float) position.x, (float) position.y, (float) position.z), new Vector3((float) lookat.x, (float) lookat.y, (float) lookat.z)); } return DateTime.Now; }
public DateTime osTeleportOwner(int regionX, int regionY, LSL_Vector position, LSL_Vector lookat) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "osTeleportOwner", m_host, "OSSL", m_itemID)) return DateTime.Now; GridRegion regInfo = World.GridService.GetRegionByPosition(World.RegionInfo.AllScopeIDs, (regionX*Constants.RegionSize), (regionY*Constants.RegionSize)); // Try to link the region if (regInfo != null) { ulong regionHandle = regInfo.RegionHandle; return TeleportAgent(m_host.OwnerID, regionHandle, new Vector3((float) position.x, (float) position.y, (float) position.z), new Vector3((float) lookat.x, (float) lookat.y, (float) lookat.z)); } return DateTime.Now; }
public void osSetParcelDetails(LSL_Vector pos, LSL_List rules) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osSetParcelDetails", m_host, "OSSL", m_itemID)) return; // Get a reference to the land data and make sure the owner of the script // can modify it IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>(); if (parcelManagement != null) { ILandObject startLandObject = parcelManagement.GetLandObject((int) pos.x, (int) pos.y); if (startLandObject == null) { OSSLShoutError("There is no land at that location"); return; } if (!World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject)) { OSSLShoutError("You do not have permission to modify the parcel"); return; } // Create a new land data object we can modify // Process the rules, not sure what the impact would be of changing owner or group for (int idx = 0; idx < rules.Length;) { int code = rules.GetLSLIntegerItem(idx++); string arg = rules.GetLSLStringItem(idx++); UUID uuid; switch (code) { case 0: startLandObject.LandData.Name = arg; break; case 1: startLandObject.LandData.Description = arg; break; case 2: if ( !ScriptProtection.CheckThreatLevel(ThreatLevel.VeryHigh, "osSetParcelDetails", m_host, "OSSL", m_itemID)) return; if (UUID.TryParse(arg, out uuid)) startLandObject.LandData.OwnerID = uuid; break; case 3: if ( !ScriptProtection.CheckThreatLevel(ThreatLevel.VeryHigh, "osSetParcelDetails", m_host, "OSSL", m_itemID)) return; if (UUID.TryParse(arg, out uuid)) startLandObject.LandData.GroupID = uuid; break; } } parcelManagement.UpdateLandObject(startLandObject); } }
// Teleport functions public DateTime osTeleportAgent(string agent, int regionX, int regionY, LSL_Vector position, LSL_Vector lookat) { // High because there is no security check. High griefer potential // if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osTeleportAgent", m_host, "OSSL", m_itemID)) return DateTime.Now; ulong regionHandle = Utils.UIntsToLong(((uint) regionX*Constants.RegionSize), ((uint) regionY*Constants.RegionSize)); UUID agentId = new UUID(); if (UUID.TryParse(agent, out agentId)) { return TeleportAgent(agentId, regionHandle, position.ToVector3(), lookat.ToVector3()); } return DateTime.Now; }
public void llSetTorque(LSL_Vector torque, int local) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; m_host.SetAngularImpulse(new Vector3((float) torque.x, (float) torque.y, (float) torque.z), local != 0); }
public void llSetVehicleVectorParam(int param, LSL_Vector vec) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; if (m_host.ParentEntity != null) { if (!m_host.ParentEntity.IsDeleted) { m_host.ParentEntity.RootChild.SetVehicleVectorParam(param, new Vector3((float) vec.x, (float) vec.y, (float) vec.z)); } } }
public void llSetScale(LSL_Vector scale) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; SetScale(m_host, scale); }
public void llSetText(string text, LSL_Vector color, LSL_Float alpha) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; Vector3 av3 = new Vector3(Util.Clip((float) color.x, 0.0f, 1.0f), Util.Clip((float) color.y, 0.0f, 1.0f), Util.Clip((float) color.z, 0.0f, 1.0f)); m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float) alpha, 0.0f, 1.0f)); //m_host.ParentGroup.HasGroupChanged = true; //m_host.ParentGroup.ScheduleGroupForFullUpdate(); }
public LSL_Integer llSetRegionPos(LSL_Vector pos) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return ScriptBaseClass.FALSE; SetPos(m_host, pos, false); return ScriptBaseClass.TRUE; }
public DateTime llSetPos(LSL_Vector pos) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return DateTime.Now; SetPos(m_host, pos, true); return PScriptSleep(200); }
public void llSetLinkColor(int linknumber, LSL_Vector color, int face) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; List<ISceneChildEntity> parts = GetLinkParts(linknumber); foreach (ISceneChildEntity part in parts) part.SetFaceColor(new Vector3((float) color.x, (float) color.y, (float) color.z), face); }
public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide", m_host, "OSSL", m_itemID)) return; int startx = (int) (pos1.x < pos2.x ? pos1.x : pos2.x); int starty = (int) (pos1.y < pos2.y ? pos1.y : pos2.y); int endx = (int) (pos1.x > pos2.x ? pos1.x : pos2.x); int endy = (int) (pos1.y > pos2.y ? pos1.y : pos2.y); IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>(); if (parcelManagement != null) { parcelManagement.Subdivide(startx, starty, endx, endy, m_host.OwnerID); } }
public void llSetVelocity(LSL_Vector force, LSL_Integer local) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; Vector3 velocity = new Vector3((float) force.x, (float) force.y, (float) force.z); if (local == 1) { Quaternion grot = m_host.GetWorldRotation(); Quaternion AXgrot = grot; Vector3 AXimpulsei = velocity; Vector3 newimpulse = AXimpulsei*AXgrot; velocity = newimpulse; } if (m_host.ParentEntity.RootChild.PhysActor != null) m_host.ParentEntity.RootChild.PhysActor.Velocity = velocity; }
public DateTime osRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, LSL_Integer isRezAtRoot, LSL_Integer doRecoil, LSL_Integer SetDieAtEdge, LSL_Integer CheckPos) { InitLSL(); return m_LSL_Api.llRezPrim(inventory, pos, vel, rot, param, isRezAtRoot == 1, doRecoil == 1, SetDieAtEdge == 1, CheckPos == 1); }
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; // LSL quaternions can normalize to 0, normal Quaternions can't. if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) rot.z = 1; // ZERO_ROTATION = 0,0,0,1 m_host.SitTargetPosition = new Vector3((float) offset.x, (float) offset.y, (float) offset.z); m_host.SitTargetOrientation = Rot2Quaternion(rot); }
// Teleport functions public DateTime osTeleportAgent(string agent, string regionName, LSL_Vector position, LSL_Vector lookat) { // High because there is no security check. High griefer potential // if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osTeleportAgent", m_host, "OSSL", m_itemID)) return DateTime.Now; UUID AgentID; if (UUID.TryParse(agent, out AgentID)) { List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.AllScopeIDs, regionName, 0, 1); // Try to link the region if (regions != null && regions.Count > 0) { GridRegion regInfo = regions[0]; ulong regionHandle = regInfo.RegionHandle; return TeleportAgent(AgentID, regionHandle, position.ToVector3(), lookat.ToVector3()); } } return DateTime.Now; }
public LSL_Integer llTarget(LSL_Vector position, LSL_Float range) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return 0; return m_host.registerTargetWaypoint( new Vector3((float) position.x, (float) position.y, (float) position.z), (float) range); }
public DateTime osTeleportAgent(string agent, LSL_Vector position, LSL_Vector lookat) { return osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat); }
public void llTargetOmega(LSL_Vector axis, LSL_Float spinrate, LSL_Float gain) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; m_host.OmegaAxis = new Vector3((float) axis.x, (float) axis.y, (float) axis.z); m_host.OmegaGain = gain; m_host.OmegaSpinRate = spinrate; m_host.GenerateRotationalVelocityFromOmega(); ScriptData script = ScriptProtection.GetScript(m_itemID); if (script != null) script.TargetOmegaWasSet = true; m_host.ScheduleTerseUpdate(); //m_host.SendTerseUpdateToAllClients(); }
public DateTime osTeleportOwner(LSL_Vector position, LSL_Vector lookat) { return osTeleportOwner(World.RegionInfo.RegionName, position, lookat); }
public void llTeleportAgent(LSL_Key avatar, LSL_String landmark, LSL_Vector position, LSL_Vector look_at) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; UUID invItemID = InventorySelf(); if (invItemID == UUID.Zero) return; lock (m_host.TaskInventory) { if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) { ShoutError("No permissions to teleport the agent"); return; } if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) == 0) { ShoutError("No permissions to teleport the agent"); return; } } TaskInventoryItem item = null; lock (m_host.TaskInventory) { foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) { if (inv.Value.Name == landmark) item = inv.Value; } } if (item == null && landmark != "") return; IScenePresence presence = World.GetScenePresence(m_host.OwnerID); if (presence != null) { IEntityTransferModule module = World.RequestModuleInterface<IEntityTransferModule>(); if (module != null) { if (landmark == "") module.Teleport(presence, World.RegionInfo.RegionHandle, position.ToVector3(), look_at.ToVector3(), (uint) TeleportFlags.ViaLocation); else { AssetLandmark lm = new AssetLandmark( World.AssetService.Get(item.AssetID.ToString())); module.Teleport(presence, lm.RegionHandle, lm.Position, look_at.ToVector3(), (uint) TeleportFlags.ViaLocation); } } } }
protected void DropAttachmentAt(bool checkPerms, LSL_Vector pos, LSL_Rotation rot) { if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment")) { return; } IAttachmentsModule attachmentsModule = World.RequestModuleInterface<IAttachmentsModule>(); IScenePresence sp = attachmentsModule == null ? null : World.GetScenePresence(m_host.OwnerID); if (attachmentsModule != null && sp != null) { attachmentsModule.DetachSingleAttachmentToGround(m_host.ParentEntity.UUID, sp.ControllingClient, pos.ToVector3(), rot.ToQuaternion()); } }
public LSL_String botCreateBot(string FirstName, string LastName, string appearanceToClone, LSL_Vector startPos) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botCreateBot", m_host, "bot", m_itemID)) return ""; IBotManager manager = World.RequestModuleInterface<IBotManager>(); if (manager != null) return new LSL_String( manager.CreateAvatar(FirstName, LastName, m_host.ParentEntity.Scene, UUID.Parse(appearanceToClone), m_host.OwnerID, new Vector3((float) startPos.x, (float) startPos.y, (float) startPos.z)). ToString()); return new LSL_String(""); }
public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt", m_host, "OSSL", m_itemID)) return; DropAttachmentAt(true, pos, rot); }
public void botSitObject(string bot, string objectID, LSL_Vector offset) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botTouchObject", m_host, "bot", m_itemID)) return; IScenePresence sp = World.GetScenePresence(UUID.Parse(bot)); if (sp == null) return; ISceneChildEntity child = World.GetSceneObjectPart(UUID.Parse(objectID)); if (child == null) throw new Exception("Failed to find entity to sit on"); sp.HandleAgentRequestSit(sp.ControllingClient, UUID.Parse(objectID), new Vector3((float) offset.x, (float) offset.y, (float) offset.z)); }
public LSL_Vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.VeryLow, "osGetDrawStringSize", m_host, "OSSL", m_itemID)) return new LSL_Vector(); LSL_Vector vec = new LSL_Vector(0, 0, 0); IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); if (textureManager != null) { double xSize, ySize; textureManager.GetDrawStringSize(contentType, text, fontName, fontSize, out xSize, out ySize); vec.x = xSize; vec.y = ySize; } return vec; }
public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; llSetForce(force, local); llSetTorque(torque, local); }