mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Deprecate some legacy item registration logic (#15950)
This commit is contained in:
parent
c30c94dfaa
commit
2569b50252
1 changed files with 10 additions and 2 deletions
|
@ -155,6 +155,8 @@ end
|
||||||
local function preprocess_craft(itemdef)
|
local function preprocess_craft(itemdef)
|
||||||
-- BEGIN Legacy stuff
|
-- BEGIN Legacy stuff
|
||||||
if itemdef.inventory_image == nil and itemdef.image ~= nil then
|
if itemdef.inventory_image == nil and itemdef.image ~= nil then
|
||||||
|
core.log("deprecated", "The `image` field in craftitem definitions " ..
|
||||||
|
"is deprecated. Use `inventory_image` instead.")
|
||||||
itemdef.inventory_image = itemdef.image
|
itemdef.inventory_image = itemdef.image
|
||||||
end
|
end
|
||||||
-- END Legacy stuff
|
-- END Legacy stuff
|
||||||
|
@ -165,6 +167,8 @@ local function preprocess_tool(tooldef)
|
||||||
|
|
||||||
-- BEGIN Legacy stuff
|
-- BEGIN Legacy stuff
|
||||||
if tooldef.inventory_image == nil and tooldef.image ~= nil then
|
if tooldef.inventory_image == nil and tooldef.image ~= nil then
|
||||||
|
core.log("deprecated", "The `image` field in tool definitions " ..
|
||||||
|
"is deprecated. Use `inventory_image` instead.")
|
||||||
tooldef.inventory_image = tooldef.image
|
tooldef.inventory_image = tooldef.image
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -180,6 +184,8 @@ local function preprocess_tool(tooldef)
|
||||||
tooldef.dd_crackiness ~= nil or
|
tooldef.dd_crackiness ~= nil or
|
||||||
tooldef.dd_crumbliness ~= nil or
|
tooldef.dd_crumbliness ~= nil or
|
||||||
tooldef.dd_cuttability ~= nil) then
|
tooldef.dd_cuttability ~= nil) then
|
||||||
|
core.log("deprecated", "Specifying tool capabilities directly in the tool " ..
|
||||||
|
"definition is deprecated. Use the `tool_capabilities` field instead.")
|
||||||
tooldef.tool_capabilities = {
|
tooldef.tool_capabilities = {
|
||||||
full_punch_interval = tooldef.full_punch_interval,
|
full_punch_interval = tooldef.full_punch_interval,
|
||||||
basetime = tooldef.basetime,
|
basetime = tooldef.basetime,
|
||||||
|
@ -262,6 +268,8 @@ function core.register_item(name, itemdef)
|
||||||
|
|
||||||
-- BEGIN Legacy stuff
|
-- BEGIN Legacy stuff
|
||||||
if itemdef.cookresult_itemstring ~= nil and itemdef.cookresult_itemstring ~= "" then
|
if itemdef.cookresult_itemstring ~= nil and itemdef.cookresult_itemstring ~= "" then
|
||||||
|
core.log("deprecated", "The `cookresult_itemstring` item definition " ..
|
||||||
|
"field is deprecated. Use `core.register_craft` instead.")
|
||||||
core.register_craft({
|
core.register_craft({
|
||||||
type="cooking",
|
type="cooking",
|
||||||
output=itemdef.cookresult_itemstring,
|
output=itemdef.cookresult_itemstring,
|
||||||
|
@ -270,6 +278,8 @@ function core.register_item(name, itemdef)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
if itemdef.furnace_burntime ~= nil and itemdef.furnace_burntime >= 0 then
|
if itemdef.furnace_burntime ~= nil and itemdef.furnace_burntime >= 0 then
|
||||||
|
core.log("deprecated", "The `furnace_burntime` item definition " ..
|
||||||
|
"field is deprecated. Use `core.register_craft` instead.")
|
||||||
core.register_craft({
|
core.register_craft({
|
||||||
type="fuel",
|
type="fuel",
|
||||||
recipe=itemdef.name,
|
recipe=itemdef.name,
|
||||||
|
@ -331,7 +341,6 @@ function core.register_alias(name, convert_to)
|
||||||
core.log("warning", "Not registering alias, item with same name" ..
|
core.log("warning", "Not registering alias, item with same name" ..
|
||||||
" is already defined: " .. name .. " -> " .. convert_to)
|
" is already defined: " .. name .. " -> " .. convert_to)
|
||||||
else
|
else
|
||||||
--core.log("Registering alias: " .. name .. " -> " .. convert_to)
|
|
||||||
core.registered_aliases[name] = convert_to
|
core.registered_aliases[name] = convert_to
|
||||||
register_alias_raw(name, convert_to)
|
register_alias_raw(name, convert_to)
|
||||||
end
|
end
|
||||||
|
@ -346,7 +355,6 @@ function core.register_alias_force(name, convert_to)
|
||||||
core.log("info", "Removed item " ..name..
|
core.log("info", "Removed item " ..name..
|
||||||
" while attempting to force add an alias")
|
" while attempting to force add an alias")
|
||||||
end
|
end
|
||||||
--core.log("Registering alias: " .. name .. " -> " .. convert_to)
|
|
||||||
core.registered_aliases[name] = convert_to
|
core.registered_aliases[name] = convert_to
|
||||||
register_alias_raw(name, convert_to)
|
register_alias_raw(name, convert_to)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue