diff --git a/init.lua b/init.lua index f554639..f29676a 100644 --- a/init.lua +++ b/init.lua @@ -1,12 +1,28 @@ lavastuff = {} -local S = minetest.get_translator(minetest.get_current_modname()) +local S -lavastuff.enable_lightup = minetest.settings:get_bool("lavastuff_enable_lightup") or true --- Lights up the area around the player that rightclicks the air with a lava tool +if minetest.global_exists(minetest.get_translator) then + S = minetest.get_translator(minetest.get_current_modname()) +else + S = function(str) + return(str) + end +end -lavastuff.cook_limit = minetest.settings:get("lavastuff_cook_limit") or 15 --- Tools will not smelt items if their cooking time is too long +lavastuff.enable_tool_fire = minetest.settings:get_bool("lavastuff_enable_tool_fire") +-- Places fire where the player rightclicks with a lava tool + +lavastuff.cook_limit = minetest.settings:get("lavastuff_cook_limit") +-- Tools will not smelt dug items if their cooking time is too long + +if lavastuff.cook_limit ~= false then + lavastuff.cook_limit = 15 +end + +if lavastuff.enable_tool_fire ~= false then + lavastuff.enable_tool_fire = true +end lavastuff.blacklisted_items = { -- Items lava tools will not smelt "default:mese_crystal", @@ -56,19 +72,6 @@ function lavastuff.burn_drops(tool) end end -function lavastuff.lightup(user) - if lavastuff.enable_lightup == true then - local pos = user:get_pos() - - pos.y = pos.y + 1 - - if minetest.get_node(pos).name == "air" then - minetest.set_node(pos, {name = "lavastuff:light"}) - minetest.after(0.4, minetest.remove_node, pos) - end - end -end - lavastuff.burn_drops("lavastuff:sword") lavastuff.burn_drops("lavastuff:axe") lavastuff.burn_drops("lavastuff:shovel") @@ -132,8 +135,24 @@ minetest.register_tool("lavastuff:sword", { }, damage_groups = {fleshy = 10, burns = 1}, }, - on_secondary_use = function(itemstack, user, pointed_thing) - lavastuff.lightup(user) + on_place = function(itemstack, user, pointed_thing) + if not minetest.registered_items["fire:basic_flame"] or + lavastuff.enable_tool_fire == false then + return + end + + local node = minetest.get_node(pointed_thing.above) + local pointed = {type = "node", under = pointed_thing.above, above = pointed_thing.above} + local _, can_place = minetest.item_place_node(ItemStack("fire:basic_flame"), user, pointed) + + if node.name == "air" and can_place == true then + minetest.set_node(pointed_thing.above, {name = "fire:permanent_flame"}) + minetest.after(7, function() + if minetest.get_node(pointed_thing.above).name == "fire:permanent_flame" then + minetest.remove_node(pointed_thing.above) + end + end) + end end, sound = {breaks = "default_tool_breaks"}, }) @@ -157,8 +176,24 @@ if not minetest.get_modpath("mobs_monster") then }, damage_groups = {fleshy = 6, burns = 1}, }, - on_secondary_use = function(itemstack, user, pointed_thing) - lavastuff.lightup(user) + on_place = function(itemstack, user, pointed_thing) + if not minetest.registered_items["fire:basic_flame"] or + lavastuff.enable_tool_fire == false then + return + end + + local node = minetest.get_node(pointed_thing.above) + local pointed = {type = "node", under = pointed_thing.above, above = pointed_thing.above} + local _, can_place = minetest.item_place_node(ItemStack("fire:basic_flame"), user, pointed) + + if node.name == "air" and can_place == true then + minetest.set_node(pointed_thing.above, {name = "fire:permanent_flame"}) + minetest.after(7, function() + if minetest.get_node(pointed_thing.above).name == "fire:permanent_flame" then + minetest.remove_node(pointed_thing.above) + end + end) + end end, }) @@ -184,6 +219,25 @@ else }, damage_groups = {fleshy = 6, burns = 1}, }, + on_place = function(itemstack, user, pointed_thing) + if not minetest.registered_items["fire:basic_flame"] or + lavastuff.enable_tool_fire == false then + return + end + + local node = minetest.get_node(pointed_thing.above) + local pointed = {type = "node", under = pointed_thing.above, above = pointed_thing.above} + local _, can_place = minetest.item_place_node(ItemStack("fire:basic_flame"), user, pointed) + + if node.name == "air" and can_place == true then + minetest.set_node(pointed_thing.above, {name = "fire:permanent_flame"}) + minetest.after(7, function() + if minetest.get_node(pointed_thing.above).name == "fire:permanent_flame" then + minetest.remove_node(pointed_thing.above) + end + end) + end + end, }) end @@ -199,6 +253,25 @@ minetest.register_tool("lavastuff:shovel", { }, damage_groups = {fleshy=4}, }, + on_place = function(itemstack, user, pointed_thing) + if not minetest.registered_items["fire:basic_flame"] or + lavastuff.enable_tool_fire == false then + return + end + + local node = minetest.get_node(pointed_thing.above) + local pointed = {type = "node", under = pointed_thing.above, above = pointed_thing.above} + local _, can_place = minetest.item_place_node(ItemStack("fire:basic_flame"), user, pointed) + + if node.name == "air" and can_place == true then + minetest.set_node(pointed_thing.above, {name = "fire:permanent_flame"}) + minetest.after(7, function() + if minetest.get_node(pointed_thing.above).name == "fire:permanent_flame" then + minetest.remove_node(pointed_thing.above) + end + end) + end + end, sound = {breaks = "default_tool_breaks"}, }) @@ -217,6 +290,25 @@ minetest.register_tool("lavastuff:axe", { }, damage_groups = {fleshy = 7, burns = 1}, }, + on_place = function(itemstack, user, pointed_thing) + if not minetest.registered_items["fire:basic_flame"] or + lavastuff.enable_tool_fire == false then + return + end + + local node = minetest.get_node(pointed_thing.above) + local pointed = {type = "node", under = pointed_thing.above, above = pointed_thing.above} + local _, can_place = minetest.item_place_node(ItemStack("fire:basic_flame"), user, pointed) + + if node.name == "air" and can_place == true then + minetest.set_node(pointed_thing.above, {name = "fire:permanent_flame"}) + minetest.after(7, function() + if minetest.get_node(pointed_thing.above).name == "fire:permanent_flame" then + minetest.remove_node(pointed_thing.above) + end + end) + end + end, sound = {breaks = "default_tool_breaks"}, }) diff --git a/locale/lavastuff.es.tr b/locale/lavastuff.es.tr new file mode 100644 index 0000000..c8e73c1 --- /dev/null +++ b/locale/lavastuff.es.tr @@ -0,0 +1,15 @@ +# textdomain: lavastuff +Lava ingot=Lingote de lava +Lava orb=Orbe de lava +Lava Sword=Espada de lava +Lava Pickaxe=Pico de lava +Lava Shovel=Pala de lava +Lava Axe=Hacha de lava +Lava Helmet=Casco de lava +Lava Chestplate=Peto de lava +Lava Leggings=Polainas de lava +Lava Boots=Botas de lava +Lava Shield=Escudo de lava +Lava Block=Bloque de lava +Lava Stair=Escalera de lava +Lava Slab=Losa de lava \ No newline at end of file diff --git a/settingtypes.txt b/settingtypes.txt index e8e5291..544e1e0 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -2,4 +2,4 @@ lavastuff_cook_limit (Tools will not smelt items if their cooking time is too long) int 15 #Enable lightup -lavastuff_enable_lightup (Tools light up the area around a player upon rightclicking) bool true \ No newline at end of file +lavastuff_enable_tool_fire (Tools light up the area around a player upon rightclicking) bool true \ No newline at end of file