123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454 |
- minetest.register_tool("lottblocks:lockpick", {
- description = "Lockpick",
- inventory_image = "lottblocks_steel_lockpick.png", --Made by HeroOfTheWinds
- --https://github.com/HeroOfTheWinds/lockpicks/blob/master/textures/steel_lockpick.png
- max_stack = 1,
- })
- minetest.register_craft({
- output = "lottblocks:lockpick",
- recipe = {
- {"", "default:steel_ingot", "default:steel_ingot"},
- {"", "default:steel_ingot", ""},
- {"", "group:stick", ""}
- }
- })
- local function lockpick(itemstack, pos, race, player)
- if math.random(1, 4) ~= 3 then
- itemstack:add_wear(65535/20)
- minetest.chat_send_player(player, "Lockpick failed")
- else
- itemstack:add_wear(65535/18)
- minetest.show_formspec(player,
- "lottblocks:" .. race .. "_chest",
- default.get_chest_formspec(pos, "gui_" .. race .. "bg.png"))
- lottachievements.unlock(player, "thief")
- end
- end
- minetest.register_node("lottblocks:hobbit_chest", {
- description = "Hobbit Chest",
- tiles = {"lottblocks_hobbit_chest_top.png", "lottblocks_hobbit_chest_top.png", "lottblocks_hobbit_chest_side.png",
- "lottblocks_hobbit_chest_side.png", "lottblocks_hobbit_chest_side.png", "lottblocks_hobbit_chest_front.png"},
- paramtype2 = "facedir",
- groups = {choppy=2,oddly_breakable_by_hand=2},
- legacy_facedir_simple = true,
- is_ground_content = false,
- sounds = default.node_sound_wood_defaults(),
- on_construct = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Hobbit Chest")
- local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
- end,
- on_rightclick = function(pos, node, clicker, itemstack)
- local player = clicker:get_player_name()
- local item = itemstack:get_name()
- if minetest.check_player_privs(player, {GAMEhobbit=true})
- or minetest.check_player_privs(player, {GAMEwizard=true}) then
- minetest.show_formspec(
- player, "lottblocks:hobbit_chest", default.get_chest_formspec(pos, "gui_hobbitbg.png")
- )
- elseif item == "lottblocks:lockpick" then
- lockpick(itemstack, pos, "hobbit", player)
- else
- minetest.chat_send_player(player, "Only Hobbits can open this kind of chest!")
- end
- end,
- can_dig = function(pos,player)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- return inv:is_empty("main")
- end,
- on_punch = function(pos,player)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Hobbit Chest")
- meta:set_string("formspec", "")
- end,
- })
- minetest.register_node("lottblocks:gondor_chest", {
- description = "Gondorian Chest",
- tiles = {"lottblocks_gondor_chest_top.png", "lottblocks_gondor_chest_bottom.png", "lottblocks_gondor_chest_side.png",
- "lottblocks_gondor_chest_side.png", "lottblocks_gondor_chest_side.png", "lottblocks_gondor_chest_front.png"},
- paramtype2 = "facedir",
- groups = {choppy=2,oddly_breakable_by_hand=2},
- legacy_facedir_simple = true,
- is_ground_content = false,
- sounds = default.node_sound_wood_defaults(),
- on_construct = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Gondorian Chest")
- local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
- end,
- on_rightclick = function(pos, node, clicker, itemstack)
- local player = clicker:get_player_name()
- local item = itemstack:get_name()
- if minetest.check_player_privs(player, {GAMEman=true})
- or minetest.check_player_privs(player, {GAMEwizard=true}) then
- minetest.show_formspec(
- player,
- "lottblocks:gondor_chest",
- default.get_chest_formspec(pos, "gui_gondorbg.png")
- )
- elseif item == "lottblocks:lockpick" then
- lockpick(itemstack, pos, "gondor", player)
- else
- minetest.chat_send_player(player, "Only Humans can open this kind of chest!")
- end
- end,
- can_dig = function(pos,player)
- local meta = minetest.get_meta(pos);
- local inv = meta:get_inventory()
- return inv:is_empty("main")
- end,
- on_punch = function(pos,player)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Gondorian Chest")
- meta:set_string("formspec", "")
- end,
- })
- minetest.register_node("lottblocks:rohan_chest", {
- description = "Rohirrim Chest",
- tiles = {"lottblocks_rohan_chest_top.png", "lottblocks_rohan_chest_bottom.png", "lottblocks_rohan_chest_side.png",
- "lottblocks_rohan_chest_side.png", "lottblocks_rohan_chest_side.png", "lottblocks_rohan_chest_front.png"},
- paramtype2 = "facedir",
- groups = {choppy=2,oddly_breakable_by_hand=2},
- legacy_facedir_simple = true,
- is_ground_content = false,
- sounds = default.node_sound_wood_defaults(),
- on_construct = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Rohirrim Chest")
- local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
- end,
- on_rightclick = function(pos, node, clicker, itemstack)
- local player = clicker:get_player_name()
- local item = itemstack:get_name()
- if minetest.check_player_privs(player, {GAMEman=true})
- or minetest.check_player_privs(player, {GAMEwizard=true}) then
- minetest.show_formspec(
- player,
- "lottblocks:rohan_chest",
- default.get_chest_formspec(pos, "gui_rohanbg.png")
- )
- elseif item == "lottblocks:lockpick" then
- lockpick(itemstack, pos, "rohan", player)
- else
- minetest.chat_send_player(player, "Only Humans can open this kind of chest!")
- end
- end,
- can_dig = function(pos,player)
- local meta = minetest.get_meta(pos);
- local inv = meta:get_inventory()
- return inv:is_empty("main")
- end,
- on_punch = function(pos,player)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Rohirrim Chest")
- meta:set_string("formspec", "")
- end,
- })
- minetest.register_node("lottblocks:elfloth_chest", {
- description = "Elven (Lorien) Chest",
- tiles = {"lottblocks_elf_chest_top.png", "lottblocks_elf_chest_bottom.png", "lottblocks_elf_chest_side.png",
- "lottblocks_elf_chest_side.png", "lottblocks_elf_chest_side.png", "lottblocks_elf_chest_front.png"},
- paramtype2 = "facedir",
- groups = {choppy=2,oddly_breakable_by_hand=2},
- legacy_facedir_simple = true,
- is_ground_content = false,
- sounds = default.node_sound_wood_defaults(),
- on_construct = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Elven (Lorien) Chest")
- local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
- end,
- on_rightclick = function(pos, node, clicker, itemstack)
- local player = clicker:get_player_name()
- local item = itemstack:get_name()
- if minetest.check_player_privs(player, {GAMEelf=true})
- or minetest.check_player_privs(player, {GAMEwizard=true}) then
- minetest.show_formspec(
- player,
- "lottblocks:elfloth_chest",
- default.get_chest_formspec(pos, "gui_elfbg.png")
- )
- elseif item == "lottblocks:lockpick" then
- lockpick(itemstack, pos, "elf", player)
- else
- minetest.chat_send_player(player, "Only Elves can open this kind of chest!")
- end
- end,
- can_dig = function(pos,player)
- local meta = minetest.get_meta(pos);
- local inv = meta:get_inventory()
- return inv:is_empty("main")
- end,
- on_punch = function(pos,player)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Elven (Lorien) Chest")
- meta:set_string("formspec", "")
- end,
- })
- minetest.register_node("lottblocks:elfmirk_chest", {
- description = "Elven (Mirkwood) Chest",
- tiles = {"lottblocks_elf_chest_top.png", "lottblocks_elf_chest_bottom.png", "lottblocks_elf_chest_side.png",
- "lottblocks_elf_chest_side.png", "lottblocks_elf_chest_side.png", "lottblocks_elf_chest_front.png"},
- paramtype2 = "facedir",
- groups = {choppy=2,oddly_breakable_by_hand=2},
- legacy_facedir_simple = true,
- is_ground_content = false,
- sounds = default.node_sound_wood_defaults(),
- on_construct = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Elven (Mirkwood) Chest")
- local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
- end,
- on_rightclick = function(pos, node, clicker, itemstack)
- local player = clicker:get_player_name()
- local item = itemstack:get_name()
- if minetest.check_player_privs(player, {GAMEelf=true})
- or minetest.check_player_privs(player, {GAMEwizard=true}) then
- minetest.show_formspec(
- player,
- "lottblocks:elfmirk_chest",
- default.get_chest_formspec(pos, "gui_elfbg.png")
- )
- elseif item == "lottblocks:lockpick" then
- lockpick(itemstack, pos, "elf", player)
- else
- minetest.chat_send_player(player, "Only Elves can open this kind of chest!")
- end
- end,
- can_dig = function(pos,player)
- local meta = minetest.get_meta(pos);
- local inv = meta:get_inventory()
- return inv:is_empty("main")
- end,
- on_punch = function(pos,player)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Elven (Mirkwood) Chest")
- meta:set_string("formspec", "")
- end,
- })
- minetest.register_node("lottblocks:mordor_chest", {
- description = "Mordor Chest",
- tiles = {"lottblocks_mordor_chest_top.png", "lottblocks_mordor_chest_top.png", "lottblocks_mordor_chest_side.png",
- "lottblocks_mordor_chest_side.png", "lottblocks_mordor_chest_side.png", "lottblocks_mordor_chest_front.png"},
- paramtype2 = "facedir",
- groups = {choppy=2,oddly_breakable_by_hand=2},
- legacy_facedir_simple = true,
- is_ground_content = false,
- sounds = default.node_sound_wood_defaults(),
- on_construct = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Mordor Chest")
- local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
- end,
- on_rightclick = function(pos, node, clicker, itemstack)
- local player = clicker:get_player_name()
- local item = itemstack:get_name()
- if minetest.check_player_privs(player, {GAMEorc=true})
- or minetest.check_player_privs(player, {GAMEwizard=true}) then
- minetest.show_formspec(
- player,
- "lottblocks:mordor_chest",
- default.get_chest_formspec(pos, "gui_mordorbg.png")
- )
- elseif item == "lottblocks:lockpick" then
- lockpick(itemstack, pos, "mordor", player)
- else
- minetest.chat_send_player(player, "Only Orcs can open this kind of chest!")
- end
- end,
- can_dig = function(pos,player)
- local meta = minetest.get_meta(pos);
- local inv = meta:get_inventory()
- return inv:is_empty("main")
- end,
- on_punch = function(pos,player)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Mordor Chest")
- meta:set_string("formspec", "")
- end,
- })
- minetest.register_node("lottblocks:angmar_chest", {
- description = "Angmar Chest",
- tiles = {"lottblocks_angmar_chest_top.png", "lottblocks_angmar_chest_top.png", "lottblocks_angmar_chest_side.png",
- "lottblocks_angmar_chest_side.png", "lottblocks_angmar_chest_side.png", "lottblocks_angmar_chest_front.png"},
- paramtype2 = "facedir",
- groups = {choppy=2,oddly_breakable_by_hand=2},
- legacy_facedir_simple = true,
- is_ground_content = false,
- sounds = default.node_sound_wood_defaults(),
- on_construct = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Angmar Chest")
- local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
- end,
- on_rightclick = function(pos, node, clicker, itemstack)
- local player = clicker:get_player_name()
- local item = itemstack:get_name()
- if minetest.check_player_privs(player, {GAMEorc=true})
- or minetest.check_player_privs(player, {GAMEwizard=true}) then
- minetest.show_formspec(
- player,
- "lottblocks:angmar_chest",
- default.get_chest_formspec(pos, "gui_angmarbg.png")
- )
- elseif item == "lottblocks:lockpick" then
- lockpick(itemstack, pos, "angmar", player)
- else
- minetest.chat_send_player(player, "Only Orcs can open this kind of chest!")
- end
- end,
- can_dig = function(pos,player)
- local meta = minetest.get_meta(pos);
- local inv = meta:get_inventory()
- return inv:is_empty("main")
- end,
- --backwards compatibility: punch to set formspec
- on_punch = function(pos,player)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Angmar Chest")
- meta:set_string("formspec", "")
- end,
- })
- minetest.register_node("lottblocks:dwarf_chest", {
- description = "Dwarf Chest",
- tiles = {"lottblocks_dwarf_chest_top.png", "lottblocks_dwarf_chest_top.png", "lottblocks_dwarf_chest_side.png",
- "lottblocks_dwarf_chest_side.png", "lottblocks_dwarf_chest_side.png", "lottblocks_dwarf_chest_front.png"},
- paramtype2 = "facedir",
- groups = {choppy=2,oddly_breakable_by_hand=2},
- legacy_facedir_simple = true,
- is_ground_content = false,
- sounds = default.node_sound_wood_defaults(),
- on_construct = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Dwarf Chest")
- local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
- end,
- on_rightclick = function(pos, node, clicker, itemstack)
- local player = clicker:get_player_name()
- local item = itemstack:get_name()
- if minetest.check_player_privs(player, {GAMEdwarf=true})
- or minetest.check_player_privs(player, {GAMEwizard=true}) then
- minetest.show_formspec(
- player,
- "lottblocks:dwarf_chest",
- default.get_chest_formspec(pos, "gui_dwarfbg.png")
- )
- elseif item == "lottblocks:lockpick" then
- lockpick(itemstack, pos, "dwarf", player)
- else
- minetest.chat_send_player(player, "Only Dwarfs can open this kind of chest!")
- end
- end,
- can_dig = function(pos,player)
- local meta = minetest.get_meta(pos);
- local inv = meta:get_inventory()
- return inv:is_empty("main")
- end,
- --backwards compatibility: punch to set formspec
- on_punch = function(pos,player)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Dwarf Chest")
- meta:set_string("formspec", "")
- end,
- })
- minetest.register_craft({
- output = "lottblocks:hobbit_chest",
- recipe = {
- {"lottplants:birchwood", "lottplants:birchwood", "lottplants:birchwood"},
- {"lottplants:birchwood", "default:chest", "lottplants:birchwood"},
- {"lottplants:birchwood", "lottplants:birchwood", "lottplants:birchwood"},
- }
- })
- minetest.register_craft({
- output = "lottblocks:gondor_chest",
- recipe = {
- {"lottplants:alderwood", "lottplants:alderwood", "lottplants:alderwood"},
- {"lottplants:alderwood", "default:chest", "lottplants:alderwood"},
- {"lottplants:alderwood", "lottplants:alderwood", "lottplants:alderwood"},
- }
- })
- minetest.register_craft({
- output = "lottblocks:rohan_chest",
- recipe = {
- {"lottplants:lebethronwood", "lottplants:lebethronwood", "lottplants:lebethronwood"},
- {"lottplants:lebethronwood", "default:chest", "lottplants:lebethronwood"},
- {"lottplants:lebethronwood", "lottplants:lebethronwood", "lottplants:lebethronwood"},
- }
- })
- minetest.register_craft({
- output = "lottblocks:elfloth_chest",
- recipe = {
- {"lottplants:mallornwood", "lottplants:mallornwood", "lottplants:mallornwood"},
- {"lottplants:mallornwood", "default:chest", "lottplants:mallornwood"},
- {"lottplants:mallornwood", "lottplants:mallornwood", "lottplants:mallornwood"},
- }
- })
- minetest.register_craft({
- output = "lottblocks:elfmirk_chest",
- recipe = {
- {"default:junglewood", "default:junglewood", "default:junglewood"},
- {"default:junglewood", "default:chest", "default:junglewood"},
- {"default:junglewood", "default:junglewood", "default:junglewood"},
- }
- })
- minetest.register_craft({
- output = "lottblocks:mordor_chest",
- recipe = {
- {"lottmapgen:mordor_stone", "lottmapgen:mordor_stone", "lottmapgen:mordor_stone"},
- {"lottmapgen:mordor_stone", "default:chest", "lottmapgen:mordor_stone"},
- {"lottmapgen:mordor_stone", "lottmapgen:mordor_stone", "lottmapgen:mordor_stone"},
- }
- })
- minetest.register_craft({
- output = "lottblocks:angmar_chest",
- recipe = {
- {"lottplants:pinewood", "lottplants:pinewood", "lottplants:pinewood"},
- {"lottplants:pinewood", "default:chest", "lottplants:pinewood"},
- {"lottplants:pinewood", "lottplants:pinewood", "lottplants:pinewood"},
- }
- })
- minetest.register_craft({
- output = "lottblocks:dwarf_chest",
- recipe = {
- {"default:stone", "default:stone", "default:stone"},
- {"default:stone", "default:chest", "default:stone"},
- {"default:stone", "default:stone", "default:stone"},
- }
- })
- minetest.register_alias("lottmapgen:hobbit_chest", "lottblocks:hobbit_chest")
- minetest.register_alias("lottmapgen:gondor_chest", "lottblocks:gondor_chest")
- minetest.register_alias("lottmapgen:rohan_chest", "lottblocks:rohan_chest")
- minetest.register_alias("lottmapgen:elfloth_chest", "lottblocks:elfloth_chest")
- minetest.register_alias("lottmapgen:elfmirk_chest", "lottblocks:elfmirk_chest")
- minetest.register_alias("lottmapgen:mordor_chest", "lottblocks:mordor_chest")
- minetest.register_alias("lottmapgen:angmar_chest", "lottblocks:angmar_chest")
|