summaryrefslogtreecommitdiff
path: root/castle_masonry/murder_holes.lua
blob: 090c3998f7ed9e1ec431c250a008beee2c506f94 (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
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")

-------------------------------------------------------------------------------------

castle_masonry.register_murderhole = function(material)
	local composition_def, burn_time, tile, desc = castle_masonry.get_material_properties(material)
	local mod_name = minetest.get_current_modname()
	
	-- Node Definition
	minetest.register_node(mod_name..":hole_"..material.name, {
		drawtype = "nodebox",
		description = S("@1 Murder Hole", desc),
		tiles = tile,
		groups = composition_def.groups,
		sounds = composition_def.sounds,
		paramtype = "light",
		paramtype2 = "facedir",
		node_box = {
			type = "fixed",
			fixed = {
				{-8/16,-8/16,-8/16,-4/16,8/16,8/16},
				{4/16,-8/16,-8/16,8/16,8/16,8/16},
				{-4/16,-8/16,-8/16,4/16,8/16,-4/16},
				{-4/16,-8/16,8/16,4/16,8/16,4/16},
			},
		},
	})
	
	minetest.register_node(mod_name..":machicolation_"..material.name, {
		drawtype = "nodebox",
		description = S("@1 Machicolation", desc),
		tiles = tile,
		groups = composition_def.groups,
		sounds = composition_def.sounds,
		paramtype = "light",
		paramtype2 = "facedir",
		node_box = {
			type = "fixed",
			fixed = {
				{-0.5, 0, -0.5, 0.5, 0.5, 0},
				{-0.5, -0.5, 0, -0.25, 0.5, 0.5},
				{0.25, -0.5, 0, 0.5, 0.5, 0.5},
			},
		},
	})

	minetest.register_craft({
		output = mod_name..":hole_"..material.name.." 4",
		recipe = {
			{"",material.craft_material, "" },
			{material.craft_material,"", material.craft_material},
			{"",material.craft_material, ""}
		},
	})

	minetest.register_craft({
		output = mod_name..":machicolation_"..material.name,
		type="shapeless",
		recipe = {mod_name..":hole_"..material.name},
	})
	minetest.register_craft({
		output = mod_name..":hole_"..material.name,
		type="shapeless",
		recipe = {mod_name..":machicolation_"..material.name},
	})
	
	if burn_time > 0 then
		minetest.register_craft({
			type = "fuel",
			recipe = mod_name..":hole_"..material.name,
			burntime = burn_time,
		})
		minetest.register_craft({
			type = "fuel",
			recipe = mod_name..":machicolation_"..material.name,
			burntime = burn_time,
		})	
	end
end

castle_masonry.register_murderhole_alias = function(old_mod_name, old_material_name, new_mod_name, new_material_name)
	minetest.register_alias(old_mod_name..":hole_"..old_material_name,			new_mod_name..":hole_"..new_material_name)
	minetest.register_alias(old_mod_name..":machicolation_"..old_material_name,	new_mod_name..":machicolation_"..new_material_name)
end

castle_masonry.register_murderhole_alias_force = function(old_mod_name, old_material_name, new_mod_name, new_material_name)
	minetest.register_alias_force(old_mod_name..":hole_"..old_material_name,			new_mod_name..":hole_"..new_material_name)
	minetest.register_alias_force(old_mod_name..":machicolation_"..old_material_name,	new_mod_name..":machicolation_"..new_material_name)
end