minetest-meseconductors/lightstones.lua

82 lines
2.2 KiB
Lua
Raw Normal View History

2016-10-21 05:35:11 -07:00
2016-10-17 11:16:58 -07:00
2016-10-14 11:12:48 -07:00
local rules_all_directions =
2016-10-21 05:35:11 -07:00
{{x=0, y=0, z=-1},
{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=0, z=1},
{x=1, y=1, z=0},
{x=1, y=-1, z=0},
{x=-1, y=1, z=0},
{x=-1, y=-1, z=0},
{x=0, y=1, z=1},
{x=0, y=-1, z=1},
{x=0, y=1, z=-1},
{x=0, y=1, z=0},
{x=0, y=-1, z=0},
{x=0, y=-1, z=-1}}
function meseconductors:lightstone_add(name, color, base_item)
minetest.register_node("meseconductors:lightstone_" .. color .. "_off", {
tiles = {"meseconductors_lightstone_" .. color .. "_off.png"},
2016-10-13 10:07:50 -07:00
groups = {cracky=2, mesecon_effector_off = 1, mesecon = 2},
description=name.." Lightstone",
2016-10-21 05:35:11 -07:00
sounds = default.node_sound_glass_defaults(),
2016-10-13 10:07:50 -07:00
mesecons = {effector = {
2016-10-14 11:12:48 -07:00
rules = rules_all_directions,
2016-10-13 10:07:50 -07:00
action_on = function (pos, node)
2016-10-21 05:35:11 -07:00
minetest.swap_node(pos, {name = "meseconductors:lightstone_" .. color .. "_on", param2 = node.param2})
2016-10-13 10:07:50 -07:00
end,
}}
})
2016-10-21 05:35:11 -07:00
minetest.register_node("meseconductors:lightstone_" .. color .. "_on", {
tiles = {"meseconductors_lightstone_" .. color .. "_on.png"},
2016-10-13 10:07:50 -07:00
groups = {cracky=2,not_in_creative_inventory=1, mesecon = 2},
2016-10-21 05:35:11 -07:00
drop = "meseconductors:lightstone_" .. color .. "_off",
light_source = 13,
sounds = default.node_sound_glass_defaults(),
2016-10-13 10:07:50 -07:00
mesecons = {effector = {
2016-10-14 11:12:48 -07:00
rules = rules_all_directions,
2016-10-13 10:07:50 -07:00
action_off = function (pos, node)
2016-10-21 05:35:11 -07:00
minetest.swap_node(pos, {name = "meseconductors:lightstone_" .. color .. "_off", param2 = node.param2})
2016-10-13 10:07:50 -07:00
end,
}}
})
minetest.register_craft({
2016-10-21 05:35:11 -07:00
output = "meseconductors:lightstone_" .. color .. "_off 2",
2016-10-13 10:07:50 -07:00
recipe = {
2016-10-21 05:35:11 -07:00
{"default:glass",base_item,"default:glass"},
{base_item,"default:torch",base_item},
{"default:glass","meseconductors:lamp_controller","default:glass"}
2016-10-13 10:07:50 -07:00
}
})
end
2016-10-21 05:35:11 -07:00
meseconductors:lightstone_add("Red", "red", "dye:red")
meseconductors:lightstone_add("Green", "green", "dye:green")
meseconductors:lightstone_add("Blue", "blue", "dye:blue")
meseconductors:lightstone_add("Yellow", "yellow", "dye:yellow")
meseconductors:lightstone_add("White", "white", "dye:white")
meseconductors:lightstone_add("Pink", "pink", "dye:pink")
meseconductors:lightstone_add("Cyan", "cyan", "dye:cyan")
meseconductors:lightstone_add("Orange", "orange", "dye:orange")
meseconductors:lightstone_add("Black", "black", "dye:black")
2016-10-13 10:07:50 -07:00
2016-10-14 11:12:48 -07:00
2016-10-13 10:07:50 -07:00
2016-10-14 11:12:48 -07:00
2016-10-13 10:07:50 -07:00
2016-10-14 11:12:48 -07:00
2016-10-13 10:07:50 -07:00