public virtual SceneObjectGroup RezPrim(SceneObjectPart sourcePart, SceneObjectPart newPart, int param, out string reason) { // Rez object Vector3 pos = newPart.AbsolutePosition; SceneObjectGroup group = new SceneObjectGroup(newPart); bool isTemp = (group.RootPart.GetEffectiveObjectFlags() & PrimFlags.TemporaryOnRez) != 0; ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); if (parcel == null) { reason = "land"; return null; } // Pass 0 for landImpact here so that it can be tested separately. if (!Permissions.CanRezObject(0, newPart.OwnerID, sourcePart.UUID, pos, isTemp)) { reason = "permission"; return null; } if (!CheckLandImpact(parcel, group.LandImpact, out reason)) { return null; } // Check for grey goo fence if (!CheckGreyGoo(sourcePart, group)) { reason = "fence"; return null; } // Allowing the rez... update the last rez time and the new group fields sourcePart.StampLastRez(); group.CurrentParcel = parcel; // initialize _currentParcel (and auto-return) group.SetGeneration(group.RootPart.Generation); // now update the rest of the parts group.ResetIDs(); //set the group's group before setting the object's position. //this will make sure that the group id is correct during the script //engine's group check group.SetGroup(sourcePart.ParentGroup.RootPart.GroupID, null); AddNewSceneObject(group, !isTemp); SceneObjectPart rootPart = group.GetChildPart(group.UUID); rootPart.TrimPermissions(); if (group.RootPart.IsPrim) { group.ClearPartAttachmentData(); } group.CreateScriptInstances(param, ScriptStartFlags.PostOnRez, DefaultScriptEngine, (int)ScriptStateSource.PrimData, null); rootPart.ScheduleFullUpdate(PrimUpdateFlags.ForcedFullUpdate); reason = "success"; return rootPart.ParentGroup; }