summaryrefslogtreecommitdiff
path: root/crystal.lua
blob: d8fcc730e47ba1d1fe9bac044e5936aeb96284d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
-- Crystal Spike (Hurts if you touch it - thanks to ZonerDarkRevention for his DokuCraft DeviantArt crystal texture)
minetest.register_node("ethereal:crystal_spike", {
	description = "Crystal Spike",
	drawtype = "plantlike",
	tiles = { "crystal_spike.png" },
	inventory_image = "crystal_spike.png",
	wield_image = "crystal_spike.png",
	paramtype = "light",
	light_source = LIGHT_MAX - 7,
	walkable = false,
	damage_per_second = 1,
	groups = {cracky=1,falling_node=1,puts_out_fire=1},
	sounds = default.node_sound_glass_defaults(),
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
	},
})

-- Crystal Ingot
minetest.register_craftitem("ethereal:crystal_ingot", {
	description = "Crystal Ingot",
	inventory_image = "crystal_ingot.png",
})

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

-- Crystal Block
minetest.register_node("ethereal:crystal_block", {
	description = "Crystal Block",
	tiles = {"crystal_block.png"},
	light_source = LIGHT_MAX - 5,
	groups = {cracky=1,level=2,puts_out_fire=1},
	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", {
	description = "Crystal Sword",
	inventory_image = "crystal_sword.png",
	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},
		},
		damage_groups = {fleshy=10},
	}
})

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

-- Crystal Axe
minetest.register_tool("ethereal:axe_crystal", {
	description = "Crystal Axe",
	inventory_image = "crystal_axe.png",
	tool_capabilities = {
		full_punch_interval = 0.8,
		max_drop_level=1,
		groupcaps={
			choppy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=30, maxlevel=2},
		},
		damage_groups = {fleshy=7},
	},
})

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

-- Crystal Pick (This will last a while)
minetest.register_tool("ethereal:pick_crystal", {
	description = "Crystal Pickaxe",
	inventory_image = "crystal_pick.png",
	tool_capabilities = {
		full_punch_interval = 0.7,
		max_drop_level=3,
		groupcaps={
			cracky = {times={[1]=1.8, [2]=0.8, [3]=0.40}, uses=40, maxlevel=3},
		},
		damage_groups = {fleshy=7},
	},
})

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

-- Crystal Shovel (with Soft Touch so player can dig up dirt with grass intact)
minetest.register_tool("ethereal:shovel_crystal", {
	description = "Crystal (soft touch) Shovel",
	inventory_image = "crystal_shovel.png",
	wield_image = "crystal_shovel.png^[transformR90",

	on_use = function(itemstack, user, pointed_thing)

		if pointed_thing.type == "node" then

		-- Check if node protected
		if not minetest.is_protected(pointed_thing.under, user:get_player_name()) then

			local pos = pointed_thing.under
			local nn = minetest.get_node(pos).name
			local is_crumbly = minetest.get_item_group(nn, "crumbly")

			-- Is node dirt, sand or gravel
			if is_crumbly == 1 or is_crumbly == 2 or is_crumbly == 3 then

				local inv = user:get_inventory()

				minetest.env:remove_node(pointed_thing.under)
				nodeupdate(pos)
				
				inv:add_item("main", {name = nn})
				itemstack:add_wear(65535/100) -- 111 uses
				minetest.sound_play("default_dirt_footstep", {pos = pos, gain = 0.35})
				return itemstack
			end

		end
		end

	end,
})

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, great for exploring underwater)
minetest.register_tool("ethereal:crystal_gilly_staff", {
	description = "Crystal Gilly Staff",
	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({
	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", ""},
	}
})