diff --git a/init.lua b/init.lua index 7ffd179..4945fc3 100644 --- a/init.lua +++ b/init.lua @@ -5,8 +5,8 @@ hook={ pvp = minetest.settings:get_bool("enable_pvp") == true, } -dofile(minetest.get_modpath("hook") .. "/project.lua") -dofile(minetest.get_modpath("hook") .. "/pchest.lua") +dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/project.lua") +dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/pchest.lua") if hook.tmp_time=="" or hook.tmp_time==nil then hook.tmp_time=890 @@ -450,52 +450,106 @@ minetest.register_tool("hook:mba", { end }) -minetest.register_craft({ - output = "hook:mba", - recipe = { - {"","default:steel_ingot",""}, - {"default:steel_ingot","default:steel_ingot","default:steel_ingot"}, - {"default:steel_ingot","","default:steel_ingot"}, - } -}) -minetest.register_craft({ - output = "hook:hook", - recipe = { - {"","default:steel_ingot",""}, - {"","default:steel_ingot","default:steel_ingot"}, - {"default:steel_ingot","",""}, - } -}) -minetest.register_craft({ - output = "hook:hook_upgrade", - recipe = { - {"","hook:hook",""}, - {"","hook:hook",""}, - {"","default:steel_ingot",""}, - } -}) -minetest.register_craft({ - output = "hook:climb_rope", - recipe = { - {"","default:steel_ingot",""}, - {"","default:steelblock",""}, - {"","default:steel_ingot",""}, - } -}) -minetest.register_craft({ - output = "hook:climb_rope_locked", - recipe = { - {"hook:climb_rope","default:steel_ingot",""}, - } -}) -minetest.register_craft({ - output = "hook:slingshot", - recipe = { - {"default:steel_ingot","","default:steel_ingot"}, - {"","default:steelblock",""}, - {"","default:steel_ingot",""}, - } -}) \ No newline at end of file +if minetest.get_modpath("mcl_core") then + minetest.register_craft({ + output = "hook:mba", + recipe = { + {"", "mcl_core:iron_ingot",""}, + {"mcl_core:iron_ingot", "mcl_core:iron_ingot","mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "mcl_core:iron_ingot","mcl_core:iron_ingot"} + }, + }) + + minetest.register_craft({ + output = "hook:hook", + recipe = { + {"", "mcl_core:iron_ingot",""}, + {"", "mcl_core:iron_ingot","mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "",""} + }, + }) + minetest.register_craft({ + output = "hook:hook_upgrade", + recipe = { + {"", "hook:hook",""}, + {"", "hook:hook",""}, + {"", "mcl_core:iron_ingot",""} + }, + }) + minetest.register_craft({ + output = "hook:climb_rope", + recipe = { + {"","mcl_core:iron_ingot",""}, + {"","mcl_core:ironblock",""}, + {"","mcl_core:iron_ingot",""} + }, + }) + minetest.register_craft({ + output = "hook:climb_rope_locked", + recipe = { + {"hook:climb_rope","mcl_core:iron_ingot",""} + }, + }) + minetest.register_craft({ + output = "hook:slingshot", + recipe = { + {"mcl_core:iron_ingot","","mcl_core:iron_ingot"}, + {"","mcl_core:ironblock",""}, + {"","mcl_core:iron_ingot",""} + }, + }) +else + minetest.register_craft({ + output = "hook:mba", + recipe = { + {"","default:steel_ingot",""}, + {"default:steel_ingot","default:steel_ingot","default:steel_ingot"}, + {"default:steel_ingot","","default:steel_ingot"}, + } + }) + + minetest.register_craft({ + output = "hook:hook", + recipe = { + {"","default:steel_ingot",""}, + {"","default:steel_ingot","default:steel_ingot"}, + {"default:steel_ingot","",""}, + } + }) + minetest.register_craft({ + output = "hook:hook_upgrade", + recipe = { + {"","hook:hook",""}, + {"","hook:hook",""}, + {"","default:steel_ingot",""}, + } + }) + + minetest.register_craft({ + output = "hook:climb_rope", + recipe = { + {"","default:steel_ingot",""}, + {"","default:steelblock",""}, + {"","default:steel_ingot",""}, + } + }) + minetest.register_craft({ + output = "hook:climb_rope_locked", + recipe = { + {"hook:climb_rope","default:steel_ingot",""}, + } + }) + + minetest.register_craft({ + output = "hook:slingshot", + recipe = { + {"default:steel_ingot","","default:steel_ingot"}, + {"","default:steelblock",""}, + {"","default:steel_ingot",""}, + } + }) +end + diff --git a/mod.conf b/mod.conf index a6a54e8..b35812e 100644 --- a/mod.conf +++ b/mod.conf @@ -1,2 +1,3 @@ -name = hook -description = Survive & climbing tools \ No newline at end of file +name = hook +description = Survive & climbing tools +optional_depends = default, mcl_core, loot, doc diff --git a/pchest.lua b/pchest.lua index 2db4e06..9ec95f2 100644 --- a/pchest.lua +++ b/pchest.lua @@ -1,6 +1,16 @@ pchest={} -minetest.register_craft({ +if minetest.get_modpath("mcl_core") then + minetest.register_craft({ + output = "hook:pchest", + recipe = { + {"mcl_core:stick", "mcl_core:stick","mcl_core:stick"}, + {"mcl_core:stick", "mcl_chests:chest","mcl_core:diamondblock"}, + {"mcl_core:stick", "mcl_core:stick","mcl_core:stick"} + }, + }) +else + minetest.register_craft({ output = "hook:pchest", recipe = { {"default:stick","default:stick","default:stick"}, @@ -8,6 +18,7 @@ minetest.register_craft({ {"default:stick","default:stick","default:stick"}, } }) +end pchest.setpchest=function(pos,user) local meta = minetest.get_meta(pos) @@ -139,4 +150,4 @@ minetest.register_node("hook:pchest_node", { minetest.set_node(pos, {name = "air"}) minetest.sound_play("default_dig_dig_immediate", {pos=pos, gain = 1.0, max_hear_distance = 5,}) end -}) \ No newline at end of file +})