commit 35d86e1b16a82cd32b5161b8f402e5a04d6373a9 Author: Wuzzy Date: Fri Dec 9 16:34:10 2016 +0100 Initial commit diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..acaa924 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +mesecons diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..22c53e5 --- /dev/null +++ b/init.lua @@ -0,0 +1,196 @@ +-- Window Block + +minetest.register_node("mesecons_window:window_closed", { + description="Mesecon Window", + _doc_items_longdesc = "A Mesecon receptor which is opaque when it isn't powered and is fully transparent to light and sunlight when powered.", + tiles = {"mesecons_window_closed.png"}, + is_ground_content = false, + groups = {cracky=3, oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), + mesecons = {conductor = { + state = mesecon.state.off, + rules = { --axes + {x = -1, y = 0, z = 0}, + {x = 1, y = 0, z = 0}, + {x = 0, y = -1, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y = 0, z = -1}, + {x = 0, y = 0, z = 1}, + }, + onstate = "mesecons_window:window_open" + }} +}) + +minetest.register_node("mesecons_window:window_open", { + description="Mesecon Window", + _doc_items_create_entry = false, + drawtype = "glasslike_framed", + sunlight_propagates = true, + tiles = {"mesecons_window_open.png", "mesecons_window_open_detail.png"}, + is_ground_content = false, + paramtype = "light", + groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1}, + drop = "mesecons_window:window_closed", + sounds = default.node_sound_glass_defaults(), + mesecons = {conductor = { + state = mesecon.state.on, + rules = { + {x = -1, y = 0, z = 0}, + {x = 1, y = 0, z = 0}, + {x = 0, y = -1, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y = 0, z = -1}, + {x = 0, y = 0, z = 1}, + }, + offstate = "mesecons_window:window_closed" + }}, + on_construct = function(pos) + -- remove shadow + shadowpos = vector.add(pos, vector.new(0, 1, 0)) + if (minetest.get_node(shadowpos).name == "air") then + minetest.dig_node(shadowpos) + end + end +}) + +minetest.register_node("mesecons_window:filter_closed", { + description="Mesecon Filter Window", + tiles = {"mesecons_filter_closed.png"}, + _doc_items_longdesc = "A Mesecon receptor which is opaque when it isn't powered and is semi-transparent to light when powered.", + is_ground_content = false, + groups = {cracky=3, oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), + mesecons = {conductor = { + state = mesecon.state.off, + rules = { --axes + {x = -1, y = 0, z = 0}, + {x = 1, y = 0, z = 0}, + {x = 0, y = -1, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y = 0, z = -1}, + {x = 0, y = 0, z = 1}, + }, + onstate = "mesecons_window:filter_open" + }} +}) + +minetest.register_node("mesecons_window:filter_open", { + description="Mesecon Filter Window", + drawtype = "glasslike_framed", + _doc_items_create_entry = false, + sunlight_propagates = false, + tiles = {"mesecons_filter_open.png", "mesecons_filter_open_detail.png"}, + is_ground_content = false, + paramtype = "light", + groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1}, + drop = "mesecons_window:filter_closed", + sounds = default.node_sound_glass_defaults(), + mesecons = {conductor = { + state = mesecon.state.on, + rules = { + {x = -1, y = 0, z = 0}, + {x = 1, y = 0, z = 0}, + {x = 0, y = -1, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y = 0, z = -1}, + {x = 0, y = 0, z = 1}, + }, + offstate = "mesecons_window:filter_closed" + }}, + on_construct = function(pos) + -- remove shadow + shadowpos = vector.add(pos, vector.new(0, 1, 0)) + if (minetest.get_node(shadowpos).name == "air") then + minetest.dig_node(shadowpos) + end + end +}) + +minetest.register_node("mesecons_window:filter2_closed", { + description="Mesecon Filter Glass", + _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.", + drawtype="glasslike_framed", + tiles = {"mesecons_filter2_closed.png", "mesecons_filter2_closed_detail.png"}, + is_ground_content = false, + groups = {cracky=3, oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), + paramtype = "light", + sunlight_propagates = false, + mesecons = {conductor = { + state = mesecon.state.off, + rules = { --axes + {x = -1, y = 0, z = 0}, + {x = 1, y = 0, z = 0}, + {x = 0, y = -1, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y = 0, z = -1}, + {x = 0, y = 0, z = 1}, + }, + onstate = "mesecons_window:filter2_open" + }}, + on_construct = function(pos) + -- remove shadow + shadowpos = vector.add(pos, vector.new(0, 1, 0)) + if (minetest.get_node(shadowpos).name == "air") then + minetest.dig_node(shadowpos) + end + end +}) + +minetest.register_node("mesecons_window:filter2_open", { + description="Mesecon Filter Glass", + _doc_items_create_entry = false, + drawtype = "glasslike_framed", + sunlight_propagates = false, + tiles = {"mesecons_filter2_open.png", "mesecons_filter2_open_detail.png"}, + is_ground_content = false, + paramtype = "light", + sunlight_propagates = true, + groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1}, + drop = "mesecons_window:filter2_closed", + sounds = default.node_sound_glass_defaults(), + mesecons = {conductor = { + state = mesecon.state.on, + rules = { + {x = -1, y = 0, z = 0}, + {x = 1, y = 0, z = 0}, + {x = 0, y = -1, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y = 0, z = -1}, + {x = 0, y = 0, z = 1}, + }, + offstate = "mesecons_window:filter2_closed" + }}, + on_construct = function(pos) + -- remove shadow + shadowpos = vector.add(pos, vector.new(0, 1, 0)) + if (minetest.get_node(shadowpos).name == "air") then + minetest.dig_node(shadowpos) + end + end +}) + + +minetest.register_craft({ + output = 'mesecons_window:window_closed', + recipe = { + {"", "default:glass", ""}, + {"default:cobble", "group:mesecon_conductor_craftable", "default:cobble"}, + } +}) + +minetest.register_craft({ + output = 'mesecons_window:filter_closed', + recipe = { + {"", "default:pine_needles", ""}, + {"default:cobble", "group:mesecon_conductor_craftable", "default:cobble"}, + } +}) + +minetest.register_craft({ + output = 'mesecons_window:filter2_closed', + recipe = { + {"", "default:glass", ""}, + {"default:pine_needles", "group:mesecon_conductor_craftable", "default:pine_needles"}, + } +}) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..345dcd8 --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = mesecons_window diff --git a/textures/mesecons_filter2_closed.png b/textures/mesecons_filter2_closed.png new file mode 100644 index 0000000..38196e8 Binary files /dev/null and b/textures/mesecons_filter2_closed.png differ diff --git a/textures/mesecons_filter2_closed_detail.png b/textures/mesecons_filter2_closed_detail.png new file mode 100644 index 0000000..4efef22 Binary files /dev/null and b/textures/mesecons_filter2_closed_detail.png differ diff --git a/textures/mesecons_filter2_open.png b/textures/mesecons_filter2_open.png new file mode 100644 index 0000000..0f5df0e Binary files /dev/null and b/textures/mesecons_filter2_open.png differ diff --git a/textures/mesecons_filter2_open_detail.png b/textures/mesecons_filter2_open_detail.png new file mode 100644 index 0000000..7fe79c1 Binary files /dev/null and b/textures/mesecons_filter2_open_detail.png differ diff --git a/textures/mesecons_filter_closed.png b/textures/mesecons_filter_closed.png new file mode 100644 index 0000000..a934316 Binary files /dev/null and b/textures/mesecons_filter_closed.png differ diff --git a/textures/mesecons_filter_open.png b/textures/mesecons_filter_open.png new file mode 100644 index 0000000..3d655fa Binary files /dev/null and b/textures/mesecons_filter_open.png differ diff --git a/textures/mesecons_filter_open_detail.png b/textures/mesecons_filter_open_detail.png new file mode 100644 index 0000000..21b2616 Binary files /dev/null and b/textures/mesecons_filter_open_detail.png differ diff --git a/textures/mesecons_window_closed.png b/textures/mesecons_window_closed.png new file mode 100644 index 0000000..e57e6bb Binary files /dev/null and b/textures/mesecons_window_closed.png differ diff --git a/textures/mesecons_window_open.png b/textures/mesecons_window_open.png new file mode 100644 index 0000000..d5690dd Binary files /dev/null and b/textures/mesecons_window_open.png differ diff --git a/textures/mesecons_window_open_detail.png b/textures/mesecons_window_open_detail.png new file mode 100644 index 0000000..433d031 Binary files /dev/null and b/textures/mesecons_window_open_detail.png differ