Add screenshot and description
[mesecons_window.git] / init.lua
blob6a1d989a6a3b59316e692fcb80796114618971a6
1 -- Window Block
3 minetest.register_node("mesecons_window:window_closed", {
4 description="Mesecon Window",
5 _doc_items_longdesc = "A Mesecon receptor which is opaque when it isn't powered and is fully transparent to light and sunlight when powered.",
6 tiles = {"mesecons_window_closed.png"},
7 is_ground_content = false,
8 groups = {cracky=3, oddly_breakable_by_hand=3},
9 sounds = default.node_sound_glass_defaults(),
10 mesecons = {conductor = {
11 state = mesecon.state.off,
12 rules = { --axes
13 {x = -1, y = 0, z = 0},
14 {x = 1, y = 0, z = 0},
15 {x = 0, y = -1, z = 0},
16 {x = 0, y = 1, z = 0},
17 {x = 0, y = 0, z = -1},
18 {x = 0, y = 0, z = 1},
20 onstate = "mesecons_window:window_open"
24 minetest.register_node("mesecons_window:window_open", {
25 description="Mesecon Window",
26 _doc_items_create_entry = false,
27 drawtype = "glasslike_framed",
28 sunlight_propagates = true,
29 tiles = {"mesecons_window_open.png", "mesecons_window_open_detail.png"},
30 is_ground_content = false,
31 paramtype = "light",
32 groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
33 drop = "mesecons_window:window_closed",
34 sounds = default.node_sound_glass_defaults(),
35 mesecons = {conductor = {
36 state = mesecon.state.on,
37 rules = {
38 {x = -1, y = 0, z = 0},
39 {x = 1, y = 0, z = 0},
40 {x = 0, y = -1, z = 0},
41 {x = 0, y = 1, z = 0},
42 {x = 0, y = 0, z = -1},
43 {x = 0, y = 0, z = 1},
45 offstate = "mesecons_window:window_closed"
46 }},
47 on_construct = function(pos)
48 -- remove shadow
49 shadowpos = vector.add(pos, vector.new(0, 1, 0))
50 if (minetest.get_node(shadowpos).name == "air") then
51 minetest.dig_node(shadowpos)
52 end
53 end
56 minetest.register_node("mesecons_window:filter_closed", {
57 description="Mesecon Filter Window",
58 tiles = {"mesecons_filter_closed.png"},
59 _doc_items_longdesc = "A Mesecon receptor which is opaque when it isn't powered and is semi-transparent to light when powered.",
60 is_ground_content = false,
61 groups = {cracky=3, oddly_breakable_by_hand=3},
62 sounds = default.node_sound_glass_defaults(),
63 mesecons = {conductor = {
64 state = mesecon.state.off,
65 rules = { --axes
66 {x = -1, y = 0, z = 0},
67 {x = 1, y = 0, z = 0},
68 {x = 0, y = -1, z = 0},
69 {x = 0, y = 1, z = 0},
70 {x = 0, y = 0, z = -1},
71 {x = 0, y = 0, z = 1},
73 onstate = "mesecons_window:filter_open"
77 minetest.register_node("mesecons_window:filter_open", {
78 description="Mesecon Filter Window",
79 drawtype = "glasslike_framed",
80 _doc_items_create_entry = false,
81 sunlight_propagates = false,
82 tiles = {"mesecons_filter_open.png", "mesecons_filter_open_detail.png"},
83 is_ground_content = false,
84 paramtype = "light",
85 groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
86 drop = "mesecons_window:filter_closed",
87 sounds = default.node_sound_glass_defaults(),
88 mesecons = {conductor = {
89 state = mesecon.state.on,
90 rules = {
91 {x = -1, y = 0, z = 0},
92 {x = 1, y = 0, z = 0},
93 {x = 0, y = -1, z = 0},
94 {x = 0, y = 1, z = 0},
95 {x = 0, y = 0, z = -1},
96 {x = 0, y = 0, z = 1},
98 offstate = "mesecons_window:filter_closed"
99 }},
100 on_construct = function(pos)
101 -- remove shadow
102 shadowpos = vector.add(pos, vector.new(0, 1, 0))
103 if (minetest.get_node(shadowpos).name == "air") then
104 minetest.dig_node(shadowpos)
109 minetest.register_node("mesecons_window:filter2_closed", {
110 description="Mesecon Filter Glass",
111 _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.",
112 drawtype="glasslike_framed",
113 tiles = {"mesecons_filter2_closed.png", "mesecons_filter2_closed_detail.png"},
114 is_ground_content = false,
115 groups = {cracky=3, oddly_breakable_by_hand=3},
116 sounds = default.node_sound_glass_defaults(),
117 paramtype = "light",
118 sunlight_propagates = false,
119 mesecons = {conductor = {
120 state = mesecon.state.off,
121 rules = { --axes
122 {x = -1, y = 0, z = 0},
123 {x = 1, y = 0, z = 0},
124 {x = 0, y = -1, z = 0},
125 {x = 0, y = 1, z = 0},
126 {x = 0, y = 0, z = -1},
127 {x = 0, y = 0, z = 1},
129 onstate = "mesecons_window:filter2_open"
131 on_construct = function(pos)
132 -- remove shadow
133 shadowpos = vector.add(pos, vector.new(0, 1, 0))
134 if (minetest.get_node(shadowpos).name == "air") then
135 minetest.dig_node(shadowpos)
140 minetest.register_node("mesecons_window:filter2_open", {
141 description="Mesecon Filter Glass",
142 _doc_items_create_entry = false,
143 drawtype = "glasslike_framed",
144 sunlight_propagates = false,
145 tiles = {"mesecons_filter2_open.png", "mesecons_filter2_open_detail.png"},
146 is_ground_content = false,
147 paramtype = "light",
148 sunlight_propagates = true,
149 groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
150 drop = "mesecons_window:filter2_closed",
151 sounds = default.node_sound_glass_defaults(),
152 mesecons = {conductor = {
153 state = mesecon.state.on,
154 rules = {
155 {x = -1, y = 0, z = 0},
156 {x = 1, y = 0, z = 0},
157 {x = 0, y = -1, z = 0},
158 {x = 0, y = 1, z = 0},
159 {x = 0, y = 0, z = -1},
160 {x = 0, y = 0, z = 1},
162 offstate = "mesecons_window:filter2_closed"
164 on_construct = function(pos)
165 -- remove shadow
166 shadowpos = vector.add(pos, vector.new(0, 1, 0))
167 if (minetest.get_node(shadowpos).name == "air") then
168 minetest.dig_node(shadowpos)
173 if minetest.get_modpath("default") then
174 minetest.register_craft({
175 output = 'mesecons_window:window_closed',
176 recipe = {
177 {"", "default:glass", ""},
178 {"default:cobble", "group:mesecon_conductor_craftable", "default:cobble"},
182 minetest.register_craft({
183 output = 'mesecons_window:filter_closed',
184 recipe = {
185 {"", "default:pine_needles", ""},
186 {"default:cobble", "group:mesecon_conductor_craftable", "default:cobble"},
190 minetest.register_craft({
191 output = 'mesecons_window:filter2_closed',
192 recipe = {
193 {"", "default:glass", ""},
194 {"default:pine_needles", "group:mesecon_conductor_craftable", "default:pine_needles"},
199 if minetest.get_modpath("doc") then
200 doc.add_entry_alias("nodes", "mesecons_window:window_closed", "nodes", "mesecons_window:window_open")
201 doc.add_entry_alias("nodes", "mesecons_window:filter_closed", "nodes", "mesecons_window:filter_open")
202 doc.add_entry_alias("nodes", "mesecons_window:filter2_closed", "nodes", "mesecons_window:filter2_open")