/// <summary> /// This isn't really an LSL function, just a way to merge llRezAtRoot and llRezObject into one /// </summary> /// <param name="inventory"></param> /// <param name="pos"></param> /// <param name="vel"></param> /// <param name="rot"></param> /// <param name="param"></param> /// <param name="isRezAtRoot"></param> /// <param name="doRecoil"></param> /// <param name="setDieAtEdge"></param> /// <param name="checkPos"></param> /// <returns></returns> public DateTime llRezPrim(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool isRezAtRoot, bool doRecoil, bool setDieAtEdge, bool checkPos) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "llRezPrim", m_host, "LSL", m_itemID)) { return(DateTime.Now); } if (m_ScriptEngine.Config.GetBoolean("AllowllRezObject", true)) { if (double.IsNaN(rot.x) || double.IsNaN(rot.y) || double.IsNaN(rot.z) || double.IsNaN(rot.s)) { return(DateTime.Now); } if (checkPos) { float dist = (float)llVecDist(llGetPos(), pos); if (dist > m_ScriptDistanceFactor * 10.0f) { return(DateTime.Now); } } TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); foreach (KeyValuePair <UUID, TaskInventoryItem> inv in partInventory) { if (inv.Value.Name == inventory) { // make sure we're an object. if (inv.Value.InvType != (int)InventoryType.Object) { llSay(0, "Unable to create requested object. Object is missing from database."); return(DateTime.Now); } Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); ISceneEntity new_group = RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param, m_host.UUID, isRezAtRoot); if (new_group == null) { continue; } new_group.OnFinishedPhysicalRepresentationBuilding += delegate() { //Do this after the physics engine has built the prim float groupmass = new_group.GetMass(); //Recoil to the av if (m_host.IsAttachment && doRecoil && (new_group.RootChild.Flags & PrimFlags.Physics) == PrimFlags.Physics) { IScenePresence SP = m_host.ParentEntity.Scene.GetScenePresence(m_host.OwnerID); if (SP != null) { //Push the av backwards (For every action, there is an equal, but opposite reaction) Vector3 impulse = llvel * groupmass; impulse.X = impulse.X <1 ? impulse.X : impulse.X> -1 ? impulse.X : -1; impulse.Y = impulse.Y <1 ? impulse.Y : impulse.Y> -1 ? impulse.Y : -1; impulse.Z = impulse.Z <1 ? impulse.Z : impulse.Z> -1 ? impulse.Z : -1; SP.PushForce(impulse); } } }; // If there was an unknown error. if (new_group.RootChild == null) { continue; } // objects rezzed with this method are die_at_edge by default. if (setDieAtEdge) { new_group.RootChild.SetDieAtEdge(true); } // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) return(PScriptSleep(m_sleepMsOnRezAtRoot)); } } llSay(0, "Could not find object " + inventory); } return(DateTime.Now); }