Remove lightup feature. Add tool fires. Fix settings

This commit is contained in:
LoneWolfHT 2019-02-08 18:58:36 -08:00
parent 9287198d43
commit 6ab2d23b0f
3 changed files with 130 additions and 23 deletions

136
init.lua
View File

@ -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"},
})

15
locale/lavastuff.es.tr Normal file
View File

@ -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

View File

@ -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
lavastuff_enable_tool_fire (Tools light up the area around a player upon rightclicking) bool true