// When tube/head mounted into voxels and is harvesting void StartInVoxel(MyVoxelMap voxelMap) { // We found voxel so we stop here m_inVoxelMap = voxelMap; CurrentState = MyHarvestingDeviceEnum.InVoxel; StopTubeMovingCue(); StartGrindingCue(); m_lastTimeParticleAdded = null; m_parentMinerShip.Physics.Clear(); m_parentMinerShip.Physics.Immovable = true; MyMwcVector3Int tempVoxelCoord = voxelMap.GetVoxelCenterCoordinateFromMeters(ref m_headPositionTransformed); m_originalVoxelContent = voxelMap.GetVoxelContent(ref tempVoxelCoord); m_voxelMaterial = voxelMap.GetVoxelMaterial(ref tempVoxelCoord); m_harvestingParticleEffect = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Harvester_Harvesting); m_harvestingParticleEffect.UserBirthMultiplier = 0.25f; m_harvestingParticleEffect.UserRadiusMultiplier = 1; m_harvestingParticleEffect.UserColorMultiplier = new Vector4(3, 3, 3, 3); Matrix dirMatrix = MyMath.MatrixFromDir(WorldMatrix.Forward); m_harvestingParticleEffect.WorldMatrix = Matrix.CreateWorld(m_headPositionTransformed, dirMatrix.Forward, dirMatrix.Up); // Empty voxels are problematic and can lead to "extremely fast harvesting". So here we do this // trick and its effect will be that even empty voxels will take few seconds to harvest. if (m_originalVoxelContent == 0) { m_originalVoxelContent = 1; } m_actualVoxelContent = (float)m_originalVoxelContent; m_harvestingSpeed = m_actualVoxelContent / TIME_TO_HARVEST_WHOLE_VOXEL_IN_UPDATE_TIMES; if (!MyVoxelMapOreMaterials.CanBeHarvested(m_voxelMaterial)) { HUD.MyHud.ShowIndestructableAsteroidNotification(); StartReturningBack(); } }
// When tube/head mounted into voxels and is harvesting void StartInVoxel(MyVoxelMap voxelMap) { // We found voxel so we stop here m_inVoxelMap = voxelMap; CurrentState = MyHarvestingDeviceEnum.InVoxel; StopTubeMovingCue(); StartGrindingCue(); m_lastTimeParticleAdded = null; m_parentMinerShip.Physics.Clear(); m_parentMinerShip.Physics.Immovable = true; MyMwcVector3Int tempVoxelCoord = voxelMap.GetVoxelCenterCoordinateFromMeters(ref m_headPositionTransformed); m_originalVoxelContent = voxelMap.GetVoxelContent(ref tempVoxelCoord); m_voxelMaterial = voxelMap.GetVoxelMaterial(ref tempVoxelCoord); m_harvestingParticleEffect = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Harvester_Harvesting); m_harvestingParticleEffect.UserBirthMultiplier = 0.25f; m_harvestingParticleEffect.UserRadiusMultiplier = 1; m_harvestingParticleEffect.UserColorMultiplier = new Vector4(3, 3, 3, 3); Matrix dirMatrix = MyMath.MatrixFromDir(WorldMatrix.Forward); m_harvestingParticleEffect.WorldMatrix = Matrix.CreateWorld(m_headPositionTransformed, dirMatrix.Forward, dirMatrix.Up); // Empty voxels are problematic and can lead to "extremely fast harvesting". So here we do this // trick and its effect will be that even empty voxels will take few seconds to harvest. if (m_originalVoxelContent == 0) m_originalVoxelContent = 1; m_actualVoxelContent = (float)m_originalVoxelContent; m_harvestingSpeed = m_actualVoxelContent / TIME_TO_HARVEST_WHOLE_VOXEL_IN_UPDATE_TIMES; if (!MyVoxelMapOreMaterials.CanBeHarvested(m_voxelMaterial)) { HUD.MyHud.ShowIndestructableAsteroidNotification(); StartReturningBack(); } }