Small simplifications
This commit is contained in:
parent
8bd1628a24
commit
c7633ffd20
@ -111,7 +111,7 @@ minetest.register_abm({
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"xdecor:cauldron_boiling_water"},
|
||||
interval = 3, chance = 1,
|
||||
interval = 5, chance = 1,
|
||||
action = function(pos, node)
|
||||
local objs = minetest.get_objects_inside_radius(pos, 0.5)
|
||||
if not objs then return end
|
||||
@ -124,7 +124,7 @@ minetest.register_abm({
|
||||
|
||||
for _, obj in pairs(objs) do
|
||||
if obj and obj:get_luaentity() then
|
||||
local itemstring = obj:get_luaentity().itemstring:match(":([%w_]+)")
|
||||
local itemstring = obj:get_luaentity().itemstring:match("[^:]+$")
|
||||
if not next(ingredients) then
|
||||
for _, rep in pairs(ingredients) do
|
||||
if itemstring == rep then return end
|
||||
|
@ -83,7 +83,7 @@ local function allowed(tool)
|
||||
end
|
||||
|
||||
function enchanting.put(_, listname, _, stack)
|
||||
local item = stack:get_name():match(":([%w_]+)")
|
||||
local item = stack:get_name():match("[^:]+$")
|
||||
if listname == "mese" and item == "mese_crystal" then
|
||||
return stack:get_count()
|
||||
elseif listname == "tool" and allowed(item) then
|
||||
|
@ -34,17 +34,15 @@ local def = { -- Nodebox name, yield, definition.
|
||||
function worktable.get_recipe(item)
|
||||
if item:find("^group:") then
|
||||
if item:find("wool$") or item:find("dye$") then
|
||||
item = item:match(":([%w_]+)")..":white"
|
||||
elseif minetest.registered_items["default:"..item:match(":([%w_,]+)")] then
|
||||
item = item:match("[^,:]+$")..":white"
|
||||
elseif minetest.registered_items["default:"..item:match("[^,:]+$")] then
|
||||
item = item:gsub("group:", "default:")
|
||||
else
|
||||
for node, definition in pairs(minetest.registered_items) do
|
||||
for group in pairs(definition.groups) do
|
||||
if item:match(".*"..group.."$") then
|
||||
if definition.groups[item:match("[^,:]+$")] then
|
||||
item = node
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return item
|
||||
@ -274,9 +272,9 @@ function worktable.put(_, listname, _, stack)
|
||||
local stackname = stack:get_name()
|
||||
local mod, node = stackname:match("([%w_]+):([%w_]+)")
|
||||
|
||||
if (listname == "input" and worktable.contains(nodes[mod], node)) or
|
||||
if (listname == "tool" and stack:get_wear() > 0 and stackname ~= "xdecor:hammer") or
|
||||
(listname == "input" and worktable.contains(nodes[mod], node)) or
|
||||
(listname == "hammer" and stackname == "xdecor:hammer") or
|
||||
(listname == "tool" and stack:get_wear() > 0) or
|
||||
listname == "storage" then
|
||||
return stack:get_count()
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user