Skip to content
Snippets Groups Projects
crystal.lua 6.53 KiB
Newer Older
TenPlus1's avatar
TenPlus1 committed

local S = ethereal.intllib

tenplus1's avatar
tenplus1 committed
-- Crystal Spike (Hurts if you touch it - thanks to ZonerDarkRevention for his DokuCraft DeviantArt crystal texture)
minetest.register_node("ethereal:crystal_spike", {
TenPlus1's avatar
TenPlus1 committed
	description = S("Crystal Spike"),
tenplus1's avatar
tenplus1 committed
	drawtype = "plantlike",
	tiles = { "crystal_spike.png" },
	inventory_image = "crystal_spike.png",
	wield_image = "crystal_spike.png",
	paramtype = "light",
	sunlight_propagates = true,
tenplus1's avatar
tenplus1 committed
	walkable = false,
	damage_per_second = 1,
	groups = {cracky = 1, falling_node = 1, puts_out_fire = 1, cools_lava = 1},
tenplus1's avatar
tenplus1 committed
	sounds = default.node_sound_glass_defaults(),
	selection_box = {
		type = "fixed",
		fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 0.41, 5 / 16},
tenplus1's avatar
tenplus1 committed
	},
})

-- Crystal Ingot
minetest.register_craftitem("ethereal:crystal_ingot", {
TenPlus1's avatar
TenPlus1 committed
	description = S("Crystal Ingot"),
tenplus1's avatar
tenplus1 committed
	inventory_image = "crystal_ingot.png",
TenPlus1's avatar
TenPlus1 committed
	wield_image = "crystal_ingot.png",
tenplus1's avatar
tenplus1 committed
})

minetest.register_craft({
	output = "ethereal:crystal_ingot",
	recipe = {
		{"default:mese_crystal", "ethereal:crystal_spike"},
		{"ethereal:crystal_spike", "default:mese_crystal"},
minetest.register_craft({
	output = "ethereal:crystal_ingot",
	recipe = {
		{"ethereal:crystal_spike", "default:mese_crystal"},
		{"default:mese_crystal", "ethereal:crystal_spike"},
	}
})

tenplus1's avatar
tenplus1 committed
-- Crystal Block
minetest.register_node("ethereal:crystal_block", {
TenPlus1's avatar
TenPlus1 committed
	description = S("Crystal Block"),
tenplus1's avatar
tenplus1 committed
	tiles = {"crystal_block.png"},
tenplus1's avatar
tenplus1 committed
	is_ground_content = false,
	groups = {cracky = 1, level = 2, puts_out_fire = 1, cools_lava = 1},
tenplus1's avatar
tenplus1 committed
	sounds = default.node_sound_glass_defaults(),
})

minetest.register_craft({
	output = "ethereal:crystal_block",
	recipe = {
		{"ethereal:crystal_ingot", "ethereal:crystal_ingot", "ethereal:crystal_ingot"},
		{"ethereal:crystal_ingot", "ethereal:crystal_ingot", "ethereal:crystal_ingot"},
		{"ethereal:crystal_ingot", "ethereal:crystal_ingot", "ethereal:crystal_ingot"},
	}
})

minetest.register_craft({
	output = "ethereal:crystal_ingot 9",
	recipe = {
		{"ethereal:crystal_block"},
	}
})

-- Crystal Sword (Powerful wee beastie)
minetest.register_tool("ethereal:sword_crystal", {
TenPlus1's avatar
TenPlus1 committed
	description = S("Crystal Sword"),
tenplus1's avatar
tenplus1 committed
	inventory_image = "crystal_sword.png",
TenPlus1's avatar
TenPlus1 committed
	wield_image = "crystal_sword.png",
tenplus1's avatar
tenplus1 committed
	tool_capabilities = {
		full_punch_interval = 0.6,
		max_drop_level = 1,
		groupcaps = {
			snappy = {
				times = {[1] = 1.70, [2] = 0.70, [3] = 0.25},
				uses = 50,
				maxlevel = 3
			},
tenplus1's avatar
tenplus1 committed
		},
		damage_groups = {fleshy = 10},
	},
	sound = {breaks = "default_tool_breaks"},
tenplus1's avatar
tenplus1 committed
})

minetest.register_craft({
	output = "ethereal:sword_crystal",
	recipe = {
		{"ethereal:crystal_ingot"},
		{"ethereal:crystal_ingot"},
		{"default:steel_ingot"},
tenplus1's avatar
tenplus1 committed
	}
})

-- Crystal Axe
minetest.register_tool("ethereal:axe_crystal", {
TenPlus1's avatar
TenPlus1 committed
	description = S("Crystal Axe"),
tenplus1's avatar
tenplus1 committed
	inventory_image = "crystal_axe.png",
TenPlus1's avatar
TenPlus1 committed
	wield_image = "crystal_axe.png",
tenplus1's avatar
tenplus1 committed
	tool_capabilities = {
		full_punch_interval = 0.8,
		max_drop_level = 1,
		groupcaps = {
			choppy = {
				times = {[1] = 2.00, [2] = 0.80, [3] = 0.40},
				uses = 40,
				maxlevel = 3
tenplus1's avatar
tenplus1 committed
		},
		damage_groups = {fleshy = 7},
tenplus1's avatar
tenplus1 committed
	},
	sound = {breaks = "default_tool_breaks"},
tenplus1's avatar
tenplus1 committed
})

minetest.register_craft({
	output = 'ethereal:axe_crystal',
	recipe = {
		{'ethereal:crystal_ingot', 'ethereal:crystal_ingot'},
		{'ethereal:crystal_ingot', 'default:steel_ingot'},
		{'', 'default:steel_ingot'},
	}
})

minetest.register_craft({
	output = 'ethereal:axe_crystal',
	recipe = {
		{'ethereal:crystal_ingot', 'ethereal:crystal_ingot'},
		{'default:steel_ingot', 'ethereal:crystal_ingot'},
		{'default:steel_ingot', ''},
	}
})

tenplus1's avatar
tenplus1 committed
-- Crystal Pick (This will last a while)
minetest.register_tool("ethereal:pick_crystal", {
TenPlus1's avatar
TenPlus1 committed
	description = S("Crystal Pickaxe"),
tenplus1's avatar
tenplus1 committed
	inventory_image = "crystal_pick.png",
TenPlus1's avatar
TenPlus1 committed
	wield_image = "crystal_pick.png",
tenplus1's avatar
tenplus1 committed
	tool_capabilities = {
		full_punch_interval = 0.7,
		max_drop_level = 3,
tenplus1's avatar
tenplus1 committed
		groupcaps={
			cracky = {
				times = {[1] = 1.8, [2] = 0.8, [3] = 0.40},
				uses = 40,
				maxlevel = 3
			},
tenplus1's avatar
tenplus1 committed
		},
		damage_groups = {fleshy = 6},
tenplus1's avatar
tenplus1 committed
	},
	sound = {breaks = "default_tool_breaks"},
tenplus1's avatar
tenplus1 committed
})

minetest.register_craft({
	output = "ethereal:pick_crystal",
	recipe = {
		{"ethereal:crystal_ingot", "ethereal:crystal_ingot", "ethereal:crystal_ingot"},
		{"", "default:steel_ingot", ""},
		{"", "default:steel_ingot", ""},
	}
})

local old_handle_node_drops = minetest.handle_node_drops
tenplus1's avatar
tenplus1 committed

function minetest.handle_node_drops(pos, drops, digger)
tenplus1's avatar
tenplus1 committed

	-- are we holding Crystal Shovel?
	if digger:get_wielded_item():get_name() ~= "ethereal:shovel_crystal" then
		return old_handle_node_drops(pos, drops, digger)
	end
	local nn = minetest.get_node(pos).name
	if minetest.get_item_group(nn, "crumbly") == 0 then
		return old_handle_node_drops(pos, drops, digger)
	end
	return old_handle_node_drops(pos, {ItemStack(nn)}, digger)
end
tenplus1's avatar
tenplus1 committed

minetest.register_tool("ethereal:shovel_crystal", {
	description = "Crystal Shovel",
	inventory_image = "crystal_shovel.png",
	wield_image = "crystal_shovel.png^[transformR90",
	tool_capabilities = {
		full_punch_interval = 1.0,
		max_drop_level=1,
		groupcaps={
			crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3},
		},
		damage_groups = {fleshy=4},
	},
	sound = {breaks = "default_tool_breaks"},
tenplus1's avatar
tenplus1 committed
})

minetest.register_craft({
	output = "ethereal:shovel_crystal",
	recipe = {
		{"ethereal:crystal_ingot"},
		{"default:steel_ingot"},
		{"default:steel_ingot"},
-- Crystal Gilly Staff (replenishes air supply when used)
tenplus1's avatar
tenplus1 committed
minetest.register_tool("ethereal:crystal_gilly_staff", {
TenPlus1's avatar
TenPlus1 committed
	description = S("Crystal Gilly Staff"),
tenplus1's avatar
tenplus1 committed
	inventory_image = "crystal_gilly_staff.png",
	wield_image = "crystal_gilly_staff.png",

	on_use = function(itemstack, user, pointed_thing)
		if user:get_breath() < 10 then
			user:set_breath(10)
		end
	end,
})

minetest.register_craft({
	type = "shapeless",
tenplus1's avatar
tenplus1 committed
	output = "ethereal:crystal_gilly_staff",
	recipe = {
		"ethereal:green_moss", "ethereal:gray_moss", "ethereal:fiery_moss",
		"ethereal:crystal_moss", "ethereal:crystal_ingot", "ethereal:mushroom_moss",
		"ethereal:crystal_ingot"
	},

-- Add [toolranks] mod support if found
if minetest.get_modpath("toolranks") then

minetest.override_item("ethereal:pick_crystal", {
	original_description = "Crystal Pickaxe",
	description = toolranks.create_description("Crystal Pickaxe", 0, 1),
	after_use = toolranks.new_afteruse})

minetest.override_item("ethereal:axe_crystal", {
	original_description = "Crystal Axe",
	description = toolranks.create_description("Crystal Axe", 0, 1),
	after_use = toolranks.new_afteruse})

minetest.override_item("ethereal:shovel_crystal", {
	original_description = "Crystal Shovel",
	description = toolranks.create_description("Crystal Shovel", 0, 1),
	after_use = toolranks.new_afteruse})
end