public void llGodLikeRezObject(string inventory, LSL_Vector pos)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;
if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
{
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
{
AssetBase asset = World.AssetService.Get(inventory);
SceneObjectGroup group
= SceneObjectSerializer.FromOriginalXmlFormat(UUID.Zero, Utils.BytesToString(asset.Data), World);
if (group == null)
return;
group.IsDeleted = false;
group.m_isLoaded = true;
foreach (SceneObjectPart part in group.ChildrenList)
{
part.IsLoading = false;
}
group.OwnerID = m_host.OwnerID;
group.RootPart.AddFlag(PrimFlags.CreateSelected);
// If we're rezzing an attachment then don't ask AddNewSceneObject() to update the client since
// we'll be doing that later on. Scheduling more than one full update during the attachment
// process causes some clients to fail to display the attachment properly.
World.SceneGraph.AddPrimToScene(group);
// if attachment we set it's asset id so object updates can reflect that
// if not, we set it's position in world.
group.AbsolutePosition = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
IScenePresence SP = World.GetScenePresence(m_host.OwnerID);
if (SP != null)
group.SetGroup(m_host.GroupID, SP.UUID, false);
if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
group.ClearPartAttachmentData();
// Fire on_rez
group.CreateScriptInstances(0, true, StateSource.ScriptedRez, UUID.Zero, false);
group.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
}
}
}