public void botSetSpeed(LSL_Key bot, LSL_Float SpeedModifier) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSetSpeed", m_host, "OSSL", m_itemID)) { return; } IBotManager manager = World.RequestModuleInterface <IBotManager>(); if (manager != null) { manager.SetSpeed(UUID.Parse(bot), m_host.OwnerID, (float)SpeedModifier); } }
public void aaSetCloudDensity (LSL_Float density) { if (!ScriptProtection.CheckThreatLevel (ThreatLevel.Moderate, "aaSetCloudDensity", m_host, "AA", m_itemID)) return; if (!World.Permissions.CanIssueEstateCommand (m_host.OwnerID, false)) { ShoutError ("You do not have estate permissions here."); return; } ICloudModule CloudModule = World.RequestModuleInterface<ICloudModule> (); if (CloudModule == null) return; CloudModule.SetCloudDensity ((float)density); }
public void botFollowAvatar(string bot, string avatarName, LSL_Float startFollowDistance, LSL_Float endFollowDistance) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botFollowAvatar", m_host, "bot", m_itemID)) { return; } IBotManager manager = World.RequestModuleInterface <IBotManager>(); if (manager != null) { manager.FollowAvatar(UUID.Parse(bot), avatarName, (float)startFollowDistance, (float)endFollowDistance, false, Vector3.Zero, m_host.OwnerID); } }
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 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 void llSetVehicleFloatParam(int param, LSL_Float value) { 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.SetVehicleFloatParam(param, (float)value); } } }
public void botSetSpeed(LSL_Key bot, LSL_Float SpeedModifier) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSetSpeed", m_host, "OSSL", m_itemID)) return; IBotManager manager = World.RequestModuleInterface<IBotManager>(); if (manager != null) manager.SetSpeed(UUID.Parse(bot), m_host.OwnerID, (float)SpeedModifier); }
public void osSetSpeed(LSL_Key UUID, LSL_Float SpeedModifier) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed", m_host, "OSSL", m_itemID)) return; IScenePresence avatar = World.GetScenePresence(UUID); if (avatar != null) { if (avatar.UUID != m_host.OwnerID) { //We need to make sure that they can do this then if (!World.Permissions.IsGod(m_host.OwnerID)) return; } avatar.SpeedModifier = (float) SpeedModifier; } }
public void osSetWindParam(string plugin, string param, LSL_Float value) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam", m_host, "OSSL", m_itemID)) return; IWindModule module = World.RequestModuleInterface<IWindModule>(); if (module != null) { try { module.WindParamSet(plugin, param, (float) value.value); } catch (Exception) { } } }
public void llFleeFrom(LSL_Vector source, LSL_Float distance, LSL_List options) { NotImplemented("llFleeFrom"); }
/* The new / changed functions were tested with the following LSL script: default { state_entry() { rotation rot = llEuler2Rot(<0,70,0> * DEG_TO_RAD); llOwnerSay("to get here, we rotate over: "+ (string) llRot2Axis(rot)); llOwnerSay("and we rotate for: "+ (llRot2Angle(rot) * RAD_TO_DEG)); // convert back and forth between quaternion <-> vector and angle rotation newrot = llAxisAngle2Rot(llRot2Axis(rot),llRot2Angle(rot)); llOwnerSay("Old rotation was: "+(string) rot); llOwnerSay("re-converted rotation is: "+(string) newrot); llSetRot(rot); // to check the parameters in the prim } } */ // Xantor 29/apr/2008 // Returns rotation described by rotating angle radians about axis. // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2)) public LSL_Rotation llAxisAngle2Rot(LSL_Vector axis, LSL_Float angle) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_Rotation(); double s = Math.Cos(angle * 0.5); double t = Math.Sin(angle * 0.5); double x = axis.x * t; double y = axis.y * t; double z = axis.z * t; return new LSL_Rotation(x, y, z, s); }
public void llWanderWithin(LSL_Vector origin, LSL_Float distance, LSL_List options) { NotImplemented("llWanderWithin"); }
public void botFollowAvatar(string bot, string avatarName, LSL_Float startFollowDistance, LSL_Float endFollowDistance) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botFollowAvatar", m_host, "bot", m_itemID)) return; IBotManager manager = World.RequestModuleInterface<IBotManager>(); if (manager != null) manager.FollowAvatar(UUID.Parse(bot), avatarName, (float) startFollowDistance, (float) endFollowDistance, false, Vector3.Zero, m_host.OwnerID); }
public void aaSetConeOfSilence (LSL_Float radius) { if (!ScriptProtection.CheckThreatLevel (ThreatLevel.Low, "aaSetConeOfSilence", m_host, "AA", m_itemID)) return; if (World.Permissions.IsGod (m_host.OwnerID)) m_host.SetConeOfSilence (radius.value); else ShoutError ("You do not have god permissions here."); }
public LSL_List llGetStaticPath(LSL_Vector start, LSL_Vector end, LSL_Float radius, LSL_List parameters) { NotImplemented("llGetStaticPath", "Not implemented at this moment"); LSL_List empty = new LSL_List(); return empty; }
public void aaSayDistance (int channelID, LSL_Float distance, string text) { if (!ScriptProtection.CheckThreatLevel (ThreatLevel.VeryLow, "aaSayDistance", 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.Custom, channelID, m_host.ParentEntity.RootChild.AbsolutePosition, m_host.Name, m_host.UUID, false, false, (float)distance.value, UUID.Zero, World); IWorldComm wComm = World.RequestModuleInterface<IWorldComm> (); if (wComm != null) wComm.DeliverMessage (ChatTypeEnum.Custom, channelID, m_host.Name, m_host.UUID, text, (float)distance.value); }
public LSL_Integer llScaleByFactor(LSL_Float scaling_factor) { NotImplemented("llScaleByFactor", "Not implemented at this moment"); return 0; }
public LSL_Integer aaWindlightAddDayCycleFrame (LSL_Float dayCyclePosition, int dayCycleFrameToCopy) { IEnvironmentSettingsModule environmentSettings = World.RequestModuleInterface<IEnvironmentSettingsModule> (); if (environmentSettings == null) return LSL_Integer.FALSE; WindlightDayCycle cycle = environmentSettings.GetCurrentDayCycle (); if (cycle == null) return LSL_Integer.FALSE; if (cycle.Cycle.IsStaticDayCycle || dayCycleFrameToCopy >= cycle.Cycle.DataSettings.Count) return LSL_Integer.FALSE; var data = cycle.Cycle.DataSettings.Keys.ToList (); cycle.Cycle.DataSettings.Add (dayCyclePosition.ToString (), cycle.Cycle.DataSettings [data [dayCycleFrameToCopy]]); environmentSettings.SetDayCycle (cycle); return LSL_Integer.TRUE; }
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 osReturnObjects(LSL_Float Parameter) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "osReturnObjects", m_host, "OSSL", m_itemID)) return; Dictionary<UUID, List<ISceneEntity>> returns = new Dictionary<UUID, List<ISceneEntity>>(); IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>(); if (parcelManagement != null) { ILandObject LO = parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); IPrimCountModule primCountModule = World.RequestModuleInterface<IPrimCountModule>(); IPrimCounts primCounts = primCountModule.GetPrimCounts(LO.LandData.GlobalID); if (Parameter == 0) // Owner objects { foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.OwnerID == LO.LandData.OwnerID)) { if (!returns.ContainsKey(obj.OwnerID)) returns[obj.OwnerID] = new List<ISceneEntity>(); returns[obj.OwnerID].Add(obj); } } if (Parameter == 1) //Everyone elses { foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.OwnerID != LO.LandData.OwnerID && (obj.GroupID != LO.LandData.GroupID || LO.LandData.GroupID == UUID.Zero))) { if (!returns.ContainsKey(obj.OwnerID)) returns[obj.OwnerID] = new List<ISceneEntity>(); returns[obj.OwnerID].Add(obj); } } if (Parameter == 2) // Group { foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.GroupID == LO.LandData.GroupID)) { if (!returns.ContainsKey(obj.OwnerID)) returns[obj.OwnerID] = new List<ISceneEntity>(); returns[obj.OwnerID].Add(obj); } } foreach (List<ISceneEntity> ol in returns.Values) { if (World.Permissions.CanReturnObjects(LO, m_host.OwnerID, ol)) { ILLClientInventory inventoryModule = World.RequestModuleInterface<ILLClientInventory>(); if (inventoryModule != null) inventoryModule.ReturnObjects(ol.ToArray(), m_host.OwnerID); } } } }
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_Float osGetHealth(string avatar) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osGetHealth", m_host, "OSSL", m_itemID)) return new LSL_Float(); UUID avatarId = new UUID(avatar); LSL_Float health = new LSL_Float(-1); IScenePresence presence = World.GetScenePresence(avatarId); Vector3 pos = m_host.GetWorldPosition(); 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>(); health = cp.Health; } } return health; }
static bool FloatAlmostEqual (LSL_Float valA, LSL_Float valB) { return Math.Abs (valA - valB) <= DoubleDifference; }