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