Add mod.conf
[mesecons_window.git] / init.lua
blob3514147d092d71ccbfefef948fde3c8c907ca104
1 local S = minetest.get_translator("mesecons_window")
3 -- Window Block
5 local sfx
6 if minetest.get_modpath("default") then
7 sfx = default.node_sound_glass_defaults()
8 end
10 minetest.register_node("mesecons_window:window_closed", {
11 description=S("Mesecon Window"),
12 _doc_items_longdesc = S("A Mesecon receptor which is opaque when it isn't powered and is fully transparent to light and sunlight when powered."),
13 tiles = {"mesecons_window_window_closed.png"},
14 is_ground_content = false,
15 groups = {cracky=3, oddly_breakable_by_hand=3},
16 sounds = sfx,
17 mesecons = {conductor = {
18 state = mesecon.state.off,
19 rules = { --axes
20 {x = -1, y = 0, z = 0},
21 {x = 1, y = 0, z = 0},
22 {x = 0, y = -1, z = 0},
23 {x = 0, y = 1, z = 0},
24 {x = 0, y = 0, z = -1},
25 {x = 0, y = 0, z = 1},
27 onstate = "mesecons_window:window_open"
31 minetest.register_node("mesecons_window:window_open", {
32 description=S("Mesecon Window"),
33 _doc_items_create_entry = false,
34 drawtype = "glasslike_framed",
35 sunlight_propagates = true,
36 tiles = {"mesecons_window_window_open.png", "mesecons_window_window_open_detail.png"},
37 is_ground_content = false,
38 paramtype = "light",
39 groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
40 drop = "mesecons_window:window_closed",
41 sounds = sfx,
42 mesecons = {conductor = {
43 state = mesecon.state.on,
44 rules = {
45 {x = -1, y = 0, z = 0},
46 {x = 1, y = 0, z = 0},
47 {x = 0, y = -1, z = 0},
48 {x = 0, y = 1, z = 0},
49 {x = 0, y = 0, z = -1},
50 {x = 0, y = 0, z = 1},
52 offstate = "mesecons_window:window_closed"
53 }},
54 on_construct = function(pos)
55 -- remove shadow
56 shadowpos = vector.add(pos, vector.new(0, 1, 0))
57 if (minetest.get_node(shadowpos).name == "air") then
58 minetest.dig_node(shadowpos)
59 end
60 end
63 minetest.register_node("mesecons_window:filter_closed", {
64 description=S("Mesecon Filter Window"),
65 tiles = {"mesecons_window_filter_closed.png"},
66 _doc_items_longdesc = S("A Mesecon receptor which is opaque when it isn't powered and is semi-transparent to light when powered."),
67 is_ground_content = false,
68 groups = {cracky=3, oddly_breakable_by_hand=3},
69 sounds = sfx,
70 mesecons = {conductor = {
71 state = mesecon.state.off,
72 rules = { --axes
73 {x = -1, y = 0, z = 0},
74 {x = 1, y = 0, z = 0},
75 {x = 0, y = -1, z = 0},
76 {x = 0, y = 1, z = 0},
77 {x = 0, y = 0, z = -1},
78 {x = 0, y = 0, z = 1},
80 onstate = "mesecons_window:filter_open"
84 minetest.register_node("mesecons_window:filter_open", {
85 description=S("Mesecon Filter Window"),
86 drawtype = "glasslike_framed",
87 _doc_items_create_entry = false,
88 sunlight_propagates = false,
89 tiles = {"mesecons_window_filter_open.png", "mesecons_window_filter_open_detail.png"},
90 is_ground_content = false,
91 paramtype = "light",
92 groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
93 drop = "mesecons_window:filter_closed",
94 sounds = sfx,
95 mesecons = {conductor = {
96 state = mesecon.state.on,
97 rules = {
98 {x = -1, y = 0, z = 0},
99 {x = 1, y = 0, z = 0},
100 {x = 0, y = -1, z = 0},
101 {x = 0, y = 1, z = 0},
102 {x = 0, y = 0, z = -1},
103 {x = 0, y = 0, z = 1},
105 offstate = "mesecons_window:filter_closed"
107 on_construct = function(pos)
108 -- remove shadow
109 shadowpos = vector.add(pos, vector.new(0, 1, 0))
110 if (minetest.get_node(shadowpos).name == "air") then
111 minetest.dig_node(shadowpos)
116 minetest.register_node("mesecons_window:filter2_closed", {
117 description=S("Mesecon Filter Glass"),
118 _doc_items_longdesc = S("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."),
119 drawtype="glasslike_framed",
120 tiles = {"mesecons_window_filter2_closed.png", "mesecons_window_filter2_closed_detail.png"},
121 is_ground_content = false,
122 groups = {cracky=3, oddly_breakable_by_hand=3},
123 sounds = sfx,
124 paramtype = "light",
125 sunlight_propagates = false,
126 mesecons = {conductor = {
127 state = mesecon.state.off,
128 rules = { --axes
129 {x = -1, y = 0, z = 0},
130 {x = 1, y = 0, z = 0},
131 {x = 0, y = -1, z = 0},
132 {x = 0, y = 1, z = 0},
133 {x = 0, y = 0, z = -1},
134 {x = 0, y = 0, z = 1},
136 onstate = "mesecons_window:filter2_open"
138 on_construct = function(pos)
139 -- remove shadow
140 shadowpos = vector.add(pos, vector.new(0, 1, 0))
141 if (minetest.get_node(shadowpos).name == "air") then
142 minetest.dig_node(shadowpos)
147 minetest.register_node("mesecons_window:filter2_open", {
148 description=S("Mesecon Filter Glass"),
149 _doc_items_create_entry = false,
150 drawtype = "glasslike_framed",
151 sunlight_propagates = false,
152 tiles = {"mesecons_window_filter2_open.png", "mesecons_window_filter2_open_detail.png"},
153 is_ground_content = false,
154 paramtype = "light",
155 sunlight_propagates = true,
156 groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
157 drop = "mesecons_window:filter2_closed",
158 sounds = sfx,
159 mesecons = {conductor = {
160 state = mesecon.state.on,
161 rules = {
162 {x = -1, y = 0, z = 0},
163 {x = 1, y = 0, z = 0},
164 {x = 0, y = -1, z = 0},
165 {x = 0, y = 1, z = 0},
166 {x = 0, y = 0, z = -1},
167 {x = 0, y = 0, z = 1},
169 offstate = "mesecons_window:filter2_closed"
171 on_construct = function(pos)
172 -- remove shadow
173 shadowpos = vector.add(pos, vector.new(0, 1, 0))
174 if (minetest.get_node(shadowpos).name == "air") then
175 minetest.dig_node(shadowpos)
180 if minetest.get_modpath("default") then
181 minetest.register_craft({
182 output = 'mesecons_window:window_closed 3',
183 recipe = {
184 {"default:cobble", "default:cobble", "default:cobble"},
185 {"", "group:mesecon_conductor_craftable", ""},
186 {"default:glass", "default:glass", "default:glass"},
190 minetest.register_craft({
191 output = 'mesecons_window:filter_closed 3',
192 recipe = {
193 {"default:cobble", "default:cobble", "default:cobble"},
194 {"group:leaves", "group:mesecon_conductor_craftable", "group:leaves"},
195 {"default:glass", "default:glass", "default:glass"},
199 minetest.register_craft({
200 output = 'mesecons_window:filter2_closed 3',
201 recipe = {
202 {"group:leaves", "group:leaves", "group:leaves"},
203 {"", "group:mesecon_conductor_craftable", ""},
204 {"default:glass", "default:glass", "default:glass"},
210 if minetest.get_modpath("doc") then
211 doc.add_entry_alias("nodes", "mesecons_window:window_closed", "nodes", "mesecons_window:window_open")
212 doc.add_entry_alias("nodes", "mesecons_window:filter_closed", "nodes", "mesecons_window:filter_open")
213 doc.add_entry_alias("nodes", "mesecons_window:filter2_closed", "nodes", "mesecons_window:filter2_open")