1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-26 18:50:38 +01:00
server-nalc/mods/bobblocks/blocks.lua

249 lines
6.1 KiB
Lua
Raw Normal View History

2014-11-29 15:40:55 +01:00
-- BobBlocks mod by RabbiBob
-- State Changes
local bobblock_colours = {"red", "orange", "yellow", "green", "blue", "indigo", "violet", "white"}
local function update_bobblock(pos, node)
--Switch Block State
minetest.add_node(pos, {name = 'bobblocks:'..node})
minetest.sound_play("bobblocks_glassblock", {
pos = pos,
gain = 1.0,
max_hear_distance = 32,
})
2014-11-29 15:40:55 +01:00
end
-- Nodes
-- Misc Node
minetest.register_node("bobblocks:btm", {
description = "Bobs TransMorgifier v5",
tile_images = {"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm_sides.png",
2014-11-29 15:40:55 +01:00
"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm.png"},
inventory_image = "bobblocks_btm.png",
2014-11-29 15:40:55 +01:00
paramtype2 = "facedir",
material = minetest.digprop_dirtlike(1.0),
legacy_facedir_simple = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
2014-11-29 15:40:55 +01:00
})
for _, colour in ipairs(bobblock_colours) do
2014-11-29 15:40:55 +01:00
--Blocks
2014-11-29 15:40:55 +01:00
minetest.register_node("bobblocks:"..colour.."block", {
description = colour.." Block",
2014-11-29 15:40:55 +01:00
drawtype = "glasslike",
tile_images = {"bobblocks_"..colour.."block.png"},
inventory_image = minetest.inventorycube("bobblocks_"..colour.."block.png"),
2014-11-29 15:40:55 +01:00
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = default.LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
on_punch = function(pos)
update_bobblock(pos, colour.."block_off")
end,
mesecons = {
conductor={
2014-11-29 15:40:55 +01:00
state = mesecon.state.on,
offstate = "bobblocks:"..colour.."block_off"
}
}
2014-11-29 15:40:55 +01:00
})
minetest.register_node("bobblocks:"..colour.."block_off", {
description = colour.." Block",
tile_images = {"bobblocks_"..colour.."block.png"},
is_ground_content = true,
alpha = 160,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:'..colour..'block',
on_punch = function(pos)
update_bobblock(pos, colour.."block")
end,
mesecons = {
conductor={
2014-11-29 15:40:55 +01:00
state = mesecon.state.off,
onstate = "bobblocks:"..colour.."block"
}
}
2014-11-29 15:40:55 +01:00
})
--Poles
minetest.register_node("bobblocks:"..colour.."pole", {
description = colour.." Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_"..colour.."block.png"},
inventory_image = ("bobblocks_inv"..colour.."pole.png"),
2014-11-29 15:40:55 +01:00
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = default.LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
on_punch = function(pos)
update_bobblock(pos, colour.."pole_off")
end,
mesecons = {conductor={
2014-11-29 15:40:55 +01:00
state = mesecon.state.on,
offstate = "bobblocks:"..colour.."pole_off"
2014-11-29 15:40:55 +01:00
}}
})
minetest.register_node("bobblocks:"..colour.."pole_off", {
description = colour.." Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_"..colour.."block.png"},
inventory_image = ("bobblocks_inv"..colour.."pole.png"),
2014-11-29 15:40:55 +01:00
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = default.LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:'..colour..'pole',
on_punch = function(pos)
update_bobblock(pos, colour.."pole")
end,
mesecons = {conductor={
2014-11-29 15:40:55 +01:00
state = mesecon.state.off,
onstate = "bobblocks:"..colour.."pole"
2014-11-29 15:40:55 +01:00
}}
})
--Crafts
2014-11-29 15:40:55 +01:00
minetest.register_craft({
output = "bobblocks:"..colour.."pole",
recipe = {
{"bobblocks:"..colour.."block", "default:stick"},
2014-11-29 15:40:55 +01:00
},
})
end
2014-11-29 15:40:55 +01:00
minetest.register_node("bobblocks:greyblock", {
description = "Grey Block",
drawtype = "glasslike",
tile_images = {"bobblocks_greyblock.png"},
inventory_image = minetest.inventorycube("bobblocks_greyblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = default.LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
2014-11-29 15:40:55 +01:00
state = mesecon.state.on,
offstate = "bobblocks:greyblock_off"
}}
})
minetest.register_node("bobblocks:greyblock_off", {
description = "Grey Block",
tile_images = {"bobblocks_greyblock.png"},
2014-11-29 15:40:55 +01:00
is_ground_content = true,
alpha = 160,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:greyblock',
mesecons = {conductor={
2014-11-29 15:40:55 +01:00
state = mesecon.state.off,
onstate = "bobblocks:greyblock"
2014-11-29 15:40:55 +01:00
}}
})
minetest.register_node("bobblocks:greypole", {
description = "Grey Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_greyblock.png"},
inventory_image = ("bobblocks_invgreypole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
--light_source = default.LIGHT_MAX-0,
2014-11-29 15:40:55 +01:00
})
-- Crafts
-- BTM
minetest.register_craft({
output = 'NodeItem "bobblocks:btm" 1',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:leaves" 1',
'node "default:mese" 1','node "default:rat" 1'},
2014-11-29 15:40:55 +01:00
},
})
local bobblocks_crafts_list = {
{
{"grey", "cobble"},
{"red", "brick"},
{"yellow", "sand"},
{"blue", "gravel"},
{"white", "dirt"},
2014-11-29 15:40:55 +01:00
},
{
{"orange", "red", "yellow"},
{"violet", "red", "blue"},
{"green", "blue", "yellow"},
2014-11-29 15:40:55 +01:00
},
}
2014-11-29 15:40:55 +01:00
for _,items in ipairs(bobblocks_crafts_list[1]) do
minetest.register_craft({
output = "bobblocks:"..items[1].."block 2",
recipe = {
{"default:glass", "default:torch", "default:"..items[2]},
},
})
end
2014-11-29 15:40:55 +01:00
for _,items in ipairs(bobblocks_crafts_list[2]) do
minetest.register_craft({
output = "bobblocks:"..items[1].."block 2",
recipe = {
{"bobblocks:"..items[2].."block", "bobblocks:"..items[3].."block"},
},
})
end
2014-11-29 15:40:55 +01:00
minetest.register_craft({
output = "bobblocks:indigoblock 3",
2014-11-29 15:40:55 +01:00
recipe = {
{"bobblocks:redblock", "bobblocks:blueblock", "bobblocks:whiteblock"},
2014-11-29 15:40:55 +01:00
},
})
-- Poles
minetest.register_craft({
output = 'bobblocks:greypole',
2014-11-29 15:40:55 +01:00
recipe = {
{"bobblocks:greyblock", "default:stick"},
2014-11-29 15:40:55 +01:00
},
})
-- MESECON
-- Add jeija to bobblocks\default.txt and paste the below in at the bottom of bobblocks\blocks.lua