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


C# SceneObjectPart.StampLastRez方法代码示例

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


在下文中一共展示了SceneObjectPart.StampLastRez方法的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: RezObject

        /// <summary>
        /// Rez an object into the scene from a prim's inventory.
        /// </summary>
        /// <param name="sourcePart"></param>
        /// <param name="item"></param>
        /// <param name="pos"></param>
        /// <param name="rot"></param>
        /// <param name="vel"></param>
        /// <param name="param"></param>
        /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns>
        /// 
        public virtual IEnumerable<SceneObjectGroup> RezObject(
            SceneObjectPart sourcePart, TaskInventoryItem item, bool rezAtRoot,
            Vector3 pos, Quaternion rot, Vector3 vel, int? param, out string reason)
        {
            // Rez object
            if (item != null)
            {
                UUID ownerID = item.OwnerID;

                AssetBase rezAsset = CommsManager.AssetCache.GetAsset(item.AssetID, AssetRequestInfo.InternalRequest());

                if (rezAsset != null)
                {
                    CoalescedObject cobj = null;
                    SceneObjectGroup grp = null;
                    List<SceneObjectGroup> allGroups = new List<SceneObjectGroup>();

                    int totalLandImpact = 0;
                    bool isTemp = true;

                    if (item.ContainsMultipleItems)
                    {
                        cobj = this.DoDeserializeCoalesced(item.ItemID, rezAsset.Data);
                        foreach (var subGrp in cobj.Groups)
                        {
                            totalLandImpact += subGrp.LandImpact;
                            //for a coalesced, we set istemp to false if any parts are not temp
                            if ((subGrp.RootPart.GetEffectiveObjectFlags() & PrimFlags.TemporaryOnRez) == 0)
                            {
                                isTemp = false;
                            }

                            allGroups.Add(subGrp);
                        }
                    }
                    else
                    {
                        grp = this.DoDeserializeGroup(item.ItemID, rezAsset.Data);
                        totalLandImpact = grp.LandImpact;
                        isTemp = (grp.RootPart.GetEffectiveObjectFlags() & PrimFlags.TemporaryOnRez) != 0;
                        allGroups.Add(grp);
                    }

                    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, ownerID, sourcePart.UUID, pos, isTemp))
                    {
                        reason = "permission";
                        return null;
                    }

                    if (!CheckLandImpact(parcel, totalLandImpact, out reason))
                    {
                        return null;
                    }

                    foreach (var subGrp in allGroups)
                    {
                        // Check for grey goo fence
                        if (!CheckGreyGoo(sourcePart, subGrp))
                        {
                            reason = "fence";
                            return null;
                        }

                        Vector3 actualPos = pos;
                        if (!rezAtRoot)
                            actualPos += (subGrp.RootPart.AbsolutePosition - subGrp.BoundingBox().Center);

                        // update the last rez time and the new group fields
                        sourcePart.StampLastRez();
                        subGrp.CurrentParcel = parcel;  // initialize _currentParcel (and auto-return)
                        subGrp.SetGeneration(subGrp.RootPart.Generation); // now update the rest of the parts

                        //change the velocity for rez
                        subGrp.RootPart.ReplaceSerializedVelocity(vel);
                    }

                    bool rezSucceeded;
                    if (!item.ContainsMultipleItems)
                    {
                        // Since renaming the item in the inventory does not affect the name stored
                        // in the serialization, transfer the correct name from the inventory to the
//.........这里部分代码省略.........
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:101,代码来源:Scene.Inventory.cs


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