Compare commits
5 Commits
914aea6539
...
aca720dc0f
Author | SHA1 | Date |
---|---|---|
fluxionary | aca720dc0f | |
LoneWolfHT | d3a0da6921 | |
Герхард PICCORO Lenz McKAY | 3eacc17e73 | |
LoneWolfHT | 94d6bd9b44 | |
LoneWolfHT | 4cef3ba46f |
|
@ -2,7 +2,7 @@ unused_args = false
|
|||
max_line_length = 999
|
||||
|
||||
globals = {
|
||||
"minetest", "lavastuff", "armor",
|
||||
"minetest", "lavastuff", "armor", "gettext", "intllib", "ngettext",
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
|
|
|
@ -6,6 +6,7 @@ mobs_monster?
|
|||
3d_armor?
|
||||
toolranks?
|
||||
moreblocks?
|
||||
intllib?
|
||||
vessels?
|
||||
nc_fire?
|
||||
mcl_armor?
|
||||
|
|
89
init.lua
89
init.lua
|
@ -1,15 +1,41 @@
|
|||
lavastuff = {}
|
||||
|
||||
local MODPATH = minetest.get_modpath("lavastuff")
|
||||
local MODNAME = minetest.get_current_modname()
|
||||
local MODPATH = minetest.get_modpath(MODNAME)
|
||||
|
||||
local COOLDOWN = dofile(MODPATH.."/cooldowns.lua")
|
||||
local S
|
||||
|
||||
if minetest.get_translator ~= nil then
|
||||
S = minetest.get_translator(minetest.get_current_modname())
|
||||
S = minetest.get_translator(MODNAME)
|
||||
else
|
||||
S = function(str)
|
||||
return(str)
|
||||
if minetest.get_modpath("intllib") then
|
||||
dofile(minetest.get_modpath("intllib").."/init.lua")
|
||||
if intllib.make_gettext_pair then
|
||||
-- New method using gettext.
|
||||
gettext, ngettext = intllib.make_gettext_pair()
|
||||
else
|
||||
-- Old method using text files.
|
||||
gettext = intllib.Getter()
|
||||
end
|
||||
S = gettext
|
||||
else
|
||||
-- mock the translator function for MT 0.4
|
||||
function minetest.translate(textdomain, str, ...)
|
||||
local arg = {n=select('#', ...), ...}
|
||||
return str:gsub("@(.)", function(matched)
|
||||
local c = string.byte(matched)
|
||||
if string.byte("1") <= c and c <= string.byte("9") then
|
||||
return arg[c - string.byte("0")]
|
||||
else
|
||||
return matched
|
||||
end
|
||||
end)
|
||||
end
|
||||
function minetest.get_translator(textdomain)
|
||||
return function(str, ...) return minetest.translate(textdomain or "", str, ...) end
|
||||
end
|
||||
S = minetest.get_translator(MODNAME)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -113,28 +139,41 @@ function lavastuff.burn_drops(tool)
|
|||
-- loop through current node drops
|
||||
for _, drop in pairs(drops) do -- get cooked output of current drops
|
||||
local stack = ItemStack(drop)
|
||||
local output = minetest.get_craft_result({
|
||||
method = "cooking",
|
||||
width = 1,
|
||||
items = {drop}
|
||||
})
|
||||
local safety = 0
|
||||
|
||||
for _, name in pairs(lavastuff.blacklisted_items) do
|
||||
if name == drop then
|
||||
return old_handle_node_drops(pos, drops, digger, ...)
|
||||
repeat
|
||||
local output, leftover = minetest.get_craft_result({
|
||||
method = "cooking",
|
||||
width = 1,
|
||||
items = {stack:to_string()}
|
||||
})
|
||||
|
||||
for _, name in pairs(lavastuff.blacklisted_items) do
|
||||
if name == drop then
|
||||
return old_handle_node_drops(pos, drops, digger, ...)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- if we have cooked result then add to new list
|
||||
if output and output.item and not output.item:is_empty() and output.time <= lavastuff.cook_limit then
|
||||
table.insert(hot_drops,
|
||||
ItemStack({
|
||||
name = output.item:get_name(),
|
||||
count = output.item:to_table().count,
|
||||
})
|
||||
)
|
||||
else -- if not then return normal drops
|
||||
table.insert(hot_drops, stack)
|
||||
-- if we have cooked result then add to new list
|
||||
if output and output.item and not output.item:is_empty() and output.time <= lavastuff.cook_limit then
|
||||
table.insert(hot_drops,
|
||||
ItemStack({
|
||||
name = output.item:get_name(),
|
||||
count = output.item:to_table().count,
|
||||
})
|
||||
)
|
||||
|
||||
stack = leftover.items[1]
|
||||
else -- if not then return normal drops
|
||||
table.insert(hot_drops, stack)
|
||||
stack = nil
|
||||
end
|
||||
|
||||
safety = safety + 1
|
||||
until (safety > 999 or not stack or stack:get_count() <= 0)
|
||||
|
||||
if safety > 999 then
|
||||
minetest.log("error", "[lavastuff]: Something went wrong with drop cooking")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -411,7 +450,7 @@ minetest.register_node("lavastuff:block", {
|
|||
})
|
||||
|
||||
if minetest.get_modpath("moreblocks") then
|
||||
stairsplus:register_all("lavastuff", "lava", "lavastuff:ingot", {
|
||||
stairsplus:register_all("lavastuff", "lava", "lavastuff:block", {
|
||||
description = "Lava",
|
||||
tiles = {"lavastuff_block.png"},
|
||||
groups = {cracky = 2, level = 2},
|
||||
|
@ -511,4 +550,4 @@ else
|
|||
end
|
||||
end
|
||||
|
||||
minetest.log("action", "[lavastuff]: Mod Loaded!")
|
||||
minetest.log("action", "[lavastuff]: Mod Loaded!")
|
||||
|
|
2
mod.conf
2
mod.conf
|
@ -2,7 +2,7 @@ name = lavastuff
|
|||
description = Adds lava tools, armor, and blocks
|
||||
title = Lava Stuff
|
||||
optional_depends = """
|
||||
mobs_monster, 3d_armor, toolranks, moreblocks,
|
||||
mobs, mobs_monster, 3d_armor, toolranks, moreblocks,
|
||||
fire, stairs, vessels, default, bucket,
|
||||
mcl_armor, mcl_fire, mcl_buckets, mcl_nether, mcl_potions, mcl_core, mcl_mobitems, mcl_tools,
|
||||
nc_fire, nc_api_all, nc_lux, nc_optics
|
||||
|
|
Loading…
Reference in New Issue