當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。