Beispiel #1
0
        public static MyVoxelMaterialDefinition GetMaterialAt(this VRage.Game.Voxels.IMyStorage self, ref Vector3D localCoords)
        {
            Vector3I      lodVoxelRangeMin = Vector3D.Floor(localCoords / 1.0);
            MyStorageData target           = new MyStorageData(MyStorageDataTypeFlags.All);

            target.Resize(Vector3I.One);
            self.ReadRange(target, MyStorageDataTypeFlags.Material, 0, lodVoxelRangeMin, lodVoxelRangeMin);
            return(MyDefinitionManager.Static.GetVoxelMaterialDefinition(target.Material(0)));
        }
Beispiel #2
0
        public static MyVoxelMaterialDefinition GetMaterialAt(this VRage.Game.Voxels.IMyStorage self, ref Vector3I voxelCoords)
        {
            MyStorageData target = new MyStorageData(MyStorageDataTypeFlags.All);

            target.Resize(Vector3I.One);
            self.ReadRange(target, MyStorageDataTypeFlags.All, 0, voxelCoords, voxelCoords);
            byte materialIndex = target.Material(0);

            return((materialIndex != 0xff) ? MyDefinitionManager.Static.GetVoxelMaterialDefinition(materialIndex) : null);
        }