minetest.register_node('epic:stone', {
   description = 'Stone',
   tiles = {'default_stone.png'},
   groups = {cracky = 2, stone = 1},
   drop = {
      max_items = 2,
      items = {
         {items = {'epic:float_crystal_shard'}, rarity = 50,},
         {items = {'default:cobble'}},
      }
   },
   sounds = default.node_sound_stone_defaults(),
})

minetest.register_node('epic:titanium_block', {
   description = 'Titanium Block',
   tiles = {{name='epic_titanium_block.png', align_style='world', scale=4}},
   inventory_image = '[inventorycube{epic_titanium_block.png&[sheet:4x4:1,1{epic_titanium_block.png&[sheet:4x4:1,1{epic_titanium_block.png&[sheet:4x4:1,1',
   groups = {cracky = 1, level = 2},
   sounds = default.node_sound_metal_defaults(),
})

minetest.register_node('epic:border', {
   description = 'Invisible Border',
   drawtype = 'airlike',
   paramtype = 'light',
   pointable = false,
   tiles = {'epic_blank.png'},
   groups = {not_in_creative_inventory=1},
})

minetest.register_node('epic:sand', {
   description = 'Sand',
   tiles = {'default_sand.png'},
   groups = {not_in_creative_inventory=1, crumbly=3, falling_node=1, sand=1},
   sounds = default.node_sound_sand_defaults(),
      drop = {
      max_items = 2,
      items = {
         {
         items = {'food:oyster_raw'},
         rarity = 2,
         },
         {
         items = {'food:mussel_raw'},
         rarity = 2,
         },
         {
         items = {'default:sand'},
         },
         },
      },
})

minetest.register_node('epic:float_stone', {
   description = 'Actinolite',
   light_source = 3,
   tiles = {'epic_actinolite_top.png', 'default_stone.png', 'epic_actinolite_side.png'},
   groups = {cracky = 2, stone = 1, level = 4},
   drop = 'epic:float_crystal 4',
   sounds = default.node_sound_stone_defaults(),
   on_timer = function(pos)
      local new_pos = ({x=pos.x, y=pos.y+1, z=pos.z})
      local abovenode = minetest.get_node(new_pos).name
      if abovenode == 'air' then
         minetest.set_node(new_pos, {name='epic:float_stone'})
         minetest.set_node(pos, {name='air'})
         local timer = minetest.get_node_timer(new_pos)
         timer:start(1)
      end
   end,
})

minetest.register_node('epic:floating_base', {
   description = 'Laputa',
   light_source = 1,
   tiles = {'epic_laputa.png'},
   groups = {cracky = 2, stone = 1, level = 3, not_in_creative_inventory=1},
   drop = {
      max_items = 3,
      items = {
         {items = {'epic:float_crystal 2'}, rarity = 1},
         {items = {'epic:float_crystal 3'}, rarity = 3},
         {items = {'default:diamond 4'}, rarity = 1},
         {items = {'default:diamond 5'}, rarity = 3},
         {items = {'default:mese_crystal 4'}, rarity = 1},
         {items = {'default:mese_crystal 5'}, rarity = 3},
         },
      },
   sounds = default.node_sound_stone_defaults(),
   on_timer = function(pos)
      local new_pos = ({x=pos.x, y=pos.y+1, z=pos.z})
      local abovenode = minetest.get_node(new_pos).name
      if abovenode == 'air' then
         minetest.set_node(new_pos, {name='epic:floating_base'})
         minetest.set_node(pos, {name='air'})
         local timer = minetest.get_node_timer(new_pos)
         timer:start(10)
      end
   end,
   on_construct = function(pos)
      local timer = minetest.get_node_timer(pos)
      timer:start(30)
   end,
})

minetest.register_node('epic:stone_with_titanium', {
   description = 'Netherrack with Titanium',
   tiles = {'nether_rack.png^epic_titanium_ore.png'},
   groups = {cracky = 1, stone = 1},
   drop = 'epic:titanium_lump',
   sounds = default.node_sound_stone_defaults(),
})

minetest.register_node('epic:nether_with_gold', {
   description = 'Netherrack with Gold',
   tiles = {'nether_rack.png^default_mineral_gold.png'},
   groups = {cracky = 1, stone = 1},
   drop = 'default:gold_lump 2',
   sounds = default.node_sound_stone_defaults(),
})

minetest.register_node('epic:nether_with_diamond', {
   description = 'Netherrack with Diamond',
   tiles = {'nether_rack.png^default_mineral_diamond.png'},
   groups = {cracky = 1, stone = 1},
   drop = 'default:diamond 2',
   sounds = default.node_sound_stone_defaults(),
})

minetest.register_node('epic:nether_basalt_with_huntite', {
   description = 'Basalt with Huntite',
   tiles = {
      "epic_huntite_basalt.png",
      "nether_basalt.png",
      "nether_basalt_side.png^epic_huntite_ore.png",
   },
   groups = {cracky = 1, stone = 1},
   drop = 'epic:huntite 2',
   sounds = default.node_sound_stone_defaults(),
})

minetest.register_node('epic:tree_ash', {
   description = 'Burnt tree',
   paramtype2 = 'facedir',
   tiles = {'epic_tree_ash_top.png', 'epic_tree_ash_top.png', 'epic_tree_ash_side.png'},
   groups = {choppy = 3, oddly_breakable_by_hand = 3},
   on_place = minetest.rotate_node
})

minetest.register_node('epic:wood_ash', {
   description = 'Burnt wood',
   tiles = {'epic_wood_ash.png'},
   groups = {choppy = 3, oddly_breakable_by_hand = 3},
})

minetest.register_node('epic:scorched_dirt', {
   description = 'Scorched dirt',
   tiles = {{name='epic_scorched_dirt.png', align_style='world', scale=4}},
   inventory_image = '[inventorycube{epic_scorched_dirt.png&[sheet:4x4:1,1{epic_scorched_dirt.png&[sheet:4x4:1,1{epic_scorched_dirt.png&[sheet:4x4:1,1',
   groups = {crumbly = 3},
})

minetest.register_node('epic:stone_with_salt', {
   description = 'Salt crystals',
   tiles = {'default_stone.png^epic_salt_ore.png'},
   is_ground_content = true,
   sounds = default.node_sound_stone_defaults(),
   drop = 'epic:salt_lump',
   groups = {cracky = 3},
})

minetest.register_node('epic:desert_stone_with_nitre', {
   description = 'Nitre ore',
   tiles = {'default_desert_stone.png^epic_nitre_ore.png'},
   is_ground_content = true,
   sounds = default.node_sound_stone_defaults(),
   drop = 'epic:potassium_nitrate',
   groups = {cracky = 2},
})

minetest.register_node('epic:mineral_sulfur', {
   description = 'Sulfur Ore',
   tiles = {'default_stone.png^epic_mineral_sulfur.png'},
   is_ground_content = true,
   groups = {cracky=2},
   sounds = default.node_sound_stone_defaults(),
   drop = 'epic:sulfur_lump',
})

minetest.register_node('epic:metal_lead', {
   description = 'Lead Ore',
   tiles = {'default_stone.png^epic_metal_lead.png'},
   is_ground_content = true,
   groups = {cracky=2},
   sounds = default.node_sound_stone_defaults(),
   drop = 'epic:lead_lump',
})

minetest.register_node('epic:desert_garnet', {
   description = 'Garnet crystal',
   tiles = {'default_desert_stone.png^epic_garnet_ore.png'},
   is_ground_content = true,
   sounds = default.node_sound_stone_defaults(),
   drop = 'epic:garnet',
   groups = {cracky = 1, level = 2},
})

minetest.register_node('epic:stone_garnet', {
   description = 'Garnet crystal',
   tiles = {'default_stone.png^epic_garnet_ore.png'},
   is_ground_content = true,
   sounds = default.node_sound_stone_defaults(),
   drop = 'epic:garnet',
   groups = {cracky = 1, level = 2},
})

minetest.register_node('epic:desert_stone_with_coal', {
   description = 'Coal Ore',
   tiles = {'default_desert_stone.png^default_mineral_coal.png'},
   groups = {cracky = 3},
   drop = 'default:coal_lump',
   sounds = default.node_sound_stone_defaults(),
})

minetest.register_node('epic:desert_stone_with_iron', {
   description = 'Iron Ore',
   tiles = {'default_desert_stone.png^default_mineral_iron.png'},
   groups = {cracky = 2},
   drop = 'default:iron_lump',
   sounds = default.node_sound_stone_defaults(),
})

minetest.register_node('epic:bloodstone_ore', {
   description = 'Bloodstone Ore',
   tiles = {'default_stone.png^epic_bloodstone_ore.png'},
   is_ground_content = true,
   sounds = default.node_sound_stone_defaults(),
   drop = 'epic:bloodstone',
   groups = {cracky = 2, level = 2},
})

minetest.register_node('epic:3grass_brick', {
   description = 'Grass with Stone Brick',
   drawtype = 'mesh',
   mesh = 'epic_triangle.obj',
   tiles = {'default_stone_brick.png', 'default_grass.png', 'default_dirt.png^default_grass_side.png'},
   paramtype = 'light',
   paramtype2 = 'facedir',
   groups = {cracky = 2, crumbly = 2},
})

minetest.register_node('epic:3brick_grass', {
   description = 'Stone Brick with Grass',
   drawtype = 'mesh',
   mesh = 'epic_triangle.obj',
   tiles = {'default_grass.png', 'default_stone_brick.png', 'default_dirt.png^default_grass_side.png'},
   paramtype = 'light',
   paramtype2 = 'facedir',
   groups = {cracky = 2, crumbly = 2},
})

minetest.register_node('epic:3dirt_cobble', {
   description = 'Dirt with Cobble',
   drawtype = 'mesh',
   mesh = 'epic_triangle.obj',
   tiles = {'default_dirt.png', 'default_cobble.png', 'default_dirt.png'},
   paramtype = 'light',
   paramtype2 = 'facedir',
   groups = {cracky = 2, crumbly = 2},
})

minetest.register_node('epic:3cobble_dirt', {
   description = 'Cobble with Dirt',
   drawtype = 'mesh',
   mesh = 'epic_triangle.obj',
   tiles = {'default_cobble.png', 'default_dirt.png', 'default_dirt.png'},
   paramtype = 'light',
   paramtype2 = 'facedir',
   groups = {cracky = 2, crumbly = 2},
})

minetest.register_node('epic:poison', {
   description = 'Animal poison',
   drawtype = 'signlike',
   tiles = {'epic_animal_poison.png'},
   inventory_image = 'epic_animal_poison.png',
   wield_image = 'epic_animal_poison.png',
   paramtype = 'light',
   paramtype2 = 'wallmounted',
   sunlight_propagates = true,
   selection_box = {
      type = 'fixed',
      fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
   },
   collision_box = {
      type = 'fixed',
      fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
   },
   groups = {dig_immediate = 3, attached_node = 1},
})

local function flood_flame(pos, oldnode, newnode)
   -- Play flame extinguish sound if liquid is not an 'igniter'
   local nodedef = minetest.registered_items[newnode.name]
   if not (nodedef and nodedef.groups and
         nodedef.groups.igniter and nodedef.groups.igniter > 0) then
      minetest.sound_play('fire_extinguish_flame',
         {pos = pos, max_hear_distance = 16, gain = 0.15})
   end
   -- Remove the flame
   return false
end

minetest.register_node('epic:permanent_flame', {
   description = 'Permanent Flame',
   drawtype = 'firelike',
   tiles = {
      {
         name = 'fire_basic_flame_animated.png',
         animation = {
            type = 'vertical_frames',
            aspect_w = 16,
            aspect_h = 16,
            length = 1
         },
      },
   },
   inventory_image = 'fire_basic_flame.png',
   paramtype = 'light',
   light_source = 13,
   walkable = false,
   buildable_to = true,
   sunlight_propagates = true,
   floodable = true,
   damage_per_second = 4,
   groups = {dig_immediate = 3},
   drop = '',

   on_flood = flood_flame,
})

minetest.register_node('epic:empty', {
   description = 'empty node :P',
   drawtype = 'airlike',
   paramtype = 'light',
   walkable = true,
   pointable = false,
   diggable = false,
   drop = '',
   groups = {not_in_creative_inventory = 1, empty_node=1},
   on_blast = function() end,
   tiles = {'epic_blank.png'},
   node_box = {
      type = 'fixed',
      fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32}
   },
})

minetest.register_node('epic:acacia_bark', {
   description = 'Acacia bark',
   tiles = {'default_acacia_tree.png'},
   groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
   sounds = default.node_sound_wood_defaults(),
})

minetest.register_node('epic:aspen_bark', {
   description = 'Aspen bark',
   tiles = {'default_aspen_tree.png'},
   groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
   sounds = default.node_sound_wood_defaults(),
})

minetest.register_node('epic:jungle_bark', {
   description = 'Jungle bark',
   tiles = {'default_jungletree.png'},
   groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
   sounds = default.node_sound_wood_defaults(),
})

minetest.register_node('epic:pine_bark', {
   description = 'Pine bark',
   tiles = {'default_pine_tree.png'},
   groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
   sounds = default.node_sound_wood_defaults(),
})

minetest.register_node('epic:tree_bark', {
   description = 'Tree bark',
   tiles = {'default_tree.png'},
   groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
   sounds = default.node_sound_wood_defaults(),
})
