Change crafting recipes to be more interesting
[mesecons_window.git] / init.lua
blobfc814ccd9185d3ae3d7e02502a72fc78964ef092
1 -- Window Block
3 local sfx
4 if minetest.get_modpath("default") then
5 sfx = default.node_sound_glass_defaults()
6 end
8 minetest.register_node("mesecons_window:window_closed", {
9 description="Mesecon Window",
10 _doc_items_longdesc = "A Mesecon receptor which is opaque when it isn't powered and is fully transparent to light and sunlight when powered.",
11 tiles = {"mesecons_window_closed.png"},
12 is_ground_content = false,
13 groups = {cracky=3, oddly_breakable_by_hand=3},
14 sounds = sfx,
15 mesecons = {conductor = {
16 state = mesecon.state.off,
17 rules = { --axes
18 {x = -1, y = 0, z = 0},
19 {x = 1, y = 0, z = 0},
20 {x = 0, y = -1, z = 0},
21 {x = 0, y = 1, z = 0},
22 {x = 0, y = 0, z = -1},
23 {x = 0, y = 0, z = 1},
25 onstate = "mesecons_window:window_open"
29 minetest.register_node("mesecons_window:window_open", {
30 description="Mesecon Window",
31 _doc_items_create_entry = false,
32 drawtype = "glasslike_framed",
33 sunlight_propagates = true,
34 tiles = {"mesecons_window_open.png", "mesecons_window_open_detail.png"},
35 is_ground_content = false,
36 paramtype = "light",
37 groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
38 drop = "mesecons_window:window_closed",
39 sounds = sfx,
40 mesecons = {conductor = {
41 state = mesecon.state.on,
42 rules = {
43 {x = -1, y = 0, z = 0},
44 {x = 1, y = 0, z = 0},
45 {x = 0, y = -1, z = 0},
46 {x = 0, y = 1, z = 0},
47 {x = 0, y = 0, z = -1},
48 {x = 0, y = 0, z = 1},
50 offstate = "mesecons_window:window_closed"
51 }},
52 on_construct = function(pos)
53 -- remove shadow
54 shadowpos = vector.add(pos, vector.new(0, 1, 0))
55 if (minetest.get_node(shadowpos).name == "air") then
56 minetest.dig_node(shadowpos)
57 end
58 end
61 minetest.register_node("mesecons_window:filter_closed", {
62 description="Mesecon Filter Window",
63 tiles = {"mesecons_filter_closed.png"},
64 _doc_items_longdesc = "A Mesecon receptor which is opaque when it isn't powered and is semi-transparent to light when powered.",
65 is_ground_content = false,
66 groups = {cracky=3, oddly_breakable_by_hand=3},
67 sounds = sfx,
68 mesecons = {conductor = {
69 state = mesecon.state.off,
70 rules = { --axes
71 {x = -1, y = 0, z = 0},
72 {x = 1, y = 0, z = 0},
73 {x = 0, y = -1, z = 0},
74 {x = 0, y = 1, z = 0},
75 {x = 0, y = 0, z = -1},
76 {x = 0, y = 0, z = 1},
78 onstate = "mesecons_window:filter_open"
82 minetest.register_node("mesecons_window:filter_open", {
83 description="Mesecon Filter Window",
84 drawtype = "glasslike_framed",
85 _doc_items_create_entry = false,
86 sunlight_propagates = false,
87 tiles = {"mesecons_filter_open.png", "mesecons_filter_open_detail.png"},
88 is_ground_content = false,
89 paramtype = "light",
90 groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
91 drop = "mesecons_window:filter_closed",
92 sounds = sfx,
93 mesecons = {conductor = {
94 state = mesecon.state.on,
95 rules = {
96 {x = -1, y = 0, z = 0},
97 {x = 1, y = 0, z = 0},
98 {x = 0, y = -1, z = 0},
99 {x = 0, y = 1, z = 0},
100 {x = 0, y = 0, z = -1},
101 {x = 0, y = 0, z = 1},
103 offstate = "mesecons_window:filter_closed"
105 on_construct = function(pos)
106 -- remove shadow
107 shadowpos = vector.add(pos, vector.new(0, 1, 0))
108 if (minetest.get_node(shadowpos).name == "air") then
109 minetest.dig_node(shadowpos)
114 minetest.register_node("mesecons_window:filter2_closed", {
115 description="Mesecon Filter Glass",
116 _doc_items_longdesc = "A Mesecon receptor which lets light through. When not powered, it is semi-transparent, i.e. it is transparent to light, but filters out sunlight. When powered, it is fully transparent to light and sunlight.",
117 drawtype="glasslike_framed",
118 tiles = {"mesecons_filter2_closed.png", "mesecons_filter2_closed_detail.png"},
119 is_ground_content = false,
120 groups = {cracky=3, oddly_breakable_by_hand=3},
121 sounds = sfx,
122 paramtype = "light",
123 sunlight_propagates = false,
124 mesecons = {conductor = {
125 state = mesecon.state.off,
126 rules = { --axes
127 {x = -1, y = 0, z = 0},
128 {x = 1, y = 0, z = 0},
129 {x = 0, y = -1, z = 0},
130 {x = 0, y = 1, z = 0},
131 {x = 0, y = 0, z = -1},
132 {x = 0, y = 0, z = 1},
134 onstate = "mesecons_window:filter2_open"
136 on_construct = function(pos)
137 -- remove shadow
138 shadowpos = vector.add(pos, vector.new(0, 1, 0))
139 if (minetest.get_node(shadowpos).name == "air") then
140 minetest.dig_node(shadowpos)
145 minetest.register_node("mesecons_window:filter2_open", {
146 description="Mesecon Filter Glass",
147 _doc_items_create_entry = false,
148 drawtype = "glasslike_framed",
149 sunlight_propagates = false,
150 tiles = {"mesecons_filter2_open.png", "mesecons_filter2_open_detail.png"},
151 is_ground_content = false,
152 paramtype = "light",
153 sunlight_propagates = true,
154 groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
155 drop = "mesecons_window:filter2_closed",
156 sounds = sfx,
157 mesecons = {conductor = {
158 state = mesecon.state.on,
159 rules = {
160 {x = -1, y = 0, z = 0},
161 {x = 1, y = 0, z = 0},
162 {x = 0, y = -1, z = 0},
163 {x = 0, y = 1, z = 0},
164 {x = 0, y = 0, z = -1},
165 {x = 0, y = 0, z = 1},
167 offstate = "mesecons_window:filter2_closed"
169 on_construct = function(pos)
170 -- remove shadow
171 shadowpos = vector.add(pos, vector.new(0, 1, 0))
172 if (minetest.get_node(shadowpos).name == "air") then
173 minetest.dig_node(shadowpos)
178 if minetest.get_modpath("default") then
179 minetest.register_craft({
180 output = 'mesecons_window:window_closed 3',
181 recipe = {
182 {"default:cobble", "default:cobble", "default:cobble"},
183 {"", "group:mesecon_conductor_craftable", ""},
184 {"default:glass", "default:glass", "default:glass"},
188 minetest.register_craft({
189 output = 'mesecons_window:filter_closed 3',
190 recipe = {
191 {"default:cobble", "default:cobble", "default:cobble"},
192 {"default:ice", "group:mesecon_conductor_craftable", "default:ice"},
193 {"default:glass", "default:glass", "default:glass"},
197 minetest.register_craft({
198 output = 'mesecons_window:filter2_closed 3',
199 recipe = {
200 {"group:leaves", "group:leaves", "group:leaves"}
201 {"", "group:mesecon_conductor_craftable", ""},
202 {"default:glass", "default:glass", "default:glass"},
208 if minetest.get_modpath("doc") then
209 doc.add_entry_alias("nodes", "mesecons_window:window_closed", "nodes", "mesecons_window:window_open")
210 doc.add_entry_alias("nodes", "mesecons_window:filter_closed", "nodes", "mesecons_window:filter_open")
211 doc.add_entry_alias("nodes", "mesecons_window:filter2_closed", "nodes", "mesecons_window:filter2_open")