void IMyUseObject.Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user     = entity as MyCharacter;
            var relation = Door.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);

            if (relation != Common.MyRelationsBetweenPlayerAndBlock.Owner && relation != Common.MyRelationsBetweenPlayerAndBlock.FactionShare)
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
            case UseActionEnum.Manipulate:
                Door.SetOpenRequest(!Door.Open, user.ControllerInfo.ControllingIdentityId);
                break;

            case UseActionEnum.OpenTerminal:
                MyGuiScreenTerminal.Show(MyTerminalPageEnum.ControlPanel, user, Door);
                break;
            }
        }
Пример #2
0
        public override void Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user     = entity as MyCharacter;
            var relation = Door.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);

            if (!relation.IsFriendly())
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
            case UseActionEnum.Manipulate:
                Door.SetOpenRequest(!Door.Open, user.ControllerInfo.ControllingIdentityId);
                break;

            case UseActionEnum.OpenTerminal:
                MyGuiScreenTerminal.Show(MyTerminalPageEnum.ControlPanel, user, Door);
                break;
            }
        }