当前位置: 首页>>代码示例>>C#>>正文


C# SceneObjectGroup.ResetIDs方法代码示例

本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.ResetIDs方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.ResetIDs方法的具体用法?C# SceneObjectGroup.ResetIDs怎么用?C# SceneObjectGroup.ResetIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Region.Framework.Scenes.SceneObjectGroup的用法示例。


在下文中一共展示了SceneObjectGroup.ResetIDs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RezPrim

        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;
        }
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:61,代码来源:Scene.Inventory.cs

示例2: AddObjectToSceneIfPermitted

        private bool AddObjectToSceneIfPermitted(SceneObjectGroup group, IClientAPI remoteClient, Vector3 pos, bool attachment,
            UUID? rezzedByObjectUUID)
        {
            group.ResetIDs();

            if (this.IsBadUser(group.OwnerID))
            {
                if (remoteClient != null) remoteClient.SendAlertMessage("Can't rez object '" + group.Name + "'. Your ability to rez objects has been disabled.");
                return false;
            }

            if (attachment)
            {
                AddNewSceneObject(group, false);
                return true;
            }

            string reason = String.Empty;
            bool allowed = true;
            int landImpactNeeded = group.LandImpact;

            ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
            if (parcel == null)
            {
                Vector3 newpos = ValidLocation(pos);
                if ((newpos.X != pos.X) || (newpos.Y != pos.Y))
                {
                    // Previous rez position was off-world, try again forced within.
                    parcel = LandChannel.GetLandObject(newpos.X, newpos.Y);
                    if (parcel != null)
                    {
                        string spos = Convert.ToInt16(pos.X).ToString() + "," + Convert.ToInt16(pos.Y).ToString() + "," + Convert.ToInt16(pos.Z).ToString();
                        if (remoteClient != null) remoteClient.SendAlertMessage("Attempt to rez object '" + group.Name + "' (" + landImpactNeeded.ToString() + " prims) at <" + spos + "> moved within region.");
//                        m_log.Warn("[SCENE]: Attempt to rez object '" + group.Name + "' (" + landImpactNeeded.ToString() + " prims) at <" + spos + "> moved within region.");
                        // success, found new valid position to rez - update it
                        pos = newpos;   
                        group.RootPart.SetGroupPositionDirect(pos);
                    }
                }
            }

            bool isTemp = (group.RootPart.GetEffectiveObjectFlags() & PrimFlags.TemporaryOnRez) != 0;
            if (parcel == null)
            {
                reason = ". Cannot determine land parcel.";
                allowed = false;
            }
            else
            {
                // Pass 0 for landImpact here so that it can be tested separately.
                if (!Permissions.CanRezObject(0, group.OwnerID, rezzedByObjectUUID.HasValue ? rezzedByObjectUUID.Value : UUID.Zero, pos, isTemp))
                {
                    if (RegionInfo.Product == ProductRulesUse.ScenicUse)
                        reason = ". Only the Estate Owner or partner can create objects on a scenic region.";
                    else
                        reason = " because the owner of this land parcel does not allow it.  Use About Land to see land ownership.";
                    allowed = false;
                }
                else
                if (!CheckLandImpact(parcel, landImpactNeeded, out reason))
                {
                    if (reason == "region")
                        reason = " because it would exceed the region prim limit.";
                    else
                        reason = " because it would exceed the prim limit.";
                    allowed = false;
                }
            }

            if (allowed) {
                AddNewSceneObject(group, !isTemp);
            } else {
                string spos = Convert.ToInt16(pos.X).ToString() + "," + Convert.ToInt16(pos.Y).ToString() + "," + Convert.ToInt16(pos.Z).ToString();
//                m_log.WarnFormat("[SCENE]: Attempt to rez object '" + group.Name + "' (" + landImpactNeeded.ToString() + " prims) at <" + spos + "> failed. {0}", reason);
                if (remoteClient != null) remoteClient.SendAlertMessage("Can't rez object '" + group.Name + "' (" + landImpactNeeded.ToString() + " prims) at <" + spos + "> " + reason);
            }
            return allowed;
        }
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:78,代码来源:Scene.Inventory.cs


注:本文中的OpenSim.Region.Framework.Scenes.SceneObjectGroup.ResetIDs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。