Ejemplo n.º 1
0
        private void ValidateVoxel(long time)
        {
            if (!_targetStateIcon)
            {
                return;
            }

            var voxel = Target.Entity as MyVoxelBase;

            if (voxel == null || voxel.MarkedForClose)
            {
                return;
            }

            //voxel = voxel.RootVoxel;
            //if (voxel == null || voxel.MarkedForClose)
            //    return;

            _targetState = VoxelPainterTargetState.Ok;
            var player = MyAPIGateway.Players.GetPlayerControllingEntity(Holder);

            if (player == null)
            {
                _validationDebugNotification.Text = "VoxelPainter::Player == null";
                _validationDebugNotification.ShowDebug();
                _targetState = VoxelPainterTargetState.Invalid;
                return;
            }

            if (!DeterminePaintPermission(player))
            {
                _validationDebugNotification.Text = "VoxelPainter::No Permission";
                _validationDebugNotification.ShowDebug();
                _targetState = VoxelPainterTargetState.Denied;
                return;
            }

            var voxelMaterial = GetVoxelMaterial(voxel, Target.Position);

            if (voxelMaterial == null || _mining == null || !_mining.MiningEntries.ContainsKey(voxelMaterial.Index))
            {
                _validationDebugNotification.Text = "VoxelPainter::Invalid Voxel";
                _validationDebugNotification.ShowDebug();
                _targetState = VoxelPainterTargetState.Invalid;
                return;
            }

            _validationDebugNotification.Text = "VoxelPainter::Valid Voxel";
            _validationDebugNotification.ShowDebug();
            //MrzUtils.ShowNotificationDebug("VoxelPainter: Valid Voxel", 100);
        }
        public MyActionDescription GetActionInfo(string dummyName, UseActionEnum actionEnum)
        {
            _actionDebugNotification.ShowDebug();

            return(new MyActionDescription()
            {
                Text = _interactionMessage,
                FormatParams = new object[] { "F", Entity.DisplayNameText },
                IsTextControlHint = false,
            });
        }