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


C# ISceneChildEntity.GetEffectiveObjectFlags方法代码示例

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


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

示例1: GenerateClientFlags

        public uint GenerateClientFlags(UUID user, ISceneChildEntity task)
        {
            // Here's the way this works,
            // ObjectFlags and Permission flags are two different enumerations
            // ObjectFlags, however, tells the client to change what it will allow the user to do.
            // So, that means that all of the permissions type ObjectFlags are /temporary/ and only
            // supposed to be set when customizing the objectflags for the client.

            // These temporary objectflags get computed and added in this function based on the
            // Permission mask that's appropriate!
            // Outside of this method, they should never be added to objectflags!
            // -teravus

            // this shouldn't ever happen..     return no permissions/objectflags.
            if (task == null)
                return 0;

            uint objflags = task.GetEffectiveObjectFlags();
            UUID objectOwner = task.OwnerID;


            // Remove any of the objectFlags that are temporary.  These will get added back if appropriate
            // in the next bit of code

            // libomv will moan about PrimFlags.ObjectYouOfficer being
            // deprecated
#pragma warning disable 0612 
            objflags &= (uint)
                        ~(PrimFlags.ObjectCopy | // Tells client you can copy the object
                          PrimFlags.ObjectModify | // tells client you can modify the object
                          PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
                          PrimFlags.ObjectTransfer |
                          // tells the client that you can /take/ the object if you don't own it
                          PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object
                          PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
                          PrimFlags.ObjectOwnerModify | // Tells client that you're the owner of the object
                          PrimFlags.ObjectYouOfficer
                         // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
                         );
#pragma warning restore 0612


            // Creating the three ObjectFlags options for this method to choose from.
            // Customize the OwnerMask
            uint objectOwnerMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
            objectOwnerMask |= (uint) PrimFlags.ObjectYouOwner | (uint) PrimFlags.ObjectAnyOwner |
                               (uint) PrimFlags.ObjectOwnerModify;

            // Customize the GroupMask
            uint objectGroupMask = ApplyObjectModifyMasks(task.GroupMask, objflags);

            // Customize the EveryoneMask
            uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
            if (objectOwner != UUID.Zero)
                objectEveryoneMask |= (uint) PrimFlags.ObjectAnyOwner;

            PermissionClass permissionClass = GetPermissionClass(user, task);
            switch (permissionClass)
            {
                case PermissionClass.Owner:
                    return objectOwnerMask;
                case PermissionClass.Group:
                    return objectGroupMask | objectEveryoneMask;
                case PermissionClass.Everyone:
                default:
                    return objectEveryoneMask;
            }
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:68,代码来源:PermissionsModule.cs

示例2: GenerateClientFlags

        public uint GenerateClientFlags(UUID userID, ISceneChildEntity part)
        {
            // libomv will moan about PrimFlags.ObjectYouOfficer being
            // obsolete...
#pragma warning disable 0612
            const PrimFlags DEFAULT_FLAGS =
                PrimFlags.ObjectModify |
                PrimFlags.ObjectCopy |
                PrimFlags.ObjectMove |
                PrimFlags.ObjectTransfer |
                PrimFlags.ObjectYouOwner |
                PrimFlags.ObjectAnyOwner |
                PrimFlags.ObjectOwnerModify |
                PrimFlags.ObjectYouOfficer;
#pragma warning restore 0612

            if (part == null)
                return 0;

            uint perms = part.GetEffectiveObjectFlags() | (uint) DEFAULT_FLAGS;

            GenerateClientFlagsHandler handlerGenerateClientFlags = OnGenerateClientFlags;
            if (handlerGenerateClientFlags != null)
            {
                Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
#if (!ISWIN)
                foreach (GenerateClientFlagsHandler handler in list)
                    perms = perms & handler(userID, part);
#else
                perms = list.Cast<GenerateClientFlagsHandler>().Aggregate(perms, (current, check) => current & check(userID, part));
#endif
            }
            return perms;
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:34,代码来源:Scene.Permissions.cs

示例3: GetLinkPrimitiveParams

        public LSL_List GetLinkPrimitiveParams (ISceneChildEntity part, LSL_List rules)
        {
            LSL_List res = new LSL_List();
            int idx = 0;
            while (idx < rules.Length)
            {
                int code = (int)rules.GetLSLIntegerItem(idx++);
                int remain = rules.Length - idx;
                Primitive.TextureEntry tex = part.Shape.Textures;
                int face = 0;
                //if (idx < rules.Length)
                //    face = (int)rules.GetLSLIntegerItem(idx++);

                if (code == (int)ScriptBaseClass.PRIM_NAME)
                {
                    res.Add(new LSL_String(part.Name));
                }

                if (code == (int)ScriptBaseClass.PRIM_DESC)
                {
                    res.Add (new LSL_String (part.Description));
                }

                if (code == (int)ScriptBaseClass.PRIM_MATERIAL)
                {
                    res.Add(new LSL_Integer(part.Material));
                }

                if (code == (int)ScriptBaseClass.PRIM_PHYSICS)
                {
                    if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0)
                        res.Add(new LSL_Integer(1));
                    else
                        res.Add(new LSL_Integer(0));
                }

                if (code == (int)ScriptBaseClass.PRIM_TEMP_ON_REZ)
                {
                    if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0)
                        res.Add(new LSL_Integer(1));
                    else
                        res.Add(new LSL_Integer(0));
                }

                if (code == (int)ScriptBaseClass.PRIM_PHANTOM)
                {
                    if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
                        res.Add(new LSL_Integer(1));
                    else
                        res.Add(new LSL_Integer(0));
                }

                if (code == (int)ScriptBaseClass.PRIM_POSITION)
                {
                    Vector3 tmp = part.AbsolutePosition;
                    LSL_Vector v = new LSL_Vector(tmp.X,
                                                  tmp.Y,
                                                  tmp.Z);
                    // For some reason, the part.AbsolutePosition.* values do not change if the
                    // linkset is rotated; they always reflect the child prim's world position
                    // as though the linkset is unrotated. This is incompatible behavior with SL's
                    // implementation, so will break scripts imported from there (not to mention it
                    // makes it more difficult to determine a child prim's actual inworld position).
                    if (part.ParentID != 0)
                        {
                        LSL_Rotation rtmp = llGetRootRotation();
                        LSL_Vector rpos = llGetRootPosition();
                        v = ((v - rpos) * rtmp) + rpos;
                        }
                    res.Add(v);
                }

                if (code == (int)ScriptBaseClass.PRIM_SIZE)
                {
                    Vector3 tmp = part.Scale;
                    res.Add(new LSL_Vector(tmp.X,
                                                  tmp.Y,
                                                  tmp.Z));
                }

                if (code == (int)ScriptBaseClass.PRIM_ROTATION)
                {
                    res.Add(GetPartRot(part));
                }

                if (code == (int)ScriptBaseClass.PRIM_TYPE)
                {
                    // implementing box
                    PrimitiveBaseShape Shape = part.Shape;
                    int primType = (int)part.GetPrimType();
                    res.Add(new LSL_Integer(primType));
                    double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX
                    double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY.
                    if (primType == ScriptBaseClass.PRIM_TYPE_BOX ||
                         ScriptBaseClass.PRIM_TYPE_CYLINDER ||
                         ScriptBaseClass.PRIM_TYPE_PRISM)
                    {
                        res.Add(new LSL_Integer(Shape.ProfileCurve));
                        res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
                        res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
//.........这里部分代码省略.........
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:101,代码来源:LSL_Api.cs

示例4: GenerateClientFlags

        public uint GenerateClientFlags (UUID user, ISceneChildEntity task)
        {
            // Here's the way this works,
            // ObjectFlags and Permission flags are two different enumerations
            // ObjectFlags, however, tells the client to change what it will allow the user to do.
            // So, that means that all of the permissions type ObjectFlags are /temporary/ and only
            // supposed to be set when customizing the objectflags for the client.

            // These temporary objectflags get computed and added in this function based on the
            // Permission mask that's appropriate!
            // Outside of this method, they should never be added to objectflags!
            // -teravus

            // this shouldn't ever happen..     return no permissions/objectflags.
            if (task == null)
                return (uint)0;

            uint objflags = task.GetEffectiveObjectFlags();
            UUID objectOwner = task.OwnerID;
            
            
            // Remove any of the objectFlags that are temporary.  These will get added back if appropriate
            // in the next bit of code

            // libomv will moan about PrimFlags.ObjectYouOfficer being
            // deprecated
            #pragma warning disable 0612 
            objflags &= (uint)
                ~(PrimFlags.ObjectCopy | // Tells client you can copy the object
                  PrimFlags.ObjectModify | // tells client you can modify the object
                  PrimFlags.ObjectMove |   // tells client that you can move the object (only, no mod)
                  PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
                  PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object
                  PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
                  PrimFlags.ObjectOwnerModify | // Tells client that you're the owner of the object
                  PrimFlags.ObjectYouOfficer // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
                    );
            #pragma warning restore 0612


            // Creating the three ObjectFlags options for this method to choose from.
            // Customize the OwnerMask
            uint objectOwnerMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
            objectOwnerMask |= (uint)PrimFlags.ObjectYouOwner | (uint)PrimFlags.ObjectAnyOwner | (uint)PrimFlags.ObjectOwnerModify;

            // Customize the GroupMask
            uint objectGroupMask = ApplyObjectModifyMasks(task.GroupMask, objflags);

            // Customize the EveryoneMask
            uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
            if (objectOwner != UUID.Zero)
                objectEveryoneMask |= (uint)PrimFlags.ObjectAnyOwner;

            if (m_bypassPermissions)
                return objectOwnerMask;
        
            // Object owners should be able to edit their own content
            if (user == objectOwner)
                return objectOwnerMask;

            if (IsFriendWithPerms(user, objectOwner))
                return objectOwnerMask;

            // Estate users should be able to edit anything in the sim if RegionOwnerIsGod is set
            if (m_RegionOwnerIsGod && IsEstateManager(user) && !IsAdministrator(objectOwner))
                return objectOwnerMask;

            // Admin should be able to edit anything in the sim (including admin objects)
            if (IsAdministrator(user))
                return objectOwnerMask;
            
            // Users should be able to edit what is over their land.
            Vector3 taskPos = task.AbsolutePosition;
            if (m_parcelManagement == null)
                return objectOwnerMask;
            ILandObject parcel = m_parcelManagement.GetLandObject(taskPos.X, taskPos.Y);
            if (parcel != null && parcel.LandData.OwnerID == user && m_ParcelOwnerIsGod)
            {
                // Admin objects should not be editable by the above
                if (!IsAdministrator(objectOwner))
                    return objectOwnerMask;
            }

            // Group permissions
            if ((task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0))
                return objectGroupMask | objectEveryoneMask;
        
            return objectEveryoneMask;
        }
开发者ID:kchi059,项目名称:Aurora-Sim,代码行数:89,代码来源:PermissionsModule.cs

示例5: GetLinkPrimitiveParams

        public LSL_List GetLinkPrimitiveParams(ISceneChildEntity part, LSL_List rules)
        {
            LSL_List res = new LSL_List();
            int idx = 0;
            while (idx < rules.Length)
            {
                int code = rules.GetLSLIntegerItem(idx++);
                int remain = rules.Length - idx;
                Primitive.TextureEntry tex = part.Shape.Textures;
                int face = 0;

                if (code == (int) ScriptBaseClass.PRIM_NAME)
                {
                    res.Add(new LSL_String(part.Name));
                }

                else if (code == (int) ScriptBaseClass.PRIM_DESC)
                {
                    res.Add(new LSL_String(part.Description));
                }

                else if (code == (int) ScriptBaseClass.PRIM_MATERIAL)
                {
                    res.Add(new LSL_Integer(part.Material));
                }

                else if (code == (int) ScriptBaseClass.PRIM_PHYSICS)
                {
                    res.Add((part.GetEffectiveObjectFlags() & (uint) PrimFlags.Physics) != 0
                                ? new LSL_Integer(1)
                                : new LSL_Integer(0));
                }

                else if (code == (int) ScriptBaseClass.PRIM_TEMP_ON_REZ)
                {
                    res.Add((part.GetEffectiveObjectFlags() & (uint) PrimFlags.TemporaryOnRez) != 0
                                ? new LSL_Integer(1)
                                : new LSL_Integer(0));
                }

                else if (code == (int) ScriptBaseClass.PRIM_PHANTOM)
                {
                    res.Add((part.GetEffectiveObjectFlags() & (uint) PrimFlags.Phantom) != 0
                                ? new LSL_Integer(1)
                                : new LSL_Integer(0));
                }

                else if (code == (int) ScriptBaseClass.PRIM_POSITION)
                {
                    Vector3 tmp = part.AbsolutePosition;
                    LSL_Vector v = new LSL_Vector(tmp.X,
                                                  tmp.Y,
                                                  tmp.Z);
                    // For some reason, the part.AbsolutePosition.* values do not change if the
                    // linkset is rotated; they always reflect the child prim's world position
                    // as though the linkset is unrotated. This is incompatible behavior with SL's
                    // implementation, so will break scripts imported from there (not to mention it
                    // makes it more difficult to determine a child prim's actual inworld position).
                    if (part.ParentID != 0)
                    {
                        LSL_Rotation rtmp = llGetRootRotation();
                        LSL_Vector rpos = llGetRootPosition();
                        v = ((v - rpos)*rtmp) + rpos;
                    }
                    res.Add(v);
                }
                else if (code == (int) ScriptBaseClass.PRIM_POS_LOCAL)
                {
                    res.Add(GetLocalPos(part));
                }
                else if (code == (int) ScriptBaseClass.PRIM_SIZE)
                {
                    Vector3 tmp = part.Scale;
                    res.Add(new LSL_Vector(tmp.X,
                                           tmp.Y,
                                           tmp.Z));
                }

                else if (code == (int) ScriptBaseClass.PRIM_ROTATION)
                {
                    res.Add(GetPartRot(part));
                }

                else if (code == (int) ScriptBaseClass.PRIM_TYPE)
                {
                    // implementing box
                    PrimitiveBaseShape Shape = part.Shape;
                    int primType = (int) part.GetPrimType();
                    res.Add(new LSL_Integer(primType));
                    double topshearx = (sbyte) Shape.PathShearX/100.0; // Fix negative values for PathShearX
                    double topsheary = (sbyte) Shape.PathShearY/100.0; // and PathShearY.
                    if (primType == ScriptBaseClass.PRIM_TYPE_BOX ||
                        primType == ScriptBaseClass.PRIM_TYPE_CYLINDER ||
                        primType == ScriptBaseClass.PRIM_TYPE_PRISM)
                    {
                        res.Add(new LSL_Integer(Shape.ProfileCurve));
                        res.Add(new LSL_Vector(Shape.ProfileBegin/50000.0, 1 - Shape.ProfileEnd/50000.0, 0));
                        res.Add(new LSL_Float(Shape.ProfileHollow/50000.0));
                        res.Add(new LSL_Vector(Shape.PathTwistBegin/100.0, Shape.PathTwist/100.0, 0));
                        res.Add(new LSL_Vector(1 - (Shape.PathScaleX/100.0 - 1), 1 - (Shape.PathScaleY/100.0 - 1), 0));
//.........这里部分代码省略.........
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:101,代码来源:LSL_Api.cs

示例6: MoveTaskInventoryItemToObject

        /// <summary>
        /// Copy a task (prim) inventory item to another task (prim)
        /// </summary>
        /// <param name="destId"></param>
        /// <param name="part"></param>
        /// <param name="itemId"></param>
        public void MoveTaskInventoryItemToObject (UUID destId, ISceneChildEntity part, UUID itemId)
        {
            TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId);

            if (srcTaskItem == null)
            {
                MainConsole.Instance.ErrorFormat(
                    "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for moving"
                        + " but the item does not exist in this inventory",
                    itemId, part.Name, part.UUID);

                return;
            }

            ISceneChildEntity destPart = m_scene.GetSceneObjectPart (destId);

            if (destPart == null)
            {
                MainConsole.Instance.ErrorFormat(
                        "[PRIM INVENTORY]: " +
                        "Could not find prim for ID {0}",
                        destId);
                return;
            }

            // Can't transfer this
            //
            if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
                return;

            if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
            {
                // object cannot copy items to an object owned by a different owner
                // unless llAllowInventoryDrop has been called

                return;
            }

            // must have both move and modify permission to put an item in an object
            if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0)
            {
                return;
            }

            TaskInventoryItem destTaskItem = new TaskInventoryItem
                                                 {
                                                     ItemID = UUID.Random(),
                                                     CreatorID = srcTaskItem.CreatorID,
                                                     CreatorData = srcTaskItem.CreatorData,
                                                     AssetID = srcTaskItem.AssetID,
                                                     GroupID = destPart.GroupID,
                                                     OwnerID = destPart.OwnerID,
                                                     ParentID = destPart.UUID,
                                                     ParentPartID = destPart.UUID,
                                                     BasePermissions = srcTaskItem.BasePermissions,
                                                     EveryonePermissions = srcTaskItem.EveryonePermissions,
                                                     GroupPermissions = srcTaskItem.GroupPermissions,
                                                     CurrentPermissions = srcTaskItem.CurrentPermissions,
                                                     NextPermissions = srcTaskItem.NextPermissions,
                                                     Flags = srcTaskItem.Flags,
                                                     SalePrice = srcTaskItem.SalePrice,
                                                     SaleType = srcTaskItem.SaleType
                                                 };



            if (destPart.OwnerID != part.OwnerID)
            {
                if (m_scene.Permissions.PropagatePermissions())
                {
                    destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions &
                            (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
                    destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions &
                            (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
                    destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions &
                            (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
                    destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
                            (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
                    destTaskItem.CurrentPermissions |= 16; // Slam!
                }
            }

            destTaskItem.Description = srcTaskItem.Description;
            destTaskItem.Name = srcTaskItem.Name;
            destTaskItem.InvType = srcTaskItem.InvType;
            destTaskItem.Type = srcTaskItem.Type;

            destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID);

            if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
                part.Inventory.RemoveInventoryItem(itemId);

            IScenePresence avatar;

//.........这里部分代码省略.........
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:101,代码来源:LLClientInventory.cs


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